Raised This Month: $ Target: $400
 0% 

Pissing me off....TS Weapon Crap


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 08-21-2005 , 15:51   Pissing me off....TS Weapon Crap
Reply With Quote #1

Ok, I've been working on this for a long time, and this is pissing me off.
I keep executing the savegun feature, and it shows me this in the console.

Code:
WeaponID: 4, Clip: 7, Ammo: 60, Mode: 3, Extra: <
wtf? Extra should be 1, 2, 4, 8 not that crap.
Would anyone know why this is happening?

THanks.

Code:
////////////////////////////////////////////// //-------------------------------------------- //-Weapon Remember---Remo Williams------------ //-------------------------------------------- //////////////////////////////////////////////// #include <amxmodx> #include <amxmisc> #include <dbi> #include <engine> #include <fun> #include <tsx> new Sql:dbc new Result:result // Start of plugin public plugin_init() {     register_plugin("Weapon Checker","1.0","Remo Williams")     register_concmd("amx_savegun","check_weapons",ADMIN_IMMUNITY," - Saves Guns in TS")     register_concmd("amx_savegun2","check_w",ADMIN_IMMUNITY," - Saves Guns in TS")     register_concmd("amx_returngun","return_weapons",ADMIN_IMMUNITY," - Returns Guns in TS")     register_cvar("weapon_save_host","localhost")     register_cvar("weapon_save_user","root")     register_cvar("weapon_save_pass","")     register_cvar("weapon_save_db","economy")     set_task(1.0,"start_sql")     set_task(10.0, "check_weapons", _, _, _, "b", 1) } //Create a connection (BY Harbu public start_sql() {     new host[32], username[32], password[32], dbname[32], error[32]     get_cvar_string("weapon_save_host",host,32)     get_cvar_string("weapon_save_user",username,32)     get_cvar_string("weapon_save_pass",password,32)     get_cvar_string("weapon_save_db",dbname,32)     dbc = dbi_connect(host,username,password,dbname,error,32)     if (dbc == SQL_FAILED)         {         server_print("[WeaponSave] Could Not Connect To SQL Database^n")     }     else         {         server_print("[WeaponSave] Connected To SQL, Have A Nice Day!^n")     } } public check_weapons(id) {     new ammo, clip, mode, extra, authid[32], name[32]     get_user_authid(id,authid,sizeof(authid))     get_user_name(id, name, 31)     new gunid = ts_getuserwpn(id, ammo, clip, mode, extra)     if(!is_user_connected(id)) {         return PLUGIN_HANDLED     }     if(clip >= 1) {         get_user_authid(id, authid, 31)         dbi_query(Sql:dbc,"INSERT INTO plr_weapons (SteamID, gunid, ammo, clip, mode, extra) VALUES('%s','%i','%i','%i','%i','%i')", authid, gunid, clip, ammo, mode, extra)         console_print(id, "WeaponID: %i, Clip: %d, Ammo: %d, Mode: %d, Extra: %s", gunid, ammo, clip, mode, extra)         return PLUGIN_HANDLED     }     console_print(id,"Gun Not Detected! For Player: %s", name)     return PLUGIN_HANDLED } public client_spawn(id) {     return_weapons(id) } public return_weapons(id) {     new query[256], playername[33], authid[32]     get_user_authid( id, authid, 31)     get_user_name( id, playername, sizeof(playername))     if(!is_user_connected(id)) {         return PLUGIN_HANDLED     }     format( query, 255, "SELECT gunid,ammo,clip,extra FROM plr_weapons WHERE steamid='%s'", authid)     result = dbi_query( dbc, query)     new GunID, Ammo, Clip, Extra     if( dbi_nextrow( result ) > 0 ) {         GunID = dbi_field(result,1)         Ammo = dbi_field(result,2)         Clip = dbi_field(result,3)         Extra = dbi_field(result,4)         dbi_free_result(result)                 ts_giveweapon(id,GunID,Ammo,Extra)         client_print(id,print_console,"ID: %s, GunID: %i, AMMO: %i, CLIP: %i,EXTRA: %i",authid,GunID,Ammo,Clip,Extra)             }     return PLUGIN_HANDLED }
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 08-21-2005 , 15:55  
Reply With Quote #2

It might actually return some crazy bit-code. See if displaying it with %d differs from %i.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 08-21-2005 , 20:59  
Reply With Quote #3

Ok, thanks, Someone only notified me of only two variables, S for string, and I for integer.
BUT, it doesn't insert it into the sql. The names are correct....does it matter if the column is varchar?
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 08-21-2005 , 21:07  
Reply With Quote #4

%s is string, %i is integer, %f is float, %L is language (AMXx specific I believe), and %d is simply "data", which should be capable of displaying any type of data.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 08-21-2005 , 22:19  
Reply With Quote #5

Quote:
Originally Posted by XxAvalanchexX
%s is string, %i is integer, %f is float, %L is language (AMXx specific I believe), and %d is simply "data", which should be capable of displaying any type of data.
Alright, thanks, but it isn't inserting it into the sql.
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 08-21-2005 , 23:01  
Reply With Quote #6

