Weapon saver for TS
#include <amxmodx>
#include <amxmisc> #include <tsx> new curwp[33] public plugin_init(){ register_plugin("Weaponsaver","0.1","ChanT") register_srvcmd("save_wep","client_disconnect ") } public client_disconnect(id){ new clip,ammo curwp[id] = get_user_weapon(id,clip,ammo) return PLUGIN_HANDLED } public client_connect(id){ ts_giveweapon(id,curwp[id],0,0) return PLUGIN_CONTINUE } Hey all trying to make a plugin that saves the actual weapons when u disconnect and then when u get back ingame u will get them back but i dunno really how to do this... can anyone help me out? ChanT |
is no1 here who can help me :(?
|
You'd probably have to store the weapon and ammo in a file with the player's steam id, because your code assumes that only the same 32 people keep the same player ids when they enter and leave the server, and that isn't true.
What you'd have to do is on client disconnect, you'd have to search the file for the player's steam id, and if it exists, overwrite the line with the new gun and ammo, and if it doesn't exist, create a new line. On client connect, you'd read the file for the steam id, and if it wasn't there, you wouldn't do anything, but if it was, you'd get the weapon and ammo information from the file and then give it to him. At least, that's the logic I'd follow if I were trying to make that. Good luck! :) |
hmmm... can u give me an example please? i understand what u mean but i dont know how to do this :P
|
To be honest, I don't know much about reading/writing to files, either. But you should check out read_file() and write_file() in the funcwiki and ask some people for help.
|
| All times are GMT -4. The time now is 16:31. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.