21.05.2012, 02:16
Why are you using so many timers for the same thing :/ Also, you aren't moving the objects anywhere.
Look:
Edited code:
Obviously the move position is approximate.
Look:
Код:
PlayerToPoint(10.0, i, 1588.98, -1638.15, 14.36) //You check if the player is near here MoveObject(lspdgate, 1588.98, -1638.15, 8.36, 5);//You move the object to the exact same x,y,z pos..
pawn Код:
forward GatesOpen();
forward MoveObjectEx(objectid, Float:xpos, Float:ypos, Float:zpos, Float:_Speed, Float:xRot=-1000.0, Float:yRot=-1000.0, Float:zRot=-1000.0);
new Gates[2];
new lvpdGateOpen = 0;
new lspdGateOpen = 0;
public OnGameModeInit()
{
SetTimer("GatesOpen", 1000, true);
Gates[0] = CreateDynamicObject(971, 2334.98, 2443.39, 7.50, 0.00, 0.00, 60.06);
Gates[1] = CreateDynamicObject(971, 1588.98, -1638.15, 14.36, 0.00, 0.00, 179.10);
return 1;
}
public GatesOpen()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 10.0, 2334.98, 2443.39, 7.50) && lvpdGateOpen == 0)
{
MoveObject(lvpdgate, 2334.98 - 10, 2443.39, 1.00, 5);
lvpdGateOpen = 1;
SetTimerEx("MoveObjectEx", 7000, false, "iiffff", 0, Gates[0], 2334.98, 2443.39, 1.00);
}
else if(IsPlayerInRangeOfPoint(i, 10.0, 1588.98, -1638.15, 14.36) && lspdGateOpen == 0)
{
MoveObject(lspdgate, 1588.98 - 10, -1638.15, 8.36, 5);
lspdGateOpen = 1;
SetTimerEx("MoveObjectEx", 7000, false, "iiffff", 1, Gates[1], 1588.98, -1638.15, 8.36);
}
}
}
public MoveObjectEx(type, objectid, Float:xpos, Float:ypos, Float:zpos, Float:_Speed, Float:xRot=-1000.0, Float:yRot=-1000.0, Float:zRot=-1000.0)
{
MoveObject(objectid, xpos, ypos, zpos, _Speed, xRot, yRot, zRot);
if(type == 0) lvpdGateOpen = 0;
else if(type == 1) lspdGateOpen = 0;
}