Raised This Month: $ Target: $400
 0% 

it appears that my function should work...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TotalNoobScripter
Senior Member
Join Date: Aug 2004
Old 10-03-2004 , 11:34   it appears that my function should work...
Reply With Quote #1

can any one tell me the bug(s) of my noob script. It suppose to change the varaibles you see then in a mysql database. The function is called by a menu with jobchange(id,"Bellboy", "6");. the mysql database has a job column that corresponds with an authid colum.

Code:
public jobchange(id,newjob[],sal[]){     new authid[32],query[256];     get_user_authid(id,authid,31);     format(query,255,"UPDATE money SET job=%s,WHERE steamid='%s'",newjob,authid);     mysql_query(mysql,query);     format(query,255,"UPDATE money SET salary=%s,WHERE steamid='%s'",sal,authid);     mysql_query(mysql,query);     server_cmd("amx_csay User %s's job info has been changed",authid);         return PLUGIN_HANDLED; }
TotalNoobScripter is offline
Send a message via AIM to TotalNoobScripter
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 10-03-2004 , 11:39  
Reply With Quote #2

In SQL, strings must be enclosed in single quotes.. You have done this for SteamID, but not for Job... Also, you have an extra comma in there, syntax error..

Change:
Code:
UPDATE money SET job=%s,WHERE steamid='%s'
To:
Code:
UPDATE money SET job='%s' WHERE steamid='%s'

Also, you could combine both of your queries into:
Code:
UPDATE money SET job='%s', salary='%s' WHERE steamid='%s'

Maybe that helps!!
xeroblood is offline
Send a message via MSN to xeroblood
TotalNoobScripter
Senior Member
Join Date: Aug 2004
Old 10-03-2004 , 12:05   nothin
Reply With Quote #3

ok i expanded my plugin to this....

Code:
public jobchange(id,newjob[],sal[]){     new authid[32],query[256],numoldbal[32];     get_user_authid(id,authid,31);     format(query,255,"SELECT balance FROM money WHERE steamid='%s'",authid);     mysql_query(mysql,query);     mysql_getfield(mysql,1,"numoldbal",31);     oldbal = str_to_num(numoldbal);     if(oldbal > 250) {     format(query,255,"UPDATE money SET balance=balance-250 WHERE steamid='%s'",authid);     mysql_query(mysql,query);     client_print(id,print_chat,"[-Snort-] You Have Been Charged a $250 Employment Fee.");     format(query,255,"UPDATE money SET job='%s', salary='%s' WHERE steamid='%s'",newjob,sal,authid);     mysql_query(mysql,query);     client_print(id,print_chat,"Your Job Has Been Changed",authid);     return PLUGIN_HANDLED;     } else {         client_print(id,print_chat,"[-Snort-] You Don't Have The Money To Pay The $250 Employment Fee");         return PLUGIN_HANDLED;         } }

The problem is IT KEEPS SAYING THAT U DONT HAVE $250 WHEN U DO!
someone plz help! plz plz plz plz plz plz plz plz plz plz
TotalNoobScripter is offline
Send a message via AIM to TotalNoobScripter
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 17:21.


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