Raised This Month: $ Target: $400
 0% 

Weapon saver for TS


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ChanT
Junior Member
Join Date: Mar 2006
Old 03-16-2006 , 09:17   Weapon saver for TS
Reply With Quote #1

#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
ChanT is offline
ChanT
Junior Member
Join Date: Mar 2006
Old 03-16-2006 , 15:44  
Reply With Quote #2

is no1 here who can help me ?
ChanT is offline
capndurk
Senior Member
Join Date: Feb 2006
Old 03-16-2006 , 15:48  
Reply With Quote #3

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!
capndurk is offline
ChanT
Junior Member
Join Date: Mar 2006
Old 03-16-2006 , 15:52  
Reply With Quote #4

hmmm... can u give me an example please? i understand what u mean but i dont know how to do this
ChanT is offline
capndurk
Senior Member
Join Date: Feb 2006
Old 03-16-2006 , 15:59  
Reply With Quote #5

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.
capndurk is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:31.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode