if (strcmp("/opengate", cmdtext, true, 10) == 0)
{
MoveObject(Mygate,X,Y,Z,S);
MoveObject(Mygate1,X,Y,Z,S); // how do I make this one open lets say 5 seconds after the first?
return 1;
}
return 0;
if (strcmp("/opengate", cmdtext, true, 10) == 0)
{
MoveObject(Mygate,X,Y,Z,S);
SetTimerEx("OGate",5000,0,"s",":P");
return 1;
}
return 0;
}
forward OGate();
public OGate()
{
MoveObject(Mygate1,X,Y,Z,S);
return 1;
}
i think he means the first object is open and second is close... so eehm jack place the mygate1 in the public Ogate only.. so not the mygate, the mygate has to be in the cmd /opengate
|
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;
}