//this filterscript is made by EzeeCube, I don't care for credits if you need any help add me on skype peroplazar.
//you are free to give me some reputation in samp forum xD
#define FILTERSCRIPT
#include <a_samp>
#define MAX_GATES 2
new Gate[MAX_GATES],Gate1,Gate2;
forward pdcubegate0(playerid);
forward pdcubegate1(playerid);
forward pdcubegate2(playerid);
forward pdcubegate3(playerid);
forward pdcubegate4(playerid);
forward pdcubegate5(playerid);
forward pdcubegate6(playerid);
forward pdcubegate7(playerid);
forward pdcubegate8(playerid);
forward pdcubegate9(playerid);
forward pdcubegate10(playerid);
forward pdcubegate11(playerid);
forward pdcubegate12(playerid);
forward pdcubegate13(playerid);
forward pdcubegate14(playerid);
forward pdcubegate15(playerid);
forward pdcubegate16(playerid);
forward pdcubegate20(playerid);
public OnFilterScriptInit()
{
Gate[0] = CreateObject(971,1588.5000000,-1638.3000000,14.1000000,0.0000000,0.0000000,0.0000000);
Gate[1] = CreateObject(968,1544.7000000,-1630.8000000,13.1000000,0.0000000,90,89.4800415);
return 1;
}
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
if(newkeys & 2 && IsPlayerInAnyVehicle(playerid))
{
if(IsPlayerInRangeOfPoint(playerid,10,1588.5000000,-1638.3000000,14.1000000))
{
switch(Gate1)
{
case true:
{
MoveObject(Gate[0],1598.5000000,-1638.3000000,14.1000000,5);
Gate1 = false;
}
case false:
{
MoveObject(Gate[0],1588.5000000,-1638.3000000,14.1000000,5);
Gate1 = true;
}
}
}
if(IsPlayerInRangeOfPoint(playerid,10,1544.7000000,-1630.8000000,13.1000000))
{
switch(Gate2)
{
case true:
{
SetObjectRot( Gate[1], 0,80,89.4800415);
SetTimer("pdcubegate1", 100, false);
SetTimer("ResetPD1",10000,0);
}
case false:
{
SetObjectRot( Gate[1], 0,10,89.4800415);
SetTimer("pdcubegate8", 100, false);
}
}
}
}
}
public pdcubegate0()
{
SetObjectRot( Gate[1], 0,70,89.4800415);
SetTimer("pdcubegate1", 100, false);
return 1;
}
public pdcubegate1()
{
SetObjectRot( Gate[1], 0,60,89.4800415);
SetTimer("pdcubegate2", 100, false);
return 1;
}
public pdcubegate2()
{
SetObjectRot( Gate[1], 0,50,89.4800415);
SetTimer("pdcubegate3", 100, false);
return 1;
}
public pdcubegate3()
{
SetObjectRot( Gate[1], 0,40,89.4800415);
SetTimer("pdcubegate4", 100, false);
return 1;
}
public pdcubegate4()
{
SetObjectRot( Gate[1], 0,30,89.4800415);
SetTimer("pdcubegate5", 100, false);
return 1;
}
public pdcubegate5()
{
SetObjectRot( Gate[1], 0,20,89.4800415);
SetTimer("pdcubegate6", 100, false);
return 1;
}
public pdcubegate6()
{
SetObjectRot( Gate[1], 0,10,89.4800415);
SetTimer("pdcubegate7", 100, false);
return 1;
}
public pdcubegate7()
{
SetObjectRot( Gate[1], 0,0,89.4800415);
Gate2 = false;
return 1;
}
public pdcubegate8()
{
SetObjectRot( Gate[1], 0,20,89.4800415);
SetTimer("pdcubegate9", 100, false);
return 1;
}
public pdcubegate9()
{
SetObjectRot( Gate[1], 0,30,89.4800415);
SetTimer("pdcubegate10", 100, false);
return 1;
}
public pdcubegate10()
{
SetObjectRot( Gate[1], 0,40,89.4800415);
SetTimer("pdcubegate11", 100, false);
return 1;
}
public pdcubegate11()
{
SetObjectRot( Gate[1], 0,50,89.4800415);
SetTimer("pdcubegate12", 100, false);
return 1;
}
public pdcubegate12()
{
SetObjectRot( Gate[1], 0,60,89.4800415);
SetTimer("pdcubegate13", 100, false);
return 1;
}
public pdcubegate13()
{
SetObjectRot( Gate[1], 0,70,89.4800415);
SetTimer("pdcubegate14", 100, false);
return 1;
}
public pdcubegate14()
{
SetObjectRot( Gate[1], 0,80,89.4800415);
SetTimer("pdcubegate15", 100, false);
return 1;
}
public pdcubegate15()
{
SetObjectRot( Gate[1], 0,90,89.4800415);
Gate2 = true;
return 1;
}
|
Use SetObjectPos instead of MoveObject.
The first one just set an object pos, and the second one move an object to a pos. |
#include <a_samp>
#define MAX_GATES 2
new Gate[MAX_GATES][3];
public OnFilterScriptInit()
{
Gate[0][0] = CreateObject(971, 1588.5000000, -1638.3000000, 14.1000000, 0.0000000, 0.0000000, 0.0000000);
Gate[1][0] = CreateObject(968, 1544.7000000, -1630.8000000, 13.1000000, 0.0000000, 90, 89.4800415);
Gate[0][1] = Gate[1][1] = 1;
return 1;
}
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
if(newkeys & KEY_SUBMISSION)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1588.5000000, -1638.3000000, 14.1000000))
{
if(Gate[0][1]) KillTimer(Gate[0][2]);
MoveObject(Gate[0][0], (Gate[0][0]) ? (1598.5000000) : (1588.5000000), -1638.3000000, 14.1000000, 5, 0.0000000, 0.0000000, 0.0000000);
Gate[0][1] = (Gate[0][1]) ? (0) : (1);
Gate[0][2] = SetTimer("ResetGate1", 10000, false);
}
else if(IsPlayerInRangeOfPoint(playerid, 10.0, 1544.7000000, -1630.8000000, 13.1000000))
{
if(Gate[1][1]) KillTimer(Gate[1][2]);
MoveObject(Gate[1][0], 1544.7000000, -1630.8000000, 13.1000001, 1, 0.0000000, (Gate[1][1]) ? (90.0000000) : (0.0000000), 89.4800415);
Gate[1][1] = (Gate[1][1]) ? (0) : (1);
Gate[1][2] = SetTimer("ResetGate2", 10000, false);
}
}
}
return 1;
}
forward ResetGate1();
forward ResetGate2();
public ResetGate1()
{
MoveObject(Gate[0][0], 1588.5000000, -1638.3000000, 14.1000000, 5, 0.0000000, 0.0000000, 0.0000000);
Gate[0][1] = 0;
return 1;
}
public ResetGate2()
{
MoveObject(Gate[1][0], 1544.7000000, -1630.8000000, 13.1000000, 1, 0.0000000, 90, 89.4800415);
Gate[1][1] = 0;
return 1;
}