Some help with countDown
#1

Hi guys i have make this countdown system:
PHP код:
new CountDownVar 15;
new 
CountDownTimer
on my command:
PHP код:
CountDownTimer SetTimer("CountDown" ,1000false); 
PHP код:
forward CountDown(playerid);
public 
CountDown(playerid)
{
 
CountDownVar--;
 new 
str[128];
 if(
CountDownVar == 0)
 {
    
KillTimer(CountDownTimer);
    
CountDownVar 15;
 }
 else
 {
    
GameTextForPlayer(playerid"Count Down: %d"CountDownTimer80001);
    
//format(str, sizeof(str), "Count Down: %d", CountDownTimer);
    //GameTextForPlayer(str, 1000, 1);
 
}
 return 
1;

BUT on game when type the command then i see a gametext which writes: countdown 19 and it still there for some seconds and then disapear!!
whats wrong some help please
Reply
#2

pawn Код:
forward CountDown(playerid);
public CountDown(playerid)
{
 CountDownVar--;
 new str[128];
 if(CountDownVar == 0)
 {
    KillTimer(CountDownTimer);
    CountDownVar = 15;
 }
 else
 {
    GameTextForPlayer(playerid, "Count Down: %d", CountDownTimer, 1000, 1);
    //format(str, sizeof(str), "Count Down: %d", CountDownTimer);
    //GameTextForPlayer(str, 1000, 1);
 }
 return 1;
}
pawn Код:
SetTimerEx("CountDown", 1000, true, "i", playerid);
The Playerid isn't defined in yours, your gametext was also set to show for 8 seconds. lemme know if you want all players to see the timer.
Reply
#3

i get those errors:
PHP код:
C:\Users\Дзмзфсзт\Desktop\server 0.3z\filterscripts\CarSystem.pwn(1779) : warning 202number of arguments does not match definition
C
:\Users\Дзмзфсзт\Desktop\server 0.3z\filterscripts\CarSystem.pwn(1771) : warning 204symbol is assigned a value that is never used"str" 
line 1779:
PHP код:
GameTextForPlayer(playerid"Count Down: %d"CountDownTimer10001); 
line 1771:
PHP код:
new str[128]; 
no i dont all players see the timer only the player who type the command
thanks for your time
Reply
#4

Remove

Код:
tmp[256]
Change the str value new
Код:
new str[100];
Reply
#5

pawn Код:
CountDownTimer = SetTimer("CountDown" ,1000, false);
it should be

pawn Код:
CountDownTimer = SetTimer("CountDown" ,1000, true);
false = timer wont repeat it will only work once

true = timer repeat
Reply
#6

ok guys look what i have now and tell me your opinions:
PHP код:
new CountDownVar 15;
new 
CountDownTimer
PHP код:
CountDownTimer SetTimerEx("CountDown"1000true"i"playerid); 
PHP код:
forward CountDown(playerid);
public 
CountDown(playerid)
{
 
CountDownVar--;
 new 
str[128];
 if(
CountDownVar == 0)
 {
    
KillTimer(CountDownTimer);
    
CountDownVar 15;
 }
 else
 {
    
GameTextForPlayer(playerid"Count Down: %d"CountDownTimer10001);
    
//format(str, sizeof(str), "Count Down: %d", CountDownTimer);
    //GameTextForPlayer(str, 1000, 1);
 
}
 return 
1;

and i am getting those warnings:
PHP код:
C:\Users\Dimitris\Desktop\server 0.3z\filterscripts\CarSystem.pwn(1779) : warning 202number of arguments does not match definition
C
:\Users\Dimitris\Desktop\server 0.3z\filterscripts\CarSystem.pwn(1771) : warning 204symbol is assigned a value that is never used"str" 
line 1779:
PHP код:
 GameTextForPlayer(playerid"Count Down: %d"CountDownTimer10001); 
line 1771:
PHP код:
 new str[128]; 
when i press my command which the timer should start working ,i dont see nothing the command is not working,
plesae some help thanks
Reply
#7

pawn Код:
forward CountDown(playerid);
public CountDown(playerid)
{
 CountDownVar--;
 new str[128];
 if(CountDownVar == 0)
 {
    KillTimer(CountDownTimer);
    CountDownVar = 15;
 }
 else
 {
    format(str, sizeof(str), "Count Down: %d", CountDownVar);
    GameTextForPlayer(str, 1000, 1);
 }
 return 1;
}
Reply
#8

ok guys look what i have now and tell me your opinions:
PHP код:
new CountDownVar 15;
new 
CountDownTimer
PHP код:
CountDownTimer SetTimerEx("CountDown"1000true"i"playerid); 
PHP код:
forward CountDown(playerid);
public 
CountDown(playerid)
{
 
CountDownVar--;
 new 
str[128];
 if(
CountDownVar == 0)
 {
    
KillTimer(CountDownTimer);
    
CountDownVar 15;
 }
 else
 {
    
GameTextForPlayer(playerid"Count Down: %d"CountDownTimer10001);
    
 }
 return 
1;

and i am getting those warnings:
PHP код:
C:\Users\Dimitris\Desktop\server 0.3z\filterscripts\CarSystem.pwn(1779) : warning 202number of arguments does not match definition
C
:\Users\Dimitris\Desktop\server 0.3z\filterscripts\CarSystem.pwn(1771) : warning 204symbol is assigned a value that is never used"str" 
line 1779:
PHP код:
 GameTextForPlayer(playerid"Count Down: %d"CountDownTimer10001); 
line 1771:
PHP код:
 new str[128]; 
when i press my command which the timer should start working ,i dont see nothing the command is not working,
plesae some help thanks
Reply
#9

Quote:
Originally Posted by JFF
Посмотреть сообщение
pawn Код:
forward CountDown(playerid);
public CountDown(playerid)
{
 CountDownVar--;
 new str[128];
 if(CountDownVar == 0)
 {
    KillTimer(CountDownTimer);
    CountDownVar = 15;
 }
 else
 {
    format(str, sizeof(str), "Count Down: %d", CountDownVar);
    GameTextForPlayer(str, 1000, 1);
 }
 return 1;
}
i did it and i am getting this error
PHP код:
C:\Users\Dimitris\Desktop\server 0.3z\filterscripts\CarSystem.pwn(1781) : error 035argument type mismatch (argument 1
line 1781:
PHP код:
 GameTextForPlayer(str10001); 
Reply
#10

The first argument is the playerid and use another gametext style because style 1 fades out after 8 seconds according to SAMP Wiki.
pawn Код:
GameTextForPlayer(playerid, str, 1000, 4);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)