31.03.2013, 09:24
First of all, thank you for reading this.
Alright, so I have the following code:
I know it looks horrible, but it's just because I started playing with it since it wasn't working.
At the beginning it showed the ID and name of the chosen player only if I'd input the second letter in his name ( and more ofc ) But when I used the first one. ( e.g Mark - M ) it didn't show the name and ID.
Now after I played with it a bit, every logged in player doesn't matter what I input.
Any idea what I am doing wrong?
( Please don't tell me go to there and copy or whatever )
Thank you in advance.
Alright, so I have the following code:
pawn Код:
CMD:getid(playerid, params[])
{
new bool:found = false;
if(sscanf(params, "S[MAX_PLAYER_NAME]", aname)) return SendClientMessage(playerid, COLOR_USAGE, "USAGE: /id [PartOfPlayerName]");
SendClientMessage(playerid, COLOR_LIGHTGREEN, "Possible options:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, pname, sizeof(pname));
for(new j = 0; j <= MAX_PLAYER_NAME; j++)
{
if(strfind(pname, aname, true, j))
{
kreplace(pname, '_', ' ');
found = true;
}
}
if(found == true)
{
format(str, sizeof(str), "%s - [ID: %d]", pname, i);
SendClientMessage(playerid, COLOR_USAGE, str);
}
}
}
return 1;
}
At the beginning it showed the ID and name of the chosen player only if I'd input the second letter in his name ( and more ofc ) But when I used the first one. ( e.g Mark - M ) it didn't show the name and ID.
Now after I played with it a bit, every logged in player doesn't matter what I input.
Any idea what I am doing wrong?
( Please don't tell me go to there and copy or whatever )
Thank you in advance.