SetTimer
#1

Hi Everyone,

I know that people asked this question before, but I still can't make it work.
I want that for example when player uses the commmand /twominutes it's will show him with GameTextForPlayer:
119 seconds left, 118 seconds left, 117 seconds left..........

Can someone help me please?
Reply
#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
#3

WOW Thank you so much Basicz.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)