Make elevator
#2

you mean it should wait when up/down for 2 seconds, then you will need to check how long it will take, edit the waitingtime
pawn Code:
#include <a_samp>

new ELEVATOR;
new OpenGate[MAX_PLAYERS];
forward CheckEl();
forward Wait(time);

public OnGameModeInit()
{
ELEVATOR = CreateObject( 975 , 2118.854980, 2407.718750, 61.134506 , 0.000000 , 0.000000 , 0.000000 );
SetTimer("CheckEl", 500, true);
}

public CheckEl() //LSPD gate
{
  for(new i = 0; i < GetMaxPlayers(); i++)
  {
        if(!IsPlayerConnected(i)) continue;
    if(OpenGate[i] == 0)
        {
      MoveObject(ELEVATOR,2118.854980, 2407.718750, 61.134506,3.5);//up
            Wait(5000);
            OpenGate[i] = 1;
    }
    if(OpenGate[i] == 1)
    {
      MoveObject(ELEVATOR, 2064.446045, 2438.436279, 11.495003,3.5);//down
      Wait(5000);
      OpenGate[i] = 0;
    }
  }
}

public Wait(time)
{
    new stamp = tickcount();
    while (tickcount() - stamp < time)
    {
    }
    return 1;
}
that should do the trick, haven't tried it tough
note: you may need to adjust waiting time, as I'm not going to check that for you, currently it's going down again after moving for 5seconds
and vice versa.
also: a speed of 2.0 is REALLY slow, 3.5 is still very slow, but if you want you can edit it
2nd note: you have a variable to much at the up position, probably a rotation? the createobject doesn't have any rotations now, you may need to fix that, as I didn't know the rotation.

Have fun with it
Reply


Messages In This Thread
Make elevator - by Quead - 26.07.2009, 03:49
Re: Make elevator - by pixelhotel - 26.07.2009, 05:50
Re: Make elevator - by paytas - 26.07.2009, 06:11
Re: Make elevator - by Quead - 26.07.2009, 11:39
Re: Make elevator - by pixelhotel - 27.07.2009, 10:21

Forum Jump:


Users browsing this thread: 1 Guest(s)