Great, but I thought your problem was the "extra" variable -- have you tried displaying it with %d and seeing if the output is different?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 08-22-2005 , 01:18  
Reply With Quote #7

Quote:
Originally Posted by XxAvalanchexX
Great, but I thought your problem was the "extra" variable -- have you tried displaying it with %d and seeing if the output is different?
I'm using %d for the output, it echo's it back right, but now it isn't inserting anything into the sql. It was inserting the other information in there before I added the gunid variable.....any suggestions?

Thank You, Man.

---
Update: Here's the current script I'm Using:

Code:
////////////////////////////////////////////// //-------------------------------------------- //-Weapon Remember---Remo Williams------------ //-------------------------------------------- //////////////////////////////////////////////// #include <amxmodx> #include <amxmisc> #include <dbi> #include <engine> #include <fun> #include <tsx> new Sql:dbc new Result:result // Start of plugin public plugin_init() {     register_plugin("Weapon Checker","1.0","Remo Williams")     register_concmd("amx_savegun","check_weapons",ADMIN_IMMUNITY," - Saves Guns in TS")     register_concmd("amx_savegun2","check_w",ADMIN_IMMUNITY," - Saves Guns in TS")     register_concmd("amx_returngun","return_weapons",ADMIN_IMMUNITY," - Returns Guns in TS")     register_cvar("weapon_save_host","localhost")     register_cvar("weapon_save_user","root")     register_cvar("weapon_save_pass","")     register_cvar("weapon_save_db","economy")     set_task(1.0,"start_sql")     set_task(10.0, "check_weapons", _, _, _, "b", 1) } //Create a connection (BY Harbu public start_sql() {     new host[32], username[32], password[32], dbname[32], error[32]     get_cvar_string("weapon_save_host",host,32)     get_cvar_string("weapon_save_user",username,32)     get_cvar_string("weapon_save_pass",password,32)     get_cvar_string("weapon_save_db",dbname,32)     dbc = dbi_connect(host,username,password,dbname,error,32)     if (dbc == SQL_FAILED)         {         server_print("[WeaponSave] Could Not Connect To SQL Database^n")     }     else         {         server_print("[WeaponSave] Connected To SQL, Have A Nice Day!^n")     } } public check_weapons(id) {     new ammo, clip, mode, extra, authid[32], name[32]     get_user_authid(id,authid,sizeof(authid))     get_user_name(id, name, 31)     new gunid = ts_getuserwpn(id, ammo, clip, mode, extra)     if(!is_user_connected(id)) {         return PLUGIN_HANDLED     }     if(clip >= 1) {         get_user_authid(id, authid, 31)         dbi_query(Sql:dbc,"INSERT INTO plr_weapons (SteamID, gunid, ammo, clip, mode, extra) VALUES('%s','%d','%i','%i','%i','%d')", authid, gunid, clip, ammo, mode, extra)         console_print(id, "WeaponID: %i, Clip: %d, Ammo: %d, Mode: %d, Extra: %d", gunid, ammo, clip, mode, extra)         return PLUGIN_HANDLED     }     console_print(id,"Gun Not Detected! For Player: %s", name)     return PLUGIN_HANDLED } public client_spawn(id) {     return_weapons(id) } public return_weapons(id) {     new query[256], playername[33], authid[32]     get_user_authid( id, authid, 31)     get_user_name( id, playername, sizeof(playername))     if(!is_user_connected(id)) {         return PLUGIN_HANDLED     }     format( query, 255, "SELECT gunid,ammo,clip,extra FROM plr_weapons WHERE steamid='%s'", authid)     result = dbi_query( dbc, query)     new GunID, Ammo, Clip, Extra     if( dbi_nextrow( result ) > 0 ) {         GunID = dbi_field(result,1)         Ammo = dbi_field(result,2)         Clip = dbi_field(result,3)         Extra = dbi_field(result,4)         dbi_free_result(result)                 ts_giveweapon(id,GunID,Ammo,Extra)         client_print(id,print_console,"ID: %s, GunID: %i, AMMO: %i, CLIP: %i,EXTRA: %i",authid,GunID,Ammo,Clip,Extra)             }     return PLUGIN_HANDLED }
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 08-22-2005 , 08:50  
Reply With Quote #8

*Bump*
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 08-22-2005 , 14:21  
Reply With Quote #9

Stop using SQL for such a stupid little thing?
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 08-22-2005 , 17:53  
Reply With Quote #10

Quote:
Originally Posted by Twilight Suzuka
Stop using SQL for such a stupid little thing?
Don't post unless you're going to help? KthnxBai.
The plugin is designed to save the players weapons in which they EARNED THE MONEY FOR TO BUY!!! OMG THAT IS SO STUPID!
Please now. It would be nice if someone would assist me. Thanks.

----

I got it fixed. I found out, it wasn't connecting to the db. One of the commands at top wasn't attached to anything, and the compiler failed to give me an error. Fixed.
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
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 14:17.


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