SA-MP Forums Archive
Undefined symbol, playerid? wtf! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Undefined symbol, playerid? wtf! (/showthread.php?tid=189387)



Undefined symbol, playerid? wtf! - knackworst - 11.11.2010

Код:
public cannonshot()
{
      if(IsPlayerInAnyVehicle(playerid))
      SetVehicleVelocity(GetPlayerVehicleID(playerid),-4.5,0,0.0);
}
Look, these are the lines where is the error:


C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(470) : warning 225: unreachable code
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(89 : error 017: undefined symbol "playerid"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(899) : error 017: undefined symbol "playerid"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(10787) : warning 203: symbol is never used: "Dominating"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.


Re: Undefined symbol, playerid? wtf! - JaTochNietDan - 11.11.2010

It means what it says, the variable playerid isn't initialized or defined in that callback...if you want the callback specifically for a playerid, you need to specify it in there. For example:

pawn Код:
public cannonshot(playerid)
{
      if(IsPlayerInAnyVehicle(playerid))
      SetVehicleVelocity(GetPlayerVehicleID(playerid),-4.5,0,0.0);
}



Re: Undefined symbol, playerid? wtf! - Andrus - 11.11.2010

make the forward like:
pawn Код:
forward cannonshot(playerid);
and public:
pawn Код:
public cannonshot(playerid)
, else you won't be able to use playerid symbol.


Re: Undefined symbol, playerid? wtf! - knackworst - 11.11.2010

Thanks, men, now I have my little cannon xD
I also used the togglecontrolable function