SA-MP Forums Archive
Gate Problem - 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 (/showthread.php?tid=435571)



Gate Problem - Luke_James - 07.05.2013

Hi, when I use the command /pdgate, the gate will open but when I type it again it does not close, it just moves a little bit... Here's the code;

pawn Код:
new PDGate1
 
stock LoadObjects()
{
        PDGate1 = CreateDynamicObject(968, -1572.20239,658.68304,7.09238,1.85999,-91.07996,-89.70003);
        return 1;
}

public PDGateMove()
{
    MoveDynamicObject(PDGate1, -1572.19006,658.84747,6.93702,0.00,0.00,00.00);
    return 1;
}

command(pdgate, playerid, params[])
{
    if(Player[playerid][Faction] == 1)
    {
        if(GateOpen == 0)
        {
            if(IsPlayerInRangeOfPoint(playerid, 25.0, -1572.20239, 658.68304, 7.09238 ))
            {
                MoveDynamicObject(PDGate1, -1572.19006, 658.84747, 6.93702, 2.0, 0.0, 0.0, 0.0);
            }
            GateOpen = 1;
            }
            else
            {
            if(IsPlayerInRangeOfPoint(playerid, 25.0, -1572.20239, 658.68304, 7.09238 ))
            {
                MoveDynamicObject(PDGate1, -1572.20239, 658.68304, 7.09238, 2.0, -0.00, 0.00, 0.00);
         }
            GateOpen = 0;
        }
    }
    return 1;
}
The co-ordinate for the OPEN gate is;
- CreateObject(968, -1572.19006, 658.84747, 6.93702, 0.00000, 0.00000, -90.90003);


The co-ordinate for the CLOSED gate is;
- CreateObject(968, -1572.20239, 658.68304, 7.09238, 1.85999, -91.07996, -89.70003);

NOTE: The indentation is done properly on the actual script, it messed up a little here.


Re: Gate Problem - BigGroter - 07.05.2013

Try adding the rotations as well. (1.85999, -91.07996, -89.70003)