Gate System
#1

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!


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 && 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:
                                        {
                                                
SetObjectRotGate[1], 0,80,89.4800415);
                                                
SetTimer("pdcubegate1"100false);
                                        
SetTimer("ResetPD1",10000,0);
                                        }
                                        case 
false:
                                        {
                                                
SetObjectRotGate[1], 0,10,89.4800415);
                                                
SetTimer("pdcubegate8"100false);
                                        }
                                }
                        }
                }
}
public 
pdcubegate0()
{
        
SetObjectRotGate[1], 0,70,89.4800415);
        
SetTimer("pdcubegate1"100false);
        return 
1;
}
public 
pdcubegate1()
{
        
SetObjectRotGate[1], 0,60,89.4800415);
        
SetTimer("pdcubegate2"100false);
        return 
1;
}
public 
pdcubegate2()
{
        
SetObjectRotGate[1], 0,50,89.4800415);
        
SetTimer("pdcubegate3"100false);
        return 
1;
}
public 
pdcubegate3()
{
        
SetObjectRotGate[1], 0,40,89.4800415);
        
SetTimer("pdcubegate4"100false);
        return 
1;
}
public 
pdcubegate4()
{
        
SetObjectRotGate[1], 0,30,89.4800415);
        
SetTimer("pdcubegate5"100false);
        return 
1;
}
public 
pdcubegate5()
{
        
SetObjectRotGate[1], 0,20,89.4800415);
        
SetTimer("pdcubegate6"100false);
        return 
1;
}
public 
pdcubegate6()
{
        
SetObjectRotGate[1], 0,10,89.4800415);
        
SetTimer("pdcubegate7"100false);
        return 
1;
}
public 
pdcubegate7()
{
        
SetObjectRotGate[1], 0,0,89.4800415);
        
Gate2 false;
        return 
1;
}
public 
pdcubegate8()
{
        
SetObjectRotGate[1], 0,20,89.4800415);
        
SetTimer("pdcubegate9"100false);
        return 
1;
}
public 
pdcubegate9()
{
        
SetObjectRotGate[1], 0,30,89.4800415);
        
SetTimer("pdcubegate10"100false);
        return 
1;
}
public 
pdcubegate10()
{
        
SetObjectRotGate[1], 0,40,89.4800415);
        
SetTimer("pdcubegate11"100false);
        return 
1;
}
public 
pdcubegate11()
{
        
SetObjectRotGate[1], 0,50,89.4800415);
        
SetTimer("pdcubegate12"100false);
        return 
1;
}
public 
pdcubegate12()
{
        
SetObjectRotGate[1], 0,60,89.4800415);
        
SetTimer("pdcubegate13"100false);
        return 
1;
}
public 
pdcubegate13()
{
        
SetObjectRotGate[1], 0,70,89.4800415);
        
SetTimer("pdcubegate14"100false);
        return 
1;
}
public 
pdcubegate14()
{
        
SetObjectRotGate[1], 0,80,89.4800415);
        
SetTimer("pdcubegate15"100false);
        return 
1;
}
public 
pdcubegate15()
{
        
SetObjectRotGate[1], 0,90,89.4800415);
    
Gate2 true;
        return 
1;

Reply


Messages In This Thread
Gate System - by Amit1998 - 26.06.2014, 00:27
Re: Gate System - by arakuta - 26.06.2014, 01:15
Re: Gate System - by Amit1998 - 26.06.2014, 02:07
Re: Gate System - by Amit1998 - 26.06.2014, 11:03
Re: Gate System - by Threshold - 26.06.2014, 12:20

Forum Jump:


Users browsing this thread: 2 Guest(s)