Raised This Month: $ Target: $400
 0% 

compiles perfectly but doesn't work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 05-06-2006 , 16:29   compiles perfectly but doesn't work
Reply With Quote #1

hi i get these errors in game
Code:
 05/06/2006 - 15:26:04: [AMXX] Native error in "dbi_query" on line 144 (file "clothesmod.sma"). L 05/06/2006 - 15:26:04: [MYSQL] Invalid database handle -1 L 05/06/2006 - 15:26:04: [AMXX] Native error in "dbi_query" on line 153 (file "clothesmod.sma"). L 05/06/2006 - 15:26:04: [MYSQL] Invalid database handle -1

and here is the sma
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <fun> #include <dbi> #define PLUGIN "New Plug-In" #define VERSION "beta1" #define AUTHOR "Wonsae" new has_clothes[33]    // Does the player have the clothes item on? new new_clothes[33][32] // New Model specified new cur_clothes[33][32] // Clothes Model Stored Here By Items new old_clothes[33][32] // Old model they had new default_model[32] = "collector-civilian" new Sql:dbc new Result:result public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_srvcmd("item_clothes","item_clothes")     register_concmd("amx_changemodel","changemodel",ADMIN_KICK,"amx_changemodel <name> <model>")     register_concmd("amx_addclothes","admin_addclothes") } public plugin_precache()     {     precache_model("models/player/collector-civilian/collector-civilian.mdl")     } public sql_init() {     new host[64], username[33], password[32], dbname[32], error[32]     get_cvar_string("economy_mysql_host",host,64)         get_cvar_string("economy_mysql_user",username,32)         get_cvar_string("economy_mysql_pass",password,32)         get_cvar_string("economy_mysql_db",dbname,32)     dbc = dbi_connect(host,username,password,dbname,error,32)     if (dbc == SQL_FAILED)     {         server_print("[ClothesMod] Could Not Connect To SQL Database^n")     }     else     {     server_print("[ClothesMod] Connected To SQL, Have A Nice Day!^n")     } } public client_connect(id)     {     client_cmd(id,"model %s",default_model) } public client_infochanged(id){     get_user_info(id,"model",new_clothes[id],31)     if(has_clothes[id] == 0){         set_user_info(id,"model",default_model)         client_print(id,print_chat,"[ClothesMod] You may not change your clothes that way")         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED } public item_clothes(){     new arg[33], arg2[33], id, model     read_argv(1,arg,32)     read_argv(2,arg2,32)         id = str_to_num(arg)     model = str_to_num(arg2)         if(has_clothes[id] == 0){         get_user_info(id,"model",old_clothes[id],31)                 set_user_info(id,"model",arg2)                 format(cur_clothes[id],31,arg2)                 client_print(id,print_chat,"[ClothesMod] You have changed your clothes.")                 new name[32]         get_user_name(id,name,31)         client_print(0,print_chat,"[ClothesMod] %s has changed his clothes",name)                 has_clothes[id] = 1     }     else     {         set_user_info(id,"model",default_model)         client_print(id,print_chat,"[ClothesMod] You put back on your old clothes")         has_clothes[id] = 0     }     return PLUGIN_HANDLED } public changemodel(id, level, cid){     if (cmd_access(id, level, cid, 3))         return PLUGIN_HANDLED         new szArg1[32], szArg2[32]     read_argv(1, szArg1, 31)     read_argv(2, szArg2,31)         new Target = cmd_target(id, szArg1, 14)         if (!Target)         return PLUGIN_HANDLED     new szName[32]     get_user_name(Target, szName, 31)     set_user_info(id,"model",szArg2)     client_print(id,print_chat,"[ClothesMod] You have changed your clothes")     return PLUGIN_HANDLED }     public admin_addclothes(id)     {     if(!(get_user_flags(id) & ADMIN_IMMUNITY))         {         client_print(id, print_console, "[AMXX] You do not have access to this command!^n")         return PLUGIN_HANDLED     }         new itemid[32], modelname[32], model[32], desp[32], query[256]         read_argv(1,itemid,31)     read_argv(2,modelname,31)     read_argv(3,model,31)     read_argv(4,desp,31)             if(equali(itemid,"") || equali(modelname,"") || equali(model,""))         {         client_print(id,print_console,"Usage:  amx_addclothes <itemid> <modelname> <model>^n")         return PLUGIN_HANDLED     }         format(query,255,"SELECT ItemID FROM Title WHERE ItemID=%i",itemid,modelname)     result = dbi_query(dbc,"%s",query)     if(result >= RESULT_OK)         {         dbi_nextrow(result)         client_print(id,print_console,"[AMXX] This itemid is already in use by another item^n")         dbi_free_result(result)         return PLUGIN_HANDLED     }     format(query,255,"INSERT INTO jobs (ItemID,Title,Command,Description) VALUES('%i','%s','item_clothes <id> %i','%s','1','1','0','0')",itemid,modelname,model,desp)     dbi_query(dbc,"%s",query)     client_print(id,print_console,"[AMXX] Clothes was added to the database^n")     return PLUGIN_HANDLED }

