Query - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Query (
/showthread.php?tid=634415)
Query -
Loinal - 18.05.2017
Hello, iam trying to make a command like
/query Loinal level 10
or
/query Loinal kills 9
iam a bit confused idk how can i make that any tips??
PHP код:
CMD:query(playerid, params[])
{
new option[20];
if(sscanf(params,"s[24]si"))
{
return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /query [Account] [coloumn] [Value]");
}
if(!strcmp(option, "level", true))
{
return 1;
}
if(!strcmp(option, "kills", true))
{
return 1;
}
return 1;
}
Im using mysql R41-2
Re: Query -
jlalt - 18.05.2017
limit the second string in your sscanf and pass the parameters of vars to store data in them to sscanf.
->
PHP код:
CMD:query(playerid, params[])
{
new username[MAX_PLAYER_NAME],option[20],value;
if(sscanf(params,"s[26]s[20]i",username,option,value))
{
return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /query [Account] [coloumn] [Value]");
}
if(!strcmp(option, "level", true))
{
return 1;
}
if(!strcmp(option, "kills", true))
{
return 1;
}
return 1;
}