SA-MP Forums Archive
Its very important!!!!! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Its very important!!!!! (/showthread.php?tid=77857)



Its very important!!!!! - pierhs - 15.05.2009

I want players to keep their guns after disconnect but I can't do it.What I have to do?
Thank you in advance


Re: Its very important!!!!! - Ignas1337 - 15.05.2009

you have to do it in this order:
1. Create global values for ALL players reffering to their weapons and the ammo
F.E.: new gGun1, gAmmo1, ...;
2. Get players' weapons to those values. I suggest onplayercommandtext and like a /saveguns command
3. Save these values into a file named 'player_name.txt' or '... .ini' or whatnot. or you could use any other data storage method like mysql.
4. when player connects check if he has a file reffering to his name. if(fexists(filename)) ... and if there exists load the guns. I would create a script , but that would be against my principles!

EDIT: sorry, nt when player connects you give him the guns, but when he spawns. and you'd like to not make the /saveguns command because that woud make guns infinite sometimes. like he dies and reloads... well just check for guns every now and then with a timer or on a certai ncallback!