error 017: undefined symbol "GetPlayerId" !!!??? What the ...
#1

Hello readers,

Most of the time GetPlayerId would work..but then suddenly when i dont expect it this will happen;

Код:
C:\Users\Benutzer\Desktop\D-Fs.pwn(133) : warning 217: loose indentation
C:\Users\Benutzer\Desktop\D-Fs.pwn(138) : warning 217: loose indentation
C:\Users\Benutzer\Desktop\D-Fs.pwn(145) : error 017: undefined symbol "GetPlayerId"
C:\Users\Benutzer\Desktop\D-Fs.pwn(152) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
i got this;

Код:
if(strcmp(cmd, "/Taxi", true) == 0)
{
		new tmp[128];
		tmp = strtok(cmdtext, idx);
		new currentplayer1;
		new sendername[MAX_PLAYER_NAME];
		GetPlayerName(playerid,sendername, sizeof(sendername));
		currentplayer1 = GetPlayerId(sendername);

		if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /Taxi [playerid]");
		SetPlayerMarkerForPlayer(currentplayer1,strval(tmp),0xFF0000FF );

		TogglePlayerControllable(strval(tmp),0);
 }
You know why this happen ? please post here thanks



Reply
#2

GetPlayerId ,
GetPlayerid,
GetPlayerID,
getplayerid,
getplayerID,
getPlayerID,
or getPlayerid?
Reply
#3

Quote:

GetPlayerId ,
GetPlayerid,
GetPlayerID,
getplayerid,
getplayerID,
getPlayerID,
or getPlayerid?

doesnt work i tried all
Reply
#4

There's no such thing as GetPlayerID... It's some custom function and you must define it/include it/use it properly
Reply
#5

Add this to your GM/FS

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;
}
Reply
#6

Quote:
Originally Posted by DiDok
There's no such thing as GetPlayerID...
Yeah that is what I was thinking. Unless you use a for i loop like the script above
Reply
#7

Sorry for DP but isn't sendername the same as playerid in this case

pawn Код:
GetPlayerName(playerid,sendername, sizeof(sendername));
currentplayer1 = GetPlayerId(sendername)
You get the name of Playerid then get the ID of the name...
Reply
#8

Yes because he needs the ID to complete the command, theres no other way in my opinion!
Reply
#9

Quote:
Originally Posted by DeathOnaStick
Yes because he needs the ID to complete the command, theres no other way in my opinion!
he already has the ID, playerid
he renames playerid to sendername
Reply
#10

:S... makes sence... XD
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)