Raised This Month: $ Target: $400
 0% 

Some small questions (very small!)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
splaTTer
Junior Member
Join Date: Jul 2004
Old 07-09-2004 , 10:33   Some small questions (very small!)
Reply With Quote #1

hi,
i am new to amxmodx. i just coded some small amx plugins but i still have some small questions about the scripting language.

1.
read_argv(1,args,8)
read_argv(2,arg2,256)

that means:

command args arg2

while args has a length of max 8 characters and arg2 of 256 - right?

an example would be:

say /kick affe

command="say"
args="/kick"
arg2="affe"

so arguments are seperated by a blank (space)?


2.
i often see values inserted by %s and sometimes by %d.

does that mean %s is a string and %d is a number?
so how to know what is a string and what is a number?

3.
is this code ok?:

Code:
public pricesay(id) {     new customURL[256], priceURLe[256], priceURL[256]     new args[8], arg2[256]     new querysea[256], queryupd[256], authid[32], nick[32]     get_user_authid(id,authid,31)     get_user_name(id,nick,31)     read_argv(1,args,8)     read_argv(2,arg2,256)     get_cvar_string("amx_price_url",priceURL,255)         if (args[0] == 'p' && args[1] == 'g') {     if(containi(arg2, "@")!=-1){     format(querysea,255,"SELECT player_steam FROM amx_pricegamers WHERE player_steam='%s'", authid);     mysql_query(mysql,querysea)     if(mysql_nextrow(mysql)>0){         format(queryupd,255,"UPDATE amx_pricegamers SET player_email='%s' WHERE player_steam='%s'", arg2, authid);         }     else{         format(queryupd,255,"INSERT INTO amx_pricegamers (player_steam, player_nick, player_email) VALUES ('%s', '%s', '%s')",authid,nick,arg2);         }     mysql_query(mysql,queryupd)             client_print(id,print_chat,"[AMX] You have been registered with email: %s",arg2)     }         else{     format(querysea,255,"SELECT player_steam FROM amx_pricegamers WHERE player_steam='%s'", authid);     mysql_query(mysql,querysea)     if(mysql_nextrow(mysql)>0){         format(queryupd,255,"UPDATE amx_pricegamers SET player_password='%s' WHERE player_steam='%s'", arg2, authid);         }     else{         format(queryupd,255,"INSERT INTO amx_pricegamers (player_steam, player_nick, player_password) VALUES ('%s', '%s', '%s')",authid,nick,arg2);         }     mysql_query(mysql,queryupd)             client_print(id,print_chat,"[AMX] You have been registered with password: %s",arg2)     }         format(priceURLe, 255,"%spg.php?steamid=%s", priceURL, authid)         show_motd(id, priceURLe, "")         return PLUGIN_HANDLED     }     if(containi(args, "/url")!=-1) {     format(customURL, 255, "http://%s", arg2)         show_motd(id, customURL, "")     client_print(id,print_chat,"[AMX] URL=%s",customURL)             return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE }

if its ok - could it be tuned? any suggestions?


1000 thanks 4 your help!

nice to be with u ;)

ok - hmm small tags - nice - /me blind[/small]
splaTTer is offline
 



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:36.


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