01.03.2012, 22:34
Why not setup a bool?
pawn Код:
new bool:IsGateOpen = false; // A new bool to check if the gate is open.
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/gate", cmdtext, true, 10) == 0)
{
if(IsGateOpen == false) // If the gate is closed then continue.
{
MoveObject(objectid,Float:x,Float:y,Float:z,Float:Speed); // Moves Object.
IsGateOpen = true; // Sets the bool to true, so that the gate is open.
SetTimer(GateTimer,3000,false); // Sets the timer of 3 seconds.
}
else if(IsGateOpen == true) return 1; // If the gate is open, then it won't process the command.
}
return 0;
}
forward GateTimer(); // When the 3 seconds is up, it will run this code.
{
MoveObject(objectid,Float:x,Float:y,Float:z,Float:Speed); // Moves Object back to its original position
IsGateOpen = false; // Sets the bool to false, and that the gate is now closed.
return 1;
}