i am new to amxmodx. i just coded some small amx plugins but i still have some small questions about the scripting language.
1.
2.
3.
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
}