Problem with GetPlayerID
#1

I need to get specific player's ID from their name. Now I don't know what seems to be the problem, but I still get an error.

So here's the function:
pawn Код:
stock GetPlayerId(Name[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
        new pName2[MAX_PLAYER_NAME];
        GetPlayerName(i, pName2, sizeof(pName2));
            if(!strcmp(Name, pName2))
            {
                return i;
            }
        }
    }
    return -1;
}
Here is where I'm trying to use it:
pawn Код:
new manager;
manager = GetPlayerId(Allen_Blaxland[]);
GivePlayerCash(manager, 25);
GivePlayerCash(playerid, -25);
SendClientMessage(playerid, COLOR_WHITE, "{CC3333}NOTICE: {ffffff}You have paid $25 for using the bank.");
Here is the error:
pawn Код:
error 017: undefined symbol "Allen_Blaxland"
I'm basically trying to make it so, that when someone uses the bank, the owner gets 25 dollars from the user's 'pocket'.
Reply


Messages In This Thread
Problem with GetPlayerID - by Gytis0 - 11.06.2012, 20:22
Re: Problem with GetPlayerID - by BaubaS - 11.06.2012, 20:23
Re: Problem with GetPlayerID - by Gytis0 - 11.06.2012, 20:32
Re: Problem with GetPlayerID - by AndreT - 11.06.2012, 20:36

Forum Jump:


Users browsing this thread: 2 Guest(s)