this is for amxx 1.01
I'm trying to use the amx_addclothes function
wonsae is offline
Des12
Senior Member
Join Date: Jan 2005
Old 05-06-2006 , 16:41  
Reply With Quote #2

Code:
new itemstore[32], itemid; read_argv(1,itemstore,31) ; itemid = str_to_num(itemstore);

You were using a string instead of an integer to store itemid
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 05-06-2006 , 16:48  
Reply With Quote #3

Still didn't work
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <fun> #include <dbi> #define PLUGIN "New Plug-In" #define VERSION "beta1" #define AUTHOR "Wonsae" new has_clothes[33]    // Does the player have the clothes item on? new new_clothes[33][32] // New Model specified new cur_clothes[33][32] // Clothes Model Stored Here By Items new old_clothes[33][32] // Old model they had new default_model[32] = "collector-civilian" new Sql:dbc new Result:result public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_srvcmd("item_clothes","item_clothes")     register_concmd("amx_changemodel","changemodel",ADMIN_KICK,"amx_changemodel <name> <model>")     register_concmd("amx_addclothes","admin_addclothes") } public plugin_precache()     {     precache_model("models/player/collector-civilian/collector-civilian.mdl")     } public sql_init() {     new host[64], username[33], password[32], dbname[32], error[32]     get_cvar_string("economy_mysql_host",host,64)         get_cvar_string("economy_mysql_user",username,32)         get_cvar_string("economy_mysql_pass",password,32)         get_cvar_string("economy_mysql_db",dbname,32)     dbc = dbi_connect(host,username,password,dbname,error,32)     if (dbc == SQL_FAILED)     {         server_print("[ClothesMod] Could Not Connect To SQL Database^n")     }     else     {     server_print("[ClothesMod] Connected To SQL, Have A Nice Day!^n")     } } public client_connect(id)     {     client_cmd(id,"model %s",default_model) } public client_infochanged(id){     get_user_info(id,"model",new_clothes[id],31)     if(has_clothes[id] == 0){         set_user_info(id,"model",default_model)         client_print(id,print_chat,"[ClothesMod] You may not change your clothes that way")         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED } public item_clothes(){     new arg[33], arg2[33], id, model     read_argv(1,arg,32)     read_argv(2,arg2,32)         id = str_to_num(arg)     model = str_to_num(arg2)         if(has_clothes[id] == 0){         get_user_info(id,"model",old_clothes[id],31)                 set_user_info(id,"model",arg2)                 format(cur_clothes[id],31,arg2)                 client_print(id,print_chat,"[ClothesMod] You have changed your clothes.")                 new name[32]         get_user_name(id,name,31)         client_print(0,print_chat,"[ClothesMod] %s has changed his clothes",name)                 has_clothes[id] = 1     }     else     {         set_user_info(id,"model",default_model)         client_print(id,print_chat,"[ClothesMod] You put back on your old clothes")         has_clothes[id] = 0     }     return PLUGIN_HANDLED } public changemodel(id, level, cid){     if (cmd_access(id, level, cid, 3))         return PLUGIN_HANDLED         new szArg1[32], szArg2[32]     read_argv(1, szArg1, 31)     read_argv(2, szArg2,31)         new Target = cmd_target(id, szArg1, 14)         if (!Target)         return PLUGIN_HANDLED     new szName[32]     get_user_name(Target, szName, 31)     set_user_info(id,"model",szArg2)     client_print(id,print_chat,"[ClothesMod] You have changed your clothes")     return PLUGIN_HANDLED }     public admin_addclothes(id)     {     if(!(get_user_flags(id) & ADMIN_IMMUNITY))         {         client_print(id, print_console, "[AMXX] You do not have access to this command!^n")         return PLUGIN_HANDLED     }     new itemstore[32], modelname[32], model[32], desp[32], query[256], itemid         read_argv(1,itemstore,31)     read_argv(2,modelname,31)     read_argv(3,model,31)     read_argv(4,desp,31)         itemid = str_to_num(itemstore)         if(equali(itemstore,"") || equali(modelname,"") || equali(model,""))         {         client_print(id,print_console,"Usage:  amx_addclothes <itemid> <modelname> <model>^n")         return PLUGIN_HANDLED     }         format(query,255,"SELECT ItemID FROM Title WHERE ItemID=%i",itemid,modelname)     result = dbi_query(dbc,"%s",query)     if(result >= RESULT_OK)         {         dbi_nextrow(result)         client_print(id,print_console,"[AMXX] This itemid is already in use by another item^n")         dbi_free_result(result)         return PLUGIN_HANDLED     }     format(query,255,"INSERT INTO jobs (ItemID,Title,Command,Description) VALUES('%i','%s','item_clothes <id> %i','%s','1','1','0','0')",itemid,modelname,model,desp)     dbi_query(dbc,"%s",query)     client_print(id,print_console,"[AMXX] Clothes was added to the database^n")     return PLUGIN_HANDLED }

