Script problem - 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)
+--- Thread: Script problem (
/showthread.php?tid=285587)
Script problem -
jordyvc - 24.09.2011
Hello,
I have this error:
Код HTML:
error 017: undefined symbol "playerid"
On line 22
This is the script:
PHP код:
#include <a_samp>
new gate;
new bool:gateopen;
public OnFilterScriptInit() // Alternatively, use OnGameModeInit if you implement it in your gamemode
{
SetTimer("GateCheck", 800, true); //This is used to create the timer. The "GateCheck" is the callback we'll be using,
// the '800' is the amount of milliseconds between each call and the 'true' indicates that this timer is looping endlessly
gate = CreateObject(969,1801.19995117,-1720.90002441,12.50000000,0.00000000,0.00000000,178.00000000);
//'gate = CreateObject(...);' = Assigns the object id of the gate to the 'gate' variable
//16442 = object model id < change it to the model id you use for your gate
// 8.0, 3.0, 10.0 = coordinates of the gate
// 0.0, 0.0, 0.0 = Rotation of the gate. None in this case.
return 1;
}
forward GateCheck();
public GateCheck()
{
for(new i; i < MAX_PLAYERS; i++) // Start the loop
{
if(IsPlayerInRangeOfPoint(playerid , 15.0, 8.0, 3.0, 10.0)) //Check if any player is in the area. Replace '8.0, 3.0, 10.0' with your own coordinates of your closed gate.
{
if(gateopen == false) // If the gate isn't open...
{
MoveObject(gate, 1801.19995117,-1720.90002441,12.50000000,0.00000000,0.00000000,178.00000000); //Then open it! Change '32.0, 12.0, 10.0' to the coordinates of your opened gate.
gateopen = true; // Setting this to true indicates it's open(ing)
}
return; //This closes the callback
}
}
//This is called if nobody has been found near the gate. Obviously, because 'return' would fully close the function and this wouldn't be used then.
if(gateopen == true) //If the gate IS open, but there's no one near..
{
MoveObject(gate, 1807.80004883,-1721.30004883,12.50000000,0.00000000,0.00000000,178.00000000); // Change the '8.0, 3.0, 10.0' to the coordinates of your gate when it's closed.
gateopen = false; //This indicates the gate is closed again. Or at least, closing.
}
}
Can anyone help me?
Re: Script problem -
Jafet_Macario - 24.09.2011
pawn Код:
#include <a_samp>
new gate;
new bool:gateopen;
public OnFilterScriptInit() // Alternatively, use OnGameModeInit if you implement it in your gamemode
{
SetTimer("GateCheck", 800, true); //This is used to create the timer. The "GateCheck" is the callback we'll be using,
// the '800' is the amount of milliseconds between each call and the 'true' indicates that this timer is looping endlessly
gate = CreateObject(969,1801.19995117,-1720.90002441,12.50000000,0.00000000,0.00000000,178.00000000);
//'gate = CreateObject(...);' = Assigns the object id of the gate to the 'gate' variable
//16442 = object model id < change it to the model id you use for your gate
// 8.0, 3.0, 10.0 = coordinates of the gate
// 0.0, 0.0, 0.0 = Rotation of the gate. None in this case.
return 1;
}
forward GateCheck();
public GateCheck()
{
for(new i; i < MAX_PLAYERS; i++) // Start the loop
{
if(IsPlayerInRangeOfPoint(i , 15.0, 8.0, 3.0, 10.0)) //Check if any player is in the area. Replace '8.0, 3.0, 10.0' with your own coordinates of your closed gate.
{
if(gateopen == false) // If the gate isn't open...
{
MoveObject(gate, 1801.19995117,-1720.90002441,12.50000000,0.00000000,0.00000000,178.00000000); //Then open it! Change '32.0, 12.0, 10.0' to the coordinates of your opened gate.
gateopen = true; // Setting this to true indicates it's open(ing)
}
return; //This closes the callback
}
}
//This is called if nobody has been found near the gate. Obviously, because 'return' would fully close the function and this wouldn't be used then.
if(gateopen == true) //If the gate IS open, but there's no one near..
{
MoveObject(gate, 1807.80004883,-1721.30004883,12.50000000,0.00000000,0.00000000,178.00000000); // Change the '8.0, 3.0, 10.0' to the coordinates of your gate when it's closed.
gateopen = false; //This indicates the gate is closed again. Or at least, closing.
}
}
Re: Script problem -
Jay. - 24.09.2011
above was faster.
Re: Script problem -
jordyvc - 24.09.2011
Thank you..
Re: Script problem -
jordyvc - 24.09.2011
Thx..