SA-MP Forums Archive
Gate problem/question - 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: Gate problem/question (/showthread.php?tid=489357)



Gate problem/question - coolmark1995 - 22.01.2014

Hello I have the following code below it is to work as rcon but is there a way to make the gate open by just driving up to it if your logged in as rcon?

Код:
public OnFilterScriptExit()
{
        print("\n--------------------------------------");
        print(" Admin base by [AF]Zues unloded!");
        print("--------------------------------------\n");
        return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp("/ho", cmdtext, true, 10) == 0)
  {
        if(IsPlayerAdmin(playerid) == 1)
        {
      MoveObject(admingate, -460.0388, 2593.2056, 62.0600, 2.00);
      SendClientMessage(playerid, 0xFFFF00AA, "Admin Base gate Opened");
      return 1;
        }
        else
        {
        return 1;
        }
  }
  if(strcmp("/hc", cmdtext, true, 10) == 0)
  {
        if(IsPlayerAdmin(playerid) == 1)
        {
      MoveObject(admingate, -459.97452, 2593.31567, 56.50000, 2.00);
      SendClientMessage(playerid, 0xFFFF00AA, "Admin Base gate Closed");
      return 1;
        }
        else
        {
        return 1;
        }
  }
  if(strcmp("/home", cmdtext, true, 10) == 0)
  {
        if(IsPlayerAdmin(playerid) == 1)
        {
      SetPlayerPos(playerid, -524.257690, 2593.366210, 53.415000);
      SendClientMessage(playerid, 0xFFFF00AA, "You have been teleported to the admin base");
      return 1;
        }
        else
        {
        return 1;
        }
  }
  return 0;
}



Re: Gate problem/question - Scottas - 22.01.2014

You have to check how close player is to gates, then check if he is an admin and open the gates.


Re: Gate problem/question - itsCody - 22.01.2014

Try using IsPlayerInRangeOfPoint?