Originally Posted by Fedee!
Now do this:
On top of script:
Quote:
new Gate1;
new Gate2;
forward CloseGate1();
forward CloseGate2();
|
OnGameModeInit:
Quote:
public OnGameModeInit()
{
Gate1 = CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ); //Change this
Gate2 = CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ); //Change this
return 1;
}
|
OnPlayerCommandText:
Quote:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/opengate1", true) == 0)
{
new string[50];
MoveObject(Gate1,objectid, Float:X, Float:Y, Float:Z, Float:Speed); // Change this.
SetTimer("CloseGate1", 5000, false); // 5000 = 5 secs
format(string, sizeof(string), "Gate open, will close in 5 seconds.", 500);
SendClientMessage(playerid, 0xFF000000, string);
return 1;
}
if(strcmp(cmdtext, "/opengate2", true) == 0)
{
new string[50];
MoveObject(Gate2,objectid, Float:X, Float:Y, Float:Z, Float:Speed); // Change this.
SetTimer("CloseGate2", 5000, false); // 5000 = 5 secs
format(string, sizeof(string), "Gate open, will close in 5 seconds.", 500);
SendClientMessage(playerid, 0xFF000000, string);
return 1;
}
return 0;
}
|
Somewhere in your script:
Quote:
public CloseGate1()
{
MoveObject(Gate1,Float:X, Float:Y, Float:Z, Float:Speed); // Change this.
return 1;
}
public CloseGate2()
{
MoveObject(Gate2,Float:X, Float:Y, Float:Z, Float:Speed); // Change this.
return 1;
}
|
|