SA-MP Forums Archive
OnObjectMoved 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnObjectMoved problem (/showthread.php?tid=215955)



- 1D10T - 24.01.2011

Hi,

I am working on my own FilterScript of the LS Elevator and I have a question about the public OnObjectMoved(objectid)

This is what I have:
Quote:

if(ElevatorState == ELEVATOR_STATE_IDLE)
{
if(floor == 0)
{
SendClientMessage( playerid, WHITE, "You selected the Ground Floor" );
MoveDynamicObject(Elevator, 1786.678100, -1303.459472, 14.551476, 5);
ElevatorState = ELEVATOR_STATE_MOVING;
return 1;
}

This is for going to floor 0 wich is the street level.
For the first floor i have this:
Quote:

if(floor == 1)
{
SendClientMessage( playerid, WHITE, "You selected the 1st Floor" );
MoveDynamicObject(Elevator, 1786.678100, -1303.459472, 23.059376, 5);
ElevatorState = ELEVATOR_STATE_MOVING;
return 1;
}

as public I have this:
Quote:

public OnObjectMoved(objectid)
{
if(objectid == Elevator)
{
ElevatorState = ELEVATOR_STATE_IDLE;
return 1;
}
return 1;
}

When I test this out In-Game it keeps saying "Elevator is already moving. Wait a few seconds" this message is triggered when the elevator is moving:
Quote:

else
{
SendClientMessage(playerid, WHITE, "Elevator is already moving. Wait a few Seconds");
return 1;
}

(else is for if(ElevatorState = ELEVATOR_STATE_IDLE)

Can anyone help me with resolving this problem? Because what i'm trying to do is to have ELEVATOR_STATE_MOVING when it moves and ELEVATOR_STATE_IDLE when it is Idle (when it stopped moving).

Fixed. We got the original lselevator working.