AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Some small questions (very small!) (https://forums.alliedmods.net/showthread.php?t=3547)

splaTTer 07-09-2004 10:33

Some small questions (very small!)
 
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]

Downtown1 07-09-2004 11:10

1.yes
2.yes (when using double quotes you can also do this, command "argument 1 argument 1 still going on" "argument 2, yep still argument 2")
3. Not sure, try using the [ small ] tags.

splaTTer 07-09-2004 11:38

hmm - syntax seems to be ok - but will it work?

and your answer 2 matches question 1 ;)

splaTTer 07-09-2004 22:01

now i tested my code - and it is working BUT:

using:

say pg [email protected]

works fine - but using the binded chat button arg2 is not recognized?! only by using ":
pg "[email protected]"

is that normal? do i have to use console input only?


All times are GMT -4. The time now is 14:36.

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