Textdraw minute timer!
#1

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

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

Happy scripting
Reply
#3

Can someone explain it?
Reply
#4

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
Reply
#5

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
        }
    }
}
Reply
#6

oh yes my math I was asleep (think)
Reply
#7

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

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

Lol how?I dont understand that all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)