well you could do somethin like this
pawn Код:
if(strcmp(cmd,"/showbadge",true) == 0)
{
new id;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /showbadge [playerid]");
new name[MAX_PLAYER_NAME];
id = ReturnUser(tmp);
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s Is showing his badge to you.", name);
SendClientMessage(id,COLOR_WHITE, string);
}
Is only an example you can start building from this
if you want the code to work u need to have this two just put it somewhere at the bottom in your script
pawn Код:
ReturnUser(text[], playerid = INVALID_PLAYER_ID)
{
new pos = 0;
while (text[pos] < 0x21)
{
if (text[pos] == 0) return INVALID_PLAYER_ID;
pos++;
}
new userid = INVALID_PLAYER_ID;
if (IsNumeric(text[pos]))
{
userid = strval(text[pos]);
if (userid >=0 && userid < MAX_PLAYERS)
{
if(!IsPlayerConnected(userid))
{
userid = INVALID_PLAYER_ID;
}
else
{
return userid;
}
}
}
new len = strlen(text[pos]);
new count = 0;
new name[MAX_PLAYER_NAME];
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(i, name, sizeof (name));
if (strcmp(name, text[pos], true, len) == 0)
{
if (len == strlen(name))
{
return i;
}
else
{
count++;
userid = i;
}
}
}
}
if (count != 1)
{
if (playerid != INVALID_PLAYER_ID)
{
if (count)
{
SendClientMessage(playerid, COLOR_RED, "Multiple users found, narrow earch!!!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "No matching user found!!!");
}
}
userid = INVALID_PLAYER_ID;
}
return userid;
}