I've been looking around and still am having problems coding certain things.
For instance, this below, Doesn't collect but one gun, because I bet it only has time to do only one "invnext" command before it exits.
Is there another way to collect all of a users weapons, and their ammo, clip, and flags?
Code:
public weaponsave(id)
{
new query[256]
new Sql:dbc = remorp_get_sqldatabase()
new oldgunid
for(new i=1;i<=35;i++)
{
client_cmd(id,"invnext")
new ammo, clip, mode, extra
new gunid = ts_getuserwpn(id,ammo,clip,mode,extra)
if(gunid == oldgunid) {
return PLUGIN_HANDLED
}
oldgunid = gunid
if(gunid >= 1 && gunid <= 35) {
new authid[32]
get_user_authid(id,authid,31)
format(query,256,"INSERT INTO user_weapons (SteamID,GunID,Clip,Ammo,Flags) VALUES('%s','%i','%i','%i','%i')", authid,gunid,ammo,clip,extra)
dbi_query(dbc,"%s",query)
}
}
return PLUGIN_HANDLED
}
__________________