[HELP] /Commands
#1

Hi guys, So my server is nearly finished (well getting there) but I've got commands like /PayToll1 /PayToll2 etc...

How do I make it so that one command open the object infront of the player requesting... for example.
A player drives up to a toll and enters /paytoll but it only open that toll they are facing and no others?

Hope that made sense, hard to word lol!

Here is an example of the gate commands I'm using and want to keep if possible!

pawn Код:
if (strcmp(cmdtext, "/PDGate", true)==0)
      {
      MoveObject(PDGate,629.36450195313, -591.13940429688, 15.622407913208, 3.5);
      SetTimer("PDGateClose", 5000, 0);
      SendClientMessage(playerid, 0xFFFF00AA, "The Policegate Will Shut In 5 Seconds");
      return 1;
      }
Reply
#2

Well, all you have to do is use:
pawn Код:
if( IsPlayerInRangeOfPoint( playerid, RANGE, X, Y, Z ) )
Where, RANGE is the distance from where you want to open / close the gate. For example 10.0.

X, Y, Z are the object coordinates, from where you calculate the distance.

So, for example:

pawn Код:
if (strcmp(cmdtext, "/PDGate", true)==0)
{
      if( IsPlayerInRangeOfPoint( playerid, 5.0, 629.3645, -591.1394, 15.6224 ) )
      {
            MoveObject(PDGate,629.36450195313, -591.13940429688, 15.622407913208, 3.5);
            SetTimer("PDGateClose", 5000, 0);
            SendClientMessage(playerid, 0xFFFF00AA, "The Policegate Will Shut In 5 Seconds");
      }
      if( IsPlayerInRangeOfPoint( playerid, 5.0, newx, newy, newz ) )
      {
            //bla bla
      }
      // And so on..
      return 1;
}
Now, with the /PDGate command, you`ll be able to open as many gates as you want, as long as you are near them. Hope you understood.
Reply
#3

Thanks Buddy, Does this count for what way they are facing?
Reply
#4

No ... That`s a different story and I can`t help you there. Sorry.
Reply
#5

this didnt work :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)