SetTimer
#2

pawn Код:
new playerCounts[ MAX_PLAYERS ] = { 0, ... }, timer[ MAX_PLAYERS ];

public OnPlayerDisconnect( playerid, reason )
    return KillTimer( timer[ playerid ] );

COMMAND:twominutes( playerid, params[ ] )
{
    if ( playerCounts[ playerid ] > 0 ) return 0;

    timer[ playerid ] = SetTimerEx( "TWO", 1000, true, "i", playerid );

     return 1;
}

forward TWO( playerid );
public TWO( playerid )
{
    playerCounts[ playerid ] ++;

    if ( playerCounts[ playerid ] >= 200 )
    {
        playerCounts[ playerid ] = 0;

        GameTextForPlayer( playerid, "~W~COUNT END", 1000, 3 );

        KillTimer( timer[ playerid ] );
    }

    new txt[ 18 ];

    format( txt, 30, "%d seconds left", 200 - playerCounts[ playerid ] );

    // 200

    GameTextForPlayer( playerid, txt, 1000, 3 );

    return 1;
}
hope it works..

edit: fixed missing arguments
Reply


Messages In This Thread
SetTimer - by zxc1 - 19.09.2011, 11:54
Re: SetTimer - by Basicz - 19.09.2011, 12:05
Re: SetTimer - by zxc1 - 19.09.2011, 13:16

Forum Jump:


Users browsing this thread: 3 Guest(s)