[HELP] /id Command - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] /id Command (
/showthread.php?tid=201793)
[HELP] /id Command -
Fredden1993 - 22.12.2010
I'm trying to create a command called /id which will work like if you type /id and a players name the ID of that player should appear.
For example "/id Matthew_Salinas" = "(ID: 3) Matthew_Salinas".
I'm almost done with it but it's bugged as hell so, I would appreciate if you could help me with a new one.
Thanks
Re: [HELP] /id Command -
HyperZ - 22.12.2010
On top of ur script.
pawn Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
OnPlayerCommandText
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(id,2,cmdtext);
return 0;
}
somewhere in ur script.
pawn Код:
dcmd_id(playerid,params[]) {
if(!strlen(params)) return SendClientMessage(playerid,0x33FF33AA,"Correct Usage: /id [part of nick]");
new found, string[128], playername[MAX_PLAYER_NAME];
format(string,sizeof(string),"Searched for: \"%s\" ",params);
SendClientMessage(playerid,0x33FF33AA,string);
for(new i=0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, playername, MAX_PLAYER_NAME);
new namelen = strlen(playername);
new bool:searched=false;
for(new pos=0; pos <= namelen; pos++)
{
if(searched != true)
{
if(strfind(playername,params,true) == pos)
{
found++;
format(string,sizeof(string),"%d. %s (ID %d)",found,playername,i);
SendClientMessage(playerid, 0x33FF33AA ,string);
searched = true;
}
}
}
}
}
if(found == 0) SendClientMessage(playerid, 0x33FF33AA, "No players have this in their nick");
return 1;
}
Re: [HELP] /id Command -
blackwave - 22.12.2010
click me
Re: [HELP] /id Command -
HyperZ - 22.12.2010
Quote:
Originally Posted by blackwave
|
Are you ok?