Constant gate moving
#1

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
Reply
#2

Код:
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;
}
Reply
#3

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;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)