SA-MP Forums Archive
Textdraw minute timer! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Textdraw minute timer! (/showthread.php?tid=255062)



Textdraw minute timer! - Admigo - 14.05.2011

Heey guys
I want to make a minute timer for the jail but i dont know how?
Like this 1:30.
Thanks admigo


Re: Textdraw minute timer! - Georgelopez1 - 14.05.2011

https://sampforum.blast.hk/showthread.php?tid=204785

Happy scripting


Re: Textdraw minute timer! - Admigo - 14.05.2011

Can someone explain it?


Re: Textdraw minute timer! - Raimis_R - 14.05.2011

For example create variable "Jail"

pawn Код:
new Jail[MAX_PLAYERS];
Now set value 1min.

Jail[playerid] = 60000;

And you need create a timer with 1s interval to check if player jailed and subtract 1.

Example:

SetTimer("Jailed",1000,true);

pawn Код:
forward Jailed( );
public  Jailed( )
{
    for( new i = 0; i != MAX_PLAYERS; i++ )
    {
        if( Jail[ i ] > 1 )
        {
            Jail[ i ] --; // subtract 1
        }
        if( Jail[ i ] == 0 )
        {
            // Realese from jail
        }
    }
}
BTW: when you checking if player jailed if( Jail[ i ] > 1 ) and subtract 1 you can show value in the TD


Re: Textdraw minute timer! - Sinner - 14.05.2011

Quote:
Originally Posted by Raimis_R
Посмотреть сообщение
For example create variable "Jail"
pawn Код:
forward Jailed( );
public  Jailed( )
{
    for( new i = 0; i != MAX_PLAYERS; i++ )
    {
        if( Jail[ i ] > 1 )
        {
            Jail[ i ] --; // subtract 1
        }
        if( Jail[ i ] == 0 )
        {
            // Realese from jail
        }
    }
}
That would take 60,000 seconds to finish... You need to subtract 1000 every second.

pawn Код:
forward Jailed( );
public  Jailed( )
{
    for( new i = 0; i != MAX_PLAYERS; i++ )
    {
        if( Jail[ i ] > 1 )
        {
            Jail[ i ] -= 1000; // subtract 1000
        }
        if( Jail[ i ] == 0 )
        {
            // Realese from jail
        }
    }
}



Re: Textdraw minute timer! - Raimis_R - 14.05.2011

oh yes my math I was asleep (think)


Re: Textdraw minute timer! - Admigo - 14.05.2011

Thanks guys and how can i add the timer into textdraw?


Re: Textdraw minute timer! - Raimis_R - 14.05.2011

Quote:
Originally Posted by admigo
Посмотреть сообщение
Thanks guys and how can i add the timer into textdraw?
You can add variable


Re: Textdraw minute timer! - Admigo - 14.05.2011

Lol how?I dont understand that all