Help /getid
#1

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;
}
Reply
#2

You should probably translate that to English, cause I have no idea what you want us to do.
Reply
#3

Okey
Reply
#4

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".
Reply
#5

Now I can not find any name or id
Reply
#6

What do you mean you cannot find any name or ID? Use the code that Konstantinos posted.
That code works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)