PDA

View Full Version : Help with some gates..


Luke_James
25/08/2012, 08:25 PM
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?

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);

ikkentim
26/08/2012, 01:02 AM
You forgot the rotations in the else{...} case

Luke_James
26/08/2012, 01:34 PM
Which co-ordinates are the rotations? The 2.0?