15.08.2013, 20:24
pawn Код:
dcmd_id(playerid, params[])
{
if(!strlen(params)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /id [Part of name]");
new players, string[128], name[MAX_PLAYER_NAME];
format(string,sizeof(string),"Searched for: %s",params);
SendClientMessage(playerid,0xFFFFFFFF,string);
for(new i=0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, name, MAX_PLAYER_NAME);
new len = strlen(name);
new bool:searched=false;
for(new pos=0; pos <= len; pos++)
{
if(searched != true)
{
if(strfind(name,params,true) == pos)
{
players++;
format(string,sizeof(string),"%d. %s (ID: %d)",players,name,i);
SendClientMessage(playerid, 0x00FF00FF ,string);
searched = true;
}
}
}
}
}
if(players == 0)
SendClientMessage(playerid, 0xFF0000FF, "No Players Localized!");
return 1;
}