• Persister - Save/Load System
    5 replies, posted
Hi everyone, i built something for DarkRP that would be useful for concurrent players on servers [t]http://cloud-4.steampowered.com/ugc/23966391700822195/2A4AF756D1CEF86953D7B2CDB507C9CD0EC7716E/268x268.resizedimage[/t] [B]Persister[/B] it's a script that saves simple player data between sessions, with persister you can save: [I]-Health/armor -Weapons with the ammo quantity -Position/Angle -Job[/I] [t]http://cloud-4.steampowered.com/ugc/23966391701042029/ED0EB90ED02F0CAB376E5DAC282839C4DB172101/637x358.resizedimage[/t] This creates when the player disconnects, in the case that your gmod crashed, this also creates a backup each 5 minutes, but this delete the data when you die After you initialy spawn, you can load this data, it's cool i guess Anyway, you can save the data writing [B]"!save or /save"[/B] and erase (In the rare case that you want) [B]"!erase or /erase"[/B] Download it!: [URL="http://steamcommunity.com/sharedfiles/filedetails/?id=321019787"]Workshop Link[/URL] or [URL="https://www.dropbox.com/s/lpupnroeilb2e8z/player_serialization.zip?dl=0"]Dropbox[/URL]
You shouldn't need to have 5 minute backups, because even if a player crashes GM:PlayerDisconnected should still be called. Also in your code you named it "PlayerDisconnect" which is incorrect and finally I recommend using gameevents because they're more reliable. [url]http://wiki.garrysmod.com/page/gameevent/Listen[/url]
hum, i think that we discussed somewhere if PlayerDisconnected gets called when player disconnect (I thought that we ended with the hook not being called) Okay, i'll update it
The only problem: The weapons I set up for the player to have on spawn are stripped. edit: and the fact that it breaks my game.
So... like Set/GetPData?
[QUOTE=Jarva;46123817]You shouldn't need to have 5 minute backups, because even if a player crashes GM:PlayerDisconnected should still be called. Also in your code you named it "PlayerDisconnect" which is incorrect and finally I recommend using gameevents because they're more reliable. [url]http://wiki.garrysmod.com/page/gameevent/Listen[/url][/QUOTE] If the server crashes players would lose 100%of the progress they've made since they last logged on.
Sorry, you need to Log In to post a reply to this thread.