Constant gate moving - 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: Constant gate moving (
/showthread.php?tid=633186)
Constant gate moving -
Mughees - 26.04.2017
Can you please help me how to make my code constant gate moving?
I know how to make with command,with playerinrange,but Iwant is that As Soon as Player Connects the gate start moving up and down forever.
help me
Код:
public OnFilterScriptInit()
SetTimer("CheckGate",1000,true);
mygate = CreateObject(19277,-50.402030,1829.453125,19.898818,0.0000000,0.0000000,0.0000000);
forward CheckGate();
public CheckGate()
{
new mygate_status;
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,10.0,-50.402030,1829.453125,19.898818))mygate_status=1;
}
if(mygate_status)MoveObject(mygate, -50.402030, 1829.45312, 28.398838, 2.5);
else MoveObject(mygate, -50.402030,1829.453125,19.898818, 2.5);
}
Help me in making this constant moving
Re: Constant gate moving -
raydx - 27.04.2017
Код:
new mygate_status;
OnFilterScriptInit:
mygate = CreateObject(19277,-50.402030,1829.453125,19.898818,0.0000000,0.0000000,0.0000000);
MoveObject(mygate, -50.402030,1829.453125,19.898818, 2.5);
mygate_status = 1;
public OnObjectMoved(objectid)
{
if(objectid == mygate)
{
if(mygate_status == 1)
{
MoveObject(mygate, -50.402030, 1829.45312, 28.398838, 2.5);
mygate_status = 0;
}
else
{
MoveObject(mygate, -50.402030,1829.453125,19.898818, 2.5);
mygate_status = 1;
}
}
return 1;
}
Re: Constant gate moving -
Mughees - 27.04.2017
This is entire code no object appearing
Код:
#include <a_samp>
#if defined FILTERSCRIPT
#endif
new gate1;
new gate1_status;
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" n--------------n");
print("--------------------------------------\n");
gate1_status = 1;
MoveObject(gate1, -50.402030,1829.453125,19.898818, 2.5);
gate1 = CreateObject(19277,-50.402030,1829.453125,19.898818,0.0000000,0.0000000,0.0000000);
}
public OnObjectMoved(objectid)
{
if(objectid == gate1)
{
if(gate1_status == 1)
{
MoveObject(gate1, -50.402030, 1829.45312, 28.398838, 2.5);
gate1_status = 0;
}
else
{
MoveObject(gate1, -50.402030,1829.453125,19.898818, 2.5);
gate1_status = 1;
}
}
return 1;
}