Code:
L 05/06/2006 - 15:46:46: [AMXX] Native error in "dbi_query" on line 145 (file "clothesmod.sma").
L 05/06/2006 - 15:46:46: [MYSQL] Invalid database handle -1
L 05/06/2006 - 15:46:46: [AMXX] Native error in "dbi_query" on line 154 (file "clothesmod.sma").
L 05/06/2006 - 15:46:46: [MYSQL] Invalid database handle -1
wonsae is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 05-06-2006 , 18:35  
Reply With Quote #4

ure not calling sql_init() at any point
__________________
plop
p3tsin is offline
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 05-06-2006 , 18:35  
Reply With Quote #5

=o! lol i forgot that
wonsae is offline
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 05-06-2006 , 20:04  
Reply With Quote #6

still doesn't work :\ now no errors in console or anything
wonsae is offline
Des12
Senior Member
Join Date: Jan 2005
Old 05-07-2006 , 03:28  
Reply With Quote #7

Code:
format(query,255,"INSERT INTO jobs ...

dont you want to do

Code:
format(query,255,"INSERT INTO items ...
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 05-07-2006 , 03:31  
Reply With Quote #8

I did do that
wonsae is offline
Rixorster
Senior Member
Join Date: Jul 2005
Old 05-07-2006 , 06:58  
Reply With Quote #9

You copied the hole SQL thing from HarbuRP Source >.<
__________________
You never know, what will happen the day after tomorrow...

+karma if i helped you!
Rixorster is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 05-07-2006 , 07:12  
Reply With Quote #10

umm.. why are u first looking for the item in table "Title" and if not found, inserting it into "jobs"
__________________
plop
p3tsin 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 05:09.


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