Author Topic: How would i make a save/load script  (Read 952 times)

How would i make a save/load script to save somthing like: %client.Blah and when they would enter the server they would still have that amount blah so if someone had 2 of it then left and came back they would still have 2
« Last Edit: August 02, 2012, 09:58:51 PM by bloxmaster »

If the value is only used after spawning, you can use default player_persistence hooks to save and load values. If you need it before spawn, you should write your own custom save/load system. Most people do fine using file i/o

Ok so how would I make the server read from a .txt file? Or if there is an easier way to do it.

Does it have to e able to save through crashes?

It would be extremely helpful for you to tell us what exactly you're saving and what for. Different saving and loading processes are useful in different situations

It would be extremely helpful for you to tell us what exactly you're saving and what for. Different saving and loading processes are useful in different situations
I just want to know if he NEEDS it to be a file saver/loader.

Ok so my friend had an idea for like a merit script on his server so if someone does somthing good they get a merit but it sucks if they leave and they go back to 0 so i want the merits to save

Ok so my friend had an idea for like a merit script on his server so if someone does somthing good they get a merit but it sucks if they leave and they go back to 0 so i want the merits to save
Well what you could do is use global variables, make one for each ID so that when the player leaves, it saves their merits and when they join it loads their merits.

^

Variables will look like this: $Merit::Level[bl_id]
To save: export(filepath,"$Merit::Level*");
To load: exec(filepath);


i feel like player persistance could handle this somehow

i feel like player persistance could handle this somehow
It can
If the value is only used after spawning, you can use default player_persistence hooks to save and load values.

i was looking for that and somehow didn't see it