Author Topic: [Event] Save Datablock  (Read 4575 times)

Event_SaveDatablock
v3

An event that saves the player datablock, and restores it upon respawn

Credit to "Im_AFK" for the idea

DOWNLOAD
« Last Edit: November 14, 2022, 03:58:27 PM by Goth77 »


re-download if u got v2, v3 fixes a missing )

added a server pref $Pref::Server::RestorePlayerDatablocksOnResp awn set to false if you ever need to disable loading saved player datablock on respawn

just tried it out, and I wasn't able to get it to work.

This is what I tried:

onactivate > player > changedatablock > dragon land
onactivate > player > savedatablock

then ctrl k'd and it reverted me back to the standard playertype/minigame playertype

is it possible that the event doesn't support custom playertypes, or could be an add-on conflict?
I am using blockland glass, if that matters

re-download if u got v2, v3 fixes a missing )

added a server pref $Pref::Server::RestorePlayerDatablocksOnResp awn set to false if you ever need to disable loading saved player datablock on respawn
if(isObject(%client.savedDatablock && $Pref::Server::RestorePlayerDatablocksOnResp awn $= true))

You put the second statement within the isObject check, so it will always return false. Pushing out requests super quick is nice, but you should really test your addon before you go through the effort of uploading and posting it.

i'll be sure to use this if my datablocks are ever in trouble

if(isObject(%client.savedDatablock && $Pref::Server::RestorePlayerDatablocksOnResp awn $= true))

You put the second statement within the isObject check, so it will always return false. Pushing out requests super quick is nice, but you should really test your addon before you go through the effort of uploading and posting it.
I tested v1, but not v2 after adding the global var. I debated even adding it since one could easily just disable the mod if they don't want it, or simply not use the save event. A simple error forgetting a single ) but then I went and put it in the wrong spot, oof! $Pref::Server::RestorePlayerDatablocksOnResp awn is set to true when the script loads, and the player needs a savedDatablock to be able to load anyways so the loading on respawn was still working for me oddly enough. that being said, I have updated the code once again. thanks for the feedback!

« Last Edit: November 17, 2022, 08:35:45 AM by Goth77 »