Undefined symbol "playerid" - 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" (
/showthread.php?tid=269146)
Undefined symbol "playerid" -
McCarthy - 15.07.2011
I'm making somewhat kind of pay n spray, and I think I finally got it to work but I keep ketting this error D:
Код:
E:\SAMP\gamemodes\ws.pwn(9158) : error 017: undefined symbol "playerid"
pawn Код:
public CheckSpray()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerToPoint(4,i,1547.9425,-1606.6628,13.3899))
{
if(GetVehicleModel(GetPlayerVehicleID(i)) == 523 || GetVehicleModel(GetPlayerVehicleID(i)) == 596 || GetVehicleModel(GetPlayerVehicleID(i)) == 597 || GetVehicleModel(GetPlayerVehicleID(i)) == 598 || GetVehicleModel(GetPlayerVehicleID(i)) == 599 || GetVehicleModel(GetPlayerVehicleID(i)) == 601 || GetVehicleModel(GetPlayerVehicleID(i)) == 427)
{
new Float:health;
GetVehicleHealth(GetPlayerVehicleID(i), health);
if(health < 1000)
{
SetPlayerCameraPos(i, 1565.7086,-1616.7732,19.3899);
SetPlayerCameraLookAt(i, 1549.7086,-1606.7732,13.3899);
MoveObject(SPRAYGATE,1555.775146,-1606.986572,15.160561,8);
RepairVehicle(GetPlayerVehicleID(playerid)); //line 9158
SetVehicleZAngle(GetPlayerVehicleID(i),268.8695);
SetVehiclePos(GetPlayerVehicleID(i),1547.9425,-1606.6628,13.3899);
TogglePlayerControllable(i, 0);
PlayerPlaySound(i,1134,0.0,0.0,0.0);
SetTimer("SPRAYTimer", 4000, 0);
}
}
else SendClientMessage(i,COLOR_RED, "You're not in a Police Vehicle");
}
}
return 1;
}
Re: Undefined symbol "playerid" -
[MG]Dimi - 15.07.2011
PHP код:
public CheckSpray(playerid)
if you are using param playerid you must add it.
Re: Undefined symbol "playerid" -
Flyfishes - 15.07.2011
Your RepairVehicle is the wrong one. Change the 'playerid' variable to i
Re: Undefined symbol "playerid" -
McCarthy - 15.07.2011
Oh thank you, appreciated
Re: Undefined symbol "playerid" -
Flyfishes - 15.07.2011
No problems, feel free to reputate me
Re: Undefined symbol "playerid" -
Jochemd - 15.07.2011
This is off-topic, but just got to say; when using loops, always use IsPlayerConnected!
pawn Код:
public CheckSpray()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerToPoint(4,i,1547.9425,-1606.6628,13.3899))
{
if(GetVehicleModel(GetPlayerVehicleID(i)) == 523 || GetVehicleModel(GetPlayerVehicleID(i)) == 596 || GetVehicleModel(GetPlayerVehicleID(i)) == 597 || GetVehicleModel(GetPlayerVehicleID(i)) == 598 || GetVehicleModel(GetPlayerVehicleID(i)) == 599 || GetVehicleModel(GetPlayerVehicleID(i)) == 601 || GetVehicleModel(GetPlayerVehicleID(i)) == 427)
{
new Float:health;
GetVehicleHealth(GetPlayerVehicleID(i), health);
if(health < 1000)
{
SetPlayerCameraPos(i, 1565.7086,-1616.7732,19.3899);
SetPlayerCameraLookAt(i, 1549.7086,-1606.7732,13.3899);
MoveObject(SPRAYGATE,1555.775146,-1606.986572,15.160561,8);
RepairVehicle(GetPlayerVehicleID(playerid)); //line 9158
SetVehicleZAngle(GetPlayerVehicleID(i),268.8695);
SetVehiclePos(GetPlayerVehicleID(i),1547.9425,-1606.6628,13.3899);
TogglePlayerControllable(i, 0);
PlayerPlaySound(i,1134,0.0,0.0,0.0);
SetTimer("SPRAYTimer", 4000, 0);
}
}
else SendClientMessage(i,COLOR_RED, "You're not in a Police Vehicle");
}
}
}
return 1;
}
This will save lots of time for the script. Do checks with GetTickCount and see.