How to set timer!?
#1

Hey guys, ya know, last time, i asked for the KEY to be pressed by F or something like that.. well..,

Now i want like that, for example:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SECONDARY_ATTACK )
    {
        if (PlayerToPoint(1, playerid,-2487.4114,-612.5793,132.5592)) // Place he needs to be so the gate can be opened
      {
          MoveObject(gate1, -2487.3696,-611.0781,132.7919); // Gate that will open
        return 1;
      }
I want to set timer after it, as when it passes, the gate closes automaticially.. how do i do that? if you know, please tell me.. thanks!

Coord's of closed gate:

pawn Код:
MoveObject(gate1, 2215.454833,-1147.475585,1025.796875); // Gate that will close after time passes
Reply
#2

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SECONDARY_ATTACK)
    {
        if (PlayerToPoint(1.0, playerid, -2487.4114, -612.5793, 132.5592))
        {
            MoveObject(gate1, -2487.3696, -611.0781, 132.7919); // move the gate to open position.
            SetTimerEx("CloseGate", 5000, false, "i", playerid);
            return 1;
        }
    }
    return 1;
}

// somewhere at the bottom of your script..
forward CloseGate(playerid);
public CloseGate(playerid)
{
    MoveObject(gate1, 2215.454833, -1147.475585, 1025.796875);     
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: