[REQ]Movable Gates Command
#2

I`ll give it a try to help you:

First:
pawn Код:
new sacgclose;
Second, you need to create the closed gate, using the 'sacgclose' we used before. This is done in OnGameModeInit function:
pawn Код:
sacgclose = CreateObject (8210,1024.183,-2008.802,3.244,0.00000000,0.00000000,83. 995) ;
Now, we move on to commands. You need to put these commands under OnPlayerCommandText

pawn Код:
if(!strcmp(cmdtext,"/fbo",true))
    {
            if(IsPlayerInRangeOfPoint(playerid, 10.0, 1024.183,-2008.802,3.244))
            {
            MoveObject(sacgclose, 1024.184,-2008.802,15.244, 2.0); // (sacgclose, X,Y,Z, MovingSpeed)
                SendClientMessage(playerid, 0xAA0000AA, "You have opened the Coast Guard Bay gates please /fbc.");
            return 1;
             }
         else SendClientMessage(playerid, 0xAA0000AA, "You must be near the gate to open it.");
      else
      return 1;
     }
Now with the close command:
pawn Код:
if(!strcmp(cmdtext,"/fbc",true))
    {
            if(IsPlayerInRangeOfPoint(playerid, 10.0, 1024.183,-2008.802,3.244))
            {
            MoveObject(sacgclose, 1024.184,-2008.802,15.244, 2.0);
                SendClientMessage(playerid, 0xAA0000AA, "You have closes the Coast Guard Bay gates.");
            return 1;
             }
         else SendClientMessage(playerid, 0xAA0000AA, "You must be near the gate to open it.");
      else
      return 1;
     }
I made it with IsPlayerInRangeOfPoint, which checks if the player is near the gate which you want to open ... if you do it without a IsPlayerInRangeOfPoint, you would`ve been able to open the gate from anywhere ...

Hope I helped ... if you have any questions, feel free to post or pm me.

ps: You don`t need any:
pawn Код:
new aacgopen
You need only 1 gate created, which you'll move with /fbo and /fbc commands.
Reply


Messages In This Thread
[REQ]Movable Gates Command - by Alex_Carillo - 06.02.2011, 22:25
Re: [REQ]Movable Gates Command - by antonio112 - 06.02.2011, 23:12
Re: [REQ]Movable Gates Command - by gtapolicemods - 06.02.2011, 23:39
Re: [REQ]Movable Gates Command - by Alex_Carillo - 07.02.2011, 01:31
Re: [REQ]Movable Gates Command - by antonio112 - 07.02.2011, 02:18
Re: [REQ]Movable Gates Command - by gtapolicemods - 07.02.2011, 20:00
Re: [REQ]Movable Gates Command - by Alex_Carillo - 07.02.2011, 21:49

Forum Jump:


Users browsing this thread: 1 Guest(s)