SA-MP Forums Archive
Help with some gates.. - 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: Help with some gates.. (/showthread.php?tid=372232)



Object rotation? - Luke_James - 25.08.2012

I'm having a little trouble with some gates, when you do /gate they open, but don't close when you do /gate again, and they turn 90 degrees facing the wrong direction. Here's the pawn..

EDIT: The guy below said that I haven't included the object rotation co-ordinate, which one is this? Is it the 2.0 co-ordinate?

pawn Код:
new PDGate1, PDGate2


forward PDGateMove();


command(gate, playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 25.0, 1531.2126,-1603.6033,13.3828))
    {
        if(Player[playerid][Faction] == 1)
        {
            if(GateOpen == 0)
            {
                MoveDynamicObject(PDGate1, 1534.23, -1602.30, 13.40, 2.0, 0.0, 0.0, 0.0); // open
                MoveDynamicObject(PDGate2, 1534.40, -1724.08, 13.39, 2.0, 0.0, 0.0, 0.0); // open
                PlayerPlaySound(playerid, 1035, 0, 0, 0);
                GateOpen = 1;
            }
            else
            {
                MoveDynamicObject(PDGate1, 1534.34, -1602.28, 13.40, 2.0, 0.0, 0.0, 0.0); // closed
                MoveDynamicObject(PDGate2, 1534.60, -1724.08, 13.39, 2.0, 0.0, 0.0, 0.0); // closed
                GateOpen = 0;
            }
        }
    }
        return 1;
}

stock LoadObjects()
{
    // SCPD Gates
    PDGate1 = CreateDynamicObject(2920, 1534.34, -1602.28, 13.40,   -92.16, -2.04, 88.62);
        PDGate2 = CreateDynamicObject(2920, 1534.60, -1724.08, 13.39,  -91.62, 1.56, 91.62);
    return 1;
}

public PDGateMove()
{
    MoveDynamicObject(PDGate1, 1534.23, -1602.30, 13.40, 2.0, 0.0, 0.0, 0.0);
    MoveDynamicObject(PDGate2, 1534.40, -1724.08, 13.39, 2.0, 0.0, 0.0, 0.0);
    return 1;
}
Co-ordinates

PDGate1

Open: CreateObject(2920, 1534.23, -1602.30, 13.40, 0.00, 0.00, 87.24);
Closed: CreateObject(2920, 1534.34, -1602.28, 13.40, -92.16, -2.04, 88.62);

PDGate2

Open: CreateObject(2920, 1534.40, -1724.08, 13.39, 0.00, 0.00, 91.62);
Closed: CreateObject(2920, 1534.60, -1724.08, 13.39, -91.62, 1.56, 91.62);


Re: Help with some gates.. - ikkentim - 26.08.2012

You forgot the rotations in the else{...} case


Re: Help with some gates.. - Luke_James - 26.08.2012

Which co-ordinates are the rotations? The 2.0?