AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Getting all of a user's weapon data. (https://forums.alliedmods.net/showthread.php?t=25054)

mysticssjgoku4 03-06-2006 22:04

Getting all of a user's weapon data.
 
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 }

Charr 03-07-2006 14:24

You can try adding some "wait" after the invnext:
Code:
client_cmd("invnext;wait;wait;wait");
Can be affected by lag.

Or you can collect the weapon data first then input them into the SQL


All times are GMT -4. The time now is 20:28.

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