SA-MP Forums Archive
Help! Text help! I am a Novice - 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: Help! Text help! I am a Novice (/showthread.php?tid=637782)



Help! Text help! I am a Novice - XiaoZe - 21.07.2017

How to do a countdown on the text to the players to see?

have somebody can help me?

thanks!

just like that ↓


Re: Help! Text help! I am a Novice - CodeStyle175 - 21.07.2017

With this code you can add more countdowns. You just have to change CountDownerType numbers...
PHP код:
new CountDownerType[max_players],
    
CountDownLeft[max_players];
public 
OnGameModeInit(){
    
SetTimer("CountDown",1000,true);
    return 
1;
}
forward CountDown();
public 
CountDown(){
    new 
s[50];
    foreach(
Player,i){
        switch(
CountDownerType[i]){
            case 
1:{
                
format(s,sizoef(s),"POLICE FIND YOU: %d SECONDS",--CountDownLeft[i]);
                
PlayerTextDrawSetString(i,PTD_CountDown[i],s);
                if(!
CountDownLeft[i]){
                    
CountDownerType[i]=0;
                                        
PlayerTextDrawHide(iPTD_CountDown[i]);
                }
            }
        }
    }
    return 
1;




Re: Help! Text help! I am a Novice - XiaoZe - 21.07.2017

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
With this code you can add more countdowns. You just have to change CountDownerType numbers...
PHP код:
new CountDownerType[max_players],
    
CountDownLeft[max_players];
public 
OnGameModeInit(){
    
SetTimer("CountDown",1000,true);
    return 
1;
}
forward CountDown();
public 
CountDown(){
    new 
s[50];
    foreach(
Player,i){
        switch(
CountDownerType[i]){
            case 
1:{
                
format(s,sizoef(s),"POLICE FIND YOU: %d SECONDS",--CountDownLeft[i]);
                
PlayerTextDrawSetString(i,PTD_CountDown[i],s);
                if(!
CountDownLeft[i]){
                    
CountDownerType[i]=0;
                                        
PlayerTextDrawHide(iPTD_CountDown[i]);
                }
            }
        }
    }
    return 
1;

Thanks bro! Thank you, you helped me a lot