Put this right on top of the script , with the other new's
put this code within OnGameModeInit
pawn Код:
Gate = CreateObject (modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ);
GateInfo = 0;
put this command in OnPlayerCommandText
pawn Код:
if(strcmp(cmdtext, "/togglegate", true) == 0)
{
if(GateInfo == 0)// if the gate is closed
{
MoveObject(Gate, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ); // then move the gate here.
GateInfo = 1; // gate is open
new string[128];
new playername[360];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),"%s Opened The Gate.",playername);
SendClientMessageToAll(COLOR_WHITE,string);
}
if(GateInfo == 1)// else, if the gate is open
{
MoveObject(Gate, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ); // then move the gate here.
GateInfo = 0; // gate is closed
new string[128];
new playername[360];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),"%s Closed The Gate.",playername);
SendClientMessageToAll(COLOR_WHITE,string);
}
}
I left some comments, so you understand what your doing.