Problem with GetPlayerID
#1

hey guys .
So,I need the GetPlayerID function . so I added it in the end of the GM.(stock)
like this
Код:
stock GetPlayerID(const Name[])
{
	for(new i = 0; new max = GetMaxPlayers(); i < max; i++)
	{
	    if(IsPlayerConnected(i))
		{
  		new pName2[MAX_PLAYER_NAME];
		GetPlayerName(i, pName2, sizeof(pName2));
			if(strcmp(Name, pName2, true) ==0)
			{
			    return i;
			}
		}
	}
	return -1;
}
yep, not i got the errors.
PHP код:
(3185) : error 029invalid expressionassumed zero
(3185) : warning 204symbol is assigned a value that is never used"i"
(3185) : error 017undefined symbol "i"
(3185) : error 076syntax error in the expression, or invalid function call
(3185) : fatal error 107too many error messages on one line 
line 3185
for(new i = 0; new max = GetMaxPlayers(); i < max; i++)
Reply
#2

Use sscanf
Reply
#3

I dont want to include sscanf in my script . I know its easy but I just dont want to use it .
Reply
#4

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;
}
Try this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)