SA-MP Forums Archive
Countdown Help - 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)
+--- Thread: Countdown Help (/showthread.php?tid=369699)



Countdown Help - necrobg3 - 17.08.2012

Hey guys. I just wondering is there any way to make the texdraws who say the count visible only for players in range?
Here is the command.

Код:
    if (strcmp("/count", cmdtext, true, 10) == 0)
	{
    SetTimer("five", 1000, 0);
    SetTimer("four", 2000, 0);
    SetTimer("three", 3000, 0);
    SetTimer("two", 4000, 0);
    SetTimer("one", 5000, 0);
    SetTimer("start", 7000, 0);
    {
    return 1;
    }
+Rep for the dude who help me.


Re: Countdown Help - lamarr007 - 17.08.2012

Use wiki.sa-mp.com/wiki/IsPlayerInRangeOfPoint


Re: Countdown Help - Kindred - 17.08.2012

Do what he said ^.

And this is absolutely the WORST method of making a countdown in the world.

This is recommended:

pawn Код:
SetTimer("five", 1000, 0);
SetTimer("four", 2000, 0);
SetTimer("three", 3000, 0);
SetTimer("two", 4000, 0);
SetTimer("one", 5000, 0);
SetTimer("start", 7000, 0);

// Into...

new countdown == 5;

SetTimerEx("countdowntimer", 1000, true, "i", countdown);

forward countdowntimer(count);

public countdowntimer(count)
{
    countdown --;
    if(countdown == 0)
    {
        //If timer is 0, write "start" here
        KillTimer(countdowntimer);
        countdown == 5; //So if we re-do the SetTimerEx, we do not need to reset the variable.
    }
    return 1;
}
This is much faster and easier.


Re: Countdown Help - Kirollos - 17.08.2012

Quote:
Originally Posted by Kindred
Посмотреть сообщение
Do what he said ^.

And this is absolutely the WORST method of making a countdown in the world.

This is recommended:

pawn Код:
SetTimer("five", 1000, 0);
SetTimer("four", 2000, 0);
SetTimer("three", 3000, 0);
SetTimer("two", 4000, 0);
SetTimer("one", 5000, 0);
SetTimer("start", 7000, 0);

// Into...

new countdown == 5;

SetTimerEx("countdowntimer", 1000, true, "i", countdown);

forward countdowntimer(count);

public countdowntimer(count)
{
    countdown --;
    if(countdown == 0)
    {
        //If timer is 0, write "start" here
        KillTimer(countdowntimer);
    }
    return 1;
}
This is much faster and easier.
yeah, fast function and better.


Re: Countdown Help - necrobg3 - 18.08.2012

Thanks guys.