How can i fix the timer problem?
#5

You need to use SetTimerEx not SetTimer if you wish to use the "playerid" correctly and also turn off the repeating parameter.

https://sampwiki.blast.hk/wiki/SetTimerEx

Try this:
pawn Код:
public liftup1(playerid)
{
    SendClientMessage(playerid, 0xFF8080FF, " Elevator: Floor 1 ... ");
    SetTimerEx("liftup2", 2500, false, "d", playerid);
    return 1;
}

public liftup2(playerid)
{
    SendClientMessage(playerid, 0xFF8080FF, " Elevator: Floor 2 ... ");
    SetTimerEx("liftup3", 2500, false, "d", playerid);
    return 1;
}

public liftup3(playerid)
{
    SendClientMessage(playerid, 0xFF8080FF, " Elevator: Floor 3 ... ");
    SetTimerEx("liftup4", 2500, false, "d", playerid);
    return 1;
}

public liftup4(playerid)
{
    SendClientMessage(playerid, 0xFF8080FF, " Elevator: Floor 4 ... ");
    SetTimerEx("liftup", 2500, false, "d", playerid);
    return 1;
}

public liftup(playerid)
{
  elevused[playerid] = 1;
  SendClientMessage(playerid, 0xFF8080FF, " Elevator: Roof ... ");
  SendClientMessage(playerid, 0xFF8080FF, " Elevator doors will close in 5 seconds, please type /exit to get out ! ");
  SetTimerEx("liftdown", 5000, false, "d", playerid);
    return 1;
}

public liftdown(playerid)
{
    elevused[playerid] = 0;
    SendClientMessage(playerid, 0xFF0000FF, " Elevator doors are now closed. ");
    SetTimerEx("liftdown1", 2500, false, "d", playerid);
    return 1;
}

public liftdown1(playerid)
{
  SendClientMessage(playerid, 0xFF8080FF, " Elevator: Floor 4 ... ");
    SetTimerEx("liftdown2", 2500, false, "d", playerid);
    return 1;
}

public liftdown2(playerid)
{
  SendClientMessage(playerid, 0xFF8080FF, " Elevator: Floor 3 ... ");
    SetTimerEx("liftdown3", 2500, false, "d", playerid);
    return 1;
}

public liftdown3(playerid)
{
  SendClientMessage(playerid, 0xFF8080FF, " Elevator: Floor 2 ... ");
    SetTimerEx("liftdown4", 2500, false, "d", playerid);
    return 1;
}

public liftdown4(playerid)
{
  SendClientMessage(playerid, 0xFF8080FF, " Elevator: Floor 1 / Basement ... ");
    elevused[playerid] = 1;
    SendClientMessage(playerid, 0xFF0000FF, " Elevator doors are now opened, please type /exit to get out, or else type /roof to go up again ");
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == liftupp)
    {
      GameTextForPlayer(playerid, "Hospital's Elevator ~n~ To enter the elevator type /enter ", 3000, 5);
      SetTimerEx("liftupdelay", 1000, false, "d", playerid);
    }
    return 1;
}
You can kill the timer if you want to be on the safe side.
Reply


Messages In This Thread
How can i fix the timer problem? - by Moustafa - 26.07.2009, 16:20
Re: How can i fix the timer problem? - by Correlli - 26.07.2009, 16:21
Re: How can i fix the timer problem? - by Moustafa - 26.07.2009, 16:31
Re: How can i fix the timer problem? - by Moustafa - 26.07.2009, 16:41
Re: How can i fix the timer problem? - by member - 26.07.2009, 17:01

Forum Jump:


Users browsing this thread: 1 Guest(s)