Can someone help me with this?
#1

Hello.. I have a problem with one function in my GM so can you please help me?
Function:
pawn Код:
stock GetPlayerID(const Name[])
{
    for(new i; i<MAX_PLAYERS; i++)
    {
      if(IsPlayerConnected(i))
      {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(i, pName, sizeof(pName));
        if(strcmp(Name, pName, true)==0)
        {
          return i;
            }
        }
    }
    return -1;
}
And my error:
Код:
error 035: argument type mismatch (argument 1)
On the line:
pawn Код:
if(strcmp(Name, pName, true)==0)
And sorry about the indentation :P
Reply
#2

Try changing: (const Name[])

To: (Name[])
Reply
#3

Quote:
Originally Posted by Weirdosport
Try changing: (const Name[])

To: (Name[])
It didnt work
Reply
#4

Compiles fine for me, show me the line you use to "initiate" it.. like:

pawn Код:
//stuff
playerid = GetPlayerID("bob");
That bit..
Reply
#5

Quote:
Originally Posted by Weirdosport
Compiles fine for me, show me the line you use to "initiate" it.. like:

pawn Код:
//stuff
playerid = GetPlayerID("bob");
That bit..
NVM I found the problem :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)