Where to put the Gate script in pawno? [Have cords]
#7

If you want to change the 2 cmds into 1 you can try this:

pawn Код:
#include <a_samp>

new Firasgate;
new openClosed;

public OnFilterScriptInit()
{
    Firasgate = CreateObject(980, 320.59393310547, -1188.8247070313, 78.117607116699, 0, 0, 37.714782714844);
    openClosed = 0; //Starts off 0 (closed)
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/gatefiras", cmdtext, true) == 0)
    {
      if(openClosed == 0)
     {
        if(IsPlayerInRangeOfPoint(playerid, 10.0, 320.59393310547, -1188.8247070313, 78.117607116699))
        {
            MoveObject(Firasgate, 314.15914916992, -1193.9382324219, 77.978485107422, 10);
            SendClientMessage(playerid, 0xFFFFFFFF, "You've opened the Firas gate, please close it");
            openClosed = 1; // Change value of openClosed to 1, showing that it is open
        }
      }
      else
      {
        // If gate is already opened:
        if(IsPlayerInRangeOfPoint(playerid, 10.0, 320.59393310547, -1188.8247070313, 78.117607116699))
        {
            MoveObject(Firasgate, 320.59393310547, -1188.8247070313, 78.117607116699, 10);
            SendClientMessage(playerid, 0xFFFFFFFF, "You've closed the Firas gate");
            openClosed = 0; // Change the value back to 0, showing that it is open
        }
        return 1;
      }
      return 1;
  }
     
    return 0;
}
Didn't test it, but it should work.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)