moving gate
#1

Ok I wanna make a moving gate but the tutorials i have been looking at are strcmd ones.
I want someone to explain to me how to do it as I want to learn.


this are the coords i want the gate to go to once its opened. So /open it moves to:
Код:
CreateObject(976, 821.5, 1734.4000244141, 4.1999998092651, 0, 358, 284);
and this is when you /close:
Код:
CreateObject(976, 823.29998779297, 1726.3000488281, 4.1999998092651, 0, 358, 284);
NOTE: The gate is already at these coords

and I have already done "new gate1;"
Reply
#2

Right FIRST the gate has to be created and defined an example

pawn Код:
new gate;
 Gate = CreateObject(976, 821.5, 1734.4000244141, 4.1999998092651, 0, 358, 284);
Then you have to move that object under any command header for example in ZCMD
pawn Код:
CMD:Movegate(playerid)
{
      MoveObject(Gate, 976, 823.29998779297, 1726.3000488281, 4.1999998092651, 0, 358, 284);
      return 1;
}
YOu could always make it more complex by doing ranges (
pawn Код:
IsPlayerInRangeOfPoint();
and so on
Reply
#3

Ok thanks, so how would I set this out? and yes InRangePoint would be good.
Reply
#4

An example would be:

pawn Код:
CMD:movegate(playerid)
{
      if(IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z) MoveObject(Gate, X, Y, Z);
      else if(IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z) MoveObject(Gate, X, Y, Z);
      else if(IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z) MoveObject(Gate, X, Y, Z);
       else SendClientMessage(playerid, COLOUR, YOur arnt in range of a movable gate."):
       return 1;
}
Reply
#5

I just want a simple /opengate and it opens the gate for faction id 7 and it will close using /closegate.. that simple. Thanks.
Reply
#6

Hope it will help.. i really not sure.. but try it.. if I did something wrong.. please someone fix me..

pawn Код:
new gate; // at the start of your script

/* put in public OnGameModeInit() */
gate = CreateObject(976, 821.5, 1734.4000244141, 4.1999998092651, 0, 358, 284);

/* put in public OnPlayerCommandText(playerid, cmdtext[]) */
    if(strcmp(cmd, "/opengate", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7)
            {
                if(IsPlayerInRangeOfPoint(i, 5.0, 821.5, 1734.4000244141, 4.1999998092651))
                {
                    MoveObject(gate, 823.29998779297, 1726.3000488281, 4.19999980926510, 3.5);
                    return 1;
                }
            }
        }
        return 1;
    }
   
    if(strcmp(cmd, "/closegate", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7)
            {
                if(IsPlayerInRangeOfPoint(i, 5.0, 823.29998779297, 1726.3000488281, 4.1999998092651))
                {
                    MoveObject(gate, 821.5, 1734.4000244141, 4.1999998092651, 3.5);
                    return 1;
                }
            }
        }
        return 1;
    }
Reply
#7

sorry I use ZCMD.
Reply
#8

pawn Код:
if(IsPlayerInRangeOfPoint(i, 5.0, 821.5, 1734.4000244141, 4.1999998092651))
You Haven't defined 'i'
Reply
#9

CreateObject(976, 821.5, 1734.4000244141, 4.1999998092651, 0, 358, 284);
this is the place the gate is at:
823.29998779297, 1726.3000488281, 4.1999998092651
these are the ones I want the gate to move to when you use /opengate
Reply
#10

Then I suggest you to try understand the script I gave you or whatever people explain and make it the way you want it

and that's right.. didnt defined 'i'.. my bad ;/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)