ReturnUser.
#9

Try something like this:

pawn Код:
new UnknownID[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    UnknownID[playerid] = 14698;
    //or random numbers:
    UnknownID[playerid] = random(50000);
}

public OnPlayerText(playerid, text[])
{
    new str[144];
    format(str, sizeof (str), "Inconnu_%d: %s", UnknownID[playerid], text);
    SendPlayerMessageToAll(playerid, str);
    return 0;
}

ReturnUser(id)
{
    new pid=-1, name[24];
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(UnknownID[i] == id)
        {
            pid = i;
            break;
        }
    }
    if(pid=-1) return 0;
    GetPlayerName(pid, name, sizeof name);
    return name;
}
ReturnUser( 14698 ) should return the player name of the user with the "unknown number" 14698. Also, if there's no player online with the ID 14698, it will return 0, so check for that:

pawn Код:
if(!ReturnUser(14698)) return SendClientMessage(playerid, -1, "There's no player online with that number.");
Reply


Messages In This Thread
ReturnUser. - by TheSy - 23.05.2014, 21:14
Re: ReturnUser. - by Jefff - 24.05.2014, 00:12
Re: ReturnUser. - by DerickClark - 24.05.2014, 00:35
Re: ReturnUser. - by TheSy - 24.05.2014, 11:49
Re: ReturnUser. - by SKAzini - 24.05.2014, 13:14
Re: ReturnUser. - by TheSy - 24.05.2014, 13:34
Re: ReturnUser. - by RajatPawar - 24.05.2014, 13:36
Re: ReturnUser. - by TheSy - 24.05.2014, 13:39
Re: ReturnUser. - by SKAzini - 24.05.2014, 13:44
Re: ReturnUser. - by TheSy - 24.05.2014, 14:03

Forum Jump:


Users browsing this thread: 1 Guest(s)