Make Door Go Down Then Back Up ?
#1

Im trying to make it so when i do /door the door will go down and then a short time after it will go back up


Please Help


Код:
CMD:door(playerid, params[])
{
	if(IsPlayerInRangeOfPoint(playerid, 15, 253.10000610,109.00000000,1004.29998779))
	{
		MoveObject(lspddoor1, 253.10000610,109.00000000,998.29998779, 1);
		SetTimerEx("CloseDoor", 10000, false, "i", 0);
	}
	else if(IsPlayerInRangeOfPoint(playerid, 15, 217.80000305,116.59999847,1000.09997559))
	{
	    MoveObject(lspddoor2, 217.80000305,116.59999847,998.09997559, 1);
	    SetTimerEx("CloseDoor", 10000, false, "i", 1);
	}
	else if(IsPlayerInRangeOfPoint(playerid, 15, 239.69921875,117.69921875,1004.29998779))
	{
	    MoveObject(lspddoor3, 239.69921875,117.69921875,998.29998779, 1);
	    SetTimerEx("CloseDoor", 10000, false, "i", 1);
	}
	else
		return SendClientMessage(playerid, 0xFF0000FF, "You are not in range of any door");
	SendClientMessage(playerid, 0xFF8000FF, "The door is Opening");
        return 1;
}
Please Help Please
Reply
#2

If you want it to move back after so long, you need to use a timer.

https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/SetTimerEx
Reply
#3

pawn Код:
//top
new door;
forward CloseDoor();
//CMD
CMD:door(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 15, 253.10000610,109.00000000,1004.29998779))
    {
        MoveObject(lspddoor1, 253.10000610,109.00000000,998.29998779, 1);
        SetTimerEx("CloseDoor", 10000, false, "i", 0);
                door = 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid, 15, 217.80000305,116.59999847,1000.09997559))
    {
        MoveObject(lspddoor2, 217.80000305,116.59999847,998.09997559, 1);
        SetTimerEx("CloseDoor", 10000, false, "i", 1);
                door = 2;
    }
    else if(IsPlayerInRangeOfPoint(playerid, 15, 239.69921875,117.69921875,1004.29998779))
    {
        MoveObject(lspddoor3, 239.69921875,117.69921875,998.29998779, 1);
        SetTimerEx("CloseDoor", 10000, false, "i", 1);
                door = 3;
    }
    else
        return SendClientMessage(playerid, 0xFF0000FF, "You are not in range of any door");
    SendClientMessage(playerid, 0xFF8000FF, "The door is Opening");
        return 1;
}
//anywhere
public CloseDoor()
{
       switch(door)
       {
               case 1:
               {
                        MoveObject(lspddoor1, ORIGINAL COORDINATES,1);
               }
               case 2:
               {
                        MoveObject(lspddoor2, ORIGINAL COORDINATES,1);
               }
               case 3:
               {
                        MoveObject(lspddoor3, ORIGINAL COORDINATES,1);
               }
        }
         door = 0;
        return 1;
}
Give it a try.
Reply
#4

You should use SetTimerEx. What if two doors get opened at the same time by different players? CLASH.
Reply
#5

Quote:
Originally Posted by MP2
Посмотреть сообщение
You should use SetTimerEx. What if two doors get opened at the same time by different players? CLASH.
Give me an idea on how to do that please ?
Reply
#6

https://sampwiki.blast.hk/wiki/SetTimerEx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)