TollGate SetTimerEx
#1

I want to use SetTimerEx function after open the gate and after 6 seconds the gate will be closed automtically, i tried to create my own public but no success... please help me make a forward + public (public will be called TollGate)

Код:
CMD:gate2(playerid, params[])
{
	new string[128];
	if(IsPlayerInRangeOfPoint(playerid, 3.0, 59.9662,-1525.9076,4.6624) && IsACop(playerid))
	{
	if(TollGateStatus == 0 )
 	{
	TollGateStatus = 1;
        SetTimerEx("TollGate");
	MoveDynamicObject(TollGate, 55.5, -1528.90002, 4.7+0.0001, 0.0001, 0, 0, 82.09);
	format( string, sizeof( string ), "* %s uses their remote to open the gates.", GetPlayerNameEx( playerid ) );
    ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
 	}
	else
	{
	TollGateStatus = 0;
	MoveDynamicObject(TollGate, 55.5, -1528.90002, 4.7+0.0001, 0.0001, 0, 90, 82.09);
	format( string, sizeof( string ), "* %s uses their remote to close the gates.", GetPlayerNameEx( playerid ) );
	ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
 	}
	}
Reply
#2

pawn Код:
CMD:gate2(playerid, params[])
{
    new string[128];
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 59.9662,-1525.9076,4.6624) && IsACop(playerid))
    {
        if(TollGateStatus == 0 )
        {
            TollGateStatus = 1;
            SetTimerEx("CloseGate", 6000, false); // Closing in 6 seconds.
            MoveDynamicObject(TollGate, 55.5, -1528.90002, 4.7+0.0001, 0.0001, 0, 0, 82.09);
            format( string, sizeof( string ), "* %s uses their remote to open the gates.", GetPlayerNameEx( playerid ) );
            ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else
        {
            TollGateStatus = 0;
            MoveDynamicObject(TollGate, 55.5, -1528.90002, 4.7+0.0001, 0.0001, 0, 90, 82.09);
            format( string, sizeof( string ), "* %s uses their remote to close the gates.", GetPlayerNameEx( playerid ) );
            ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
    }
}

forward CloseGate();
public CloseGate()
{
    if(TollGateStatus == 1)
    {
        MoveDynamicObject(TollGate, 55.5, -1528.90002, 4.7+0.0001, 0.0001, 0, 90, 82.09);
    }
    return 1;
}
Reply
#3

I have about more 10 gates to make timer on... on public Closegate how can i use it for all the 12?

Код:
else if(IsPlayerInRangeOfPoint(playerid, 3.0, 41.3965,-1537.0374,4.9134) && IsACop(playerid))
	{
	if(TollGateStatus1 == 0 )
 	{
	TollGateStatus1 = 1;
	MoveDynamicObject(TollGate1, 45.4, -1534, 4.9+0.0001, 0.0001, 0.0, 0, 262.997);
	format( string, sizeof( string ), "* %s uses their remote to open the gates.", GetPlayerNameEx( playerid ) );
    ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
 	}
	else
	{
	TollGateStatus1 = 0;
 	MoveDynamicObject(TollGate1, 45.4, -1534, 4.9-0.0001, 0.0001, 0.0, 90, 262.997);
	format( string, sizeof( string ), "* %s uses their remote to close the gates.", GetPlayerNameEx( playerid ) );
	ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	}
	}
i need for all the 12 gates to do this timer but only if the player is in specific rangeofpoint, how do i continue from here? BTW i using SetTimer and not SetTimerEx

Код:
forward CloseGate();
public CloseGate()
{
    if(TollGateStatus == 1)
    {
        MoveDynamicObject(TollGate, 55.5, -1528.90002, 4.7+0.0001, 0.0001, 0, 90, 82.09);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)