26.06.2014, 00:27
Hey folks!
I'm still trying to learn the basics so I could use some help...
In the following code there's somewhat of an "animation". The author has used a timer so it'll look more realstic. I'd like to remove that. In other words, I want it to be short and quick. Once I tap on the HORN button it'll open it without the realstic effect (same goes for the closing).
If someone could add an explanation that would be nice, thanks!
I'm still trying to learn the basics so I could use some help...
In the following code there's somewhat of an "animation". The author has used a timer so it'll look more realstic. I'd like to remove that. In other words, I want it to be short and quick. Once I tap on the HORN button it'll open it without the realstic effect (same goes for the closing).
If someone could add an explanation that would be nice, thanks!
PHP код:
//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;
}