new LSPDGate;
{ if(!GateInfo[h][gStatus]) { MoveObject(LSPDGate,1544.7018,-1630.9528,13.2196,0.0000,00.0000,90.0000); SetObjectRot(LSPDGate, 0.0000, 0.0000, 90.0000 ); Action(playerid, "opens up the gate."); GateInfo[h][gStatus]=1; } else if(PlayerToPoint(9.0,playerid,1544.6943, -1630.7305, 13.2796)) { MoveObject(LSPDGate,1544.7018,-1630.9528,13.2196,0.0000,90.0000,90.0000); SetObjectRot(LSPDGate, 0.0000, 90.0000, 90.0000 ); GateInfo[h][gStatus]=0; Action(playerid, "closes up the gate."); } }
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) // Detects player key state changes
{
if(PRESSED(2)) // If the horn key was pressed
{
if(IsPlayerInAnyVehicle(playerid)) // If this player is in a vehicle (seems legit?)
{
// Well, they pressed the horn key and they're in a vehicle, so let's process the gate script
if(!GateInfo[h][gStatus])
{
MoveObject(LSPDGate,1544.7018,-1630.9528,13.2196,0.0000,00.0000,90.0000);
SetObjectRot(LSPDGate, 0.0000, 0.0000, 90.0000 );
Action(playerid, "opens up the gate.");
GateInfo[h][gStatus]=1;
}
else if(PlayerToPoint(9.0,playerid,1544.6943, -1630.7305, 13.2796))
{
MoveObject(LSPDGate,1544.7018,-1630.9528,13.2196,0.0000,90.0000,90.0000);
SetObjectRot(LSPDGate, 0.0000, 90.0000, 90.0000 );
GateInfo[h][gStatus]=0;
Action(playerid, "closes up the gate.");
}
}
}
return 1;
}
"h" isn't even defined. That example won't work at all, and isn't the most efficient either even if it did compile. I assume that code is inside of a loop, can you show the rest of the code?
|
if(!GateInfo[h][gStatus])