Help /getid - 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: Help /getid (
/showthread.php?tid=515701)
Help /getid -
NiKi123 - 27.05.2014
Hi, I have a problem with the condition.
I made a command / GetId but when write /getid n or other write Usage: / GetId <Part of nick>
Код:
CMD:getid(playerid,params[])
{
new Nick[24],count=0;
if(sscanf(params, "s[24]",Nick)) return SendClientMessage(playerid, 0xFFFF00C8, "Usage: /getid <Part of nick>");
format(Jstring,sizeof(Jstring),"____Seach result for \"%s\"____",Nick);
SendClientMessage(playerid,lighterblue,Jstring);
foreach(Player, i)
{
if(strfind(GetName(i),Nick,true) != -1 )
{
count++;
format(Jstring,sizeof(Jstring),"%d - %s(ID: %d)",count,GetName(i),i);
SendClientMessage(playerid,green,Jstring);
}
}
if(count==0)
SendClientMessage(playerid,red,"No resuilt found!");
return 1;
}
Re: Help /getid -
Luis- - 27.05.2014
You should probably translate that to English, cause I have no idea what you want us to do.
Re: Help /getid -
NiKi123 - 27.05.2014
Okey
Re: Help /getid -
Konstantinos - 27.05.2014
You don't actually need sscanf for that so remove "Nick" as variable and replace it with:
pawn Код:
new count;// count is 0 by default
if(isnull(params)) return SendClientMessage(playerid, 0xFFFF00C8, "Usage: /getid <Part of nick>");
and replace any "Nick" with "params".
Re: Help /getid -
NiKi123 - 27.05.2014
Now I can not find any name or id
Re: Help /getid -
iFiras - 27.05.2014
What do you mean you cannot find any name or ID? Use the code that Konstantinos posted.
That code works.