Moveable Gates HELP - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Moveable Gates HELP (
/showthread.php?tid=370212)
Moveable Gates HELP -
necrobg3 - 19.08.2012
Hey guys.
I know how to make moving gates. The deal is i want to make it in one command like /gate and first time it open the second time get closed. I know only with different commands like /gateopen | /gateclose.
Can anyone drop a look at this?
I want to make it in one command.
Код:
new Area51Gate; // on top
Area51Gate = CreateObject(988, 96.800003051758, 1920.4000244141, 17.299999237061, 0, 0, 268.5); //ongamemodeinit
if (strcmp("/agateopen", cmdtext, true, 10) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not authorised to use that command.");
MoveObject(Area51Gate, 96.800003051758, 1920.4000244141, 13, 3);
return 1;
}
if (strcmp("/agateclose", cmdtext, true, 10) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not authorised to use that command.");
MoveObject(Area51Gate, 96.800003051758, 1920.4000244141, 17.299999237061, 3);
return 1;
}
+REP for the dude who help me to deal with that.
Re: Moveable Gates HELP -
avivelkayam - 19.08.2012
hello!
you can do it like this:
Код:
new bool:OpenGate;
new Area51Gate; // on top
Area51Gate = CreateObject(988, 96.800003051758, 1920.4000244141, 17.299999237061, 0, 0, 268.5); //ongamemodeinit
OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/MoveGate",true))
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not authorised to use that command.");
if(!OpenGate)
{
OpenGate = true;
MoveObject(Area51Gate, 96.800003051758, 1920.4000244141, 13, 3);
}
else
{
OpenGate = false;
MoveObject(Area51Gate, 96.800003051758, 1920.4000244141, 17.299999237061, 3);
}
return 1;
}
}
Re: Moveable Gates HELP -
necrobg3 - 19.08.2012
Thanks, that was simple and fast.