SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/09/2011, 11:54 AM   #1
zxc1
Huge Clucker
 
zxc1's Avatar
 
Join Date: Apr 2010
Posts: 226
Reputation: 12
Default SetTimer

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?
zxc1 is offline   Reply With Quote
Old 19/09/2011, 12:05 PM   #2
Basicz
Gangsta
 
Basicz's Avatar
 
Join Date: Aug 2010
Location: Indonesia, Surabaya.
Posts: 630
Reputation: 34
Default Re: SetTimer

pawn Code:
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
Basicz is offline   Reply With Quote
Old 19/09/2011, 01:16 PM   #3
zxc1
Huge Clucker
 
zxc1's Avatar
 
Join Date: Apr 2010
Posts: 226
Reputation: 12
Default Re: SetTimer

WOW Thank you so much Basicz.
zxc1 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Help] SetTimer NotoriousMOB Help Archive 8 05/06/2011 07:34 AM
[SetTimer] i need help KDlivest954 Help Archive 8 01/04/2010 06:28 PM
Settimer witha settimer in it 02manchestera Help Archive 2 07/03/2010 02:01 PM
SetTimer _Sami_ Help Archive 3 06/01/2010 09:37 AM


All times are GMT. The time now is 09:49 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.