Help SetTimer -
xganyx - 06.07.2013
i have a settimer and i want the GameText About The Time How Do I Make That ?
Re: Help SetTimer -
Cjgogo - 06.07.2013
Use SetTimerEx, if you want to make the timer separate for each player. This is the easiest way for newbies to learn, HOWEVER, I guess you can use "y_timers" if you wish(I am not sure however, just ****** it if you don't like this way).
pawn Код:
new countn1[MAX_PLAYERS];
new counttimer1[MAX_PLAYERS];
forward TimerWithText(playerid);
public OnPlayerSpawn(playerid)
{
countn1[playerid]=10;
counttimer[playerid]=SetTimerEx("TimerWithText",1000,true,"i",playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(countn1[playerid]!=0)
KillTimer(counttimer1[playerid]);
return 1;
}
public TimerWithText(playerid)
{
new string[128];
format(string,"%d second(s) left until the timer reaches 0!", countn1[playerid]);
GameTextForPlayer(playerid,string,2000,4);
if(countn1[playerid]!=0)
countn1[playerid]--;
else
KillTimer(counttimer1[playerid]);
return 1;
}
Re: Help SetTimer -
nickyW - 06.07.2013
I did not understand you, but I will try to help you.
pawn Код:
new GameTextTimer;
forward GameTextTimer();
public OnGameModeInit() {
GameTextTimer = SetTimer("GameText", 2000, true); // the timer will checks every two seconds.
}
public GameTextTimer() {
for(new id=0;id<MAX_PLAYERS;id++) {
GameTextForPlayer(playerid, "Your message here", 3000, 5);
}
}
EDIT: I did not saw the previous post, sorry.
Re: Help SetTimer -
Cjgogo - 06.07.2013
Quote:
Originally Posted by nickyW
I did not understand you, but I will try to help you.
//GameTextForPlayer with timer
pawn Код:
new GameTextTimer; forward GameTextTimer();
public OnGameModeInit() { GameTextTimer = SetTimer("GameText", 2000, true); // the timer will checks every two seconds. }
public GameTextTimer() { for(new id=0;id<MAX_PLAYERS;id++) { GameTextForPlayer(playerid, "Your message here", 3000, 5); } }
EDIT: I did not saw the previous post, sorry.
|
It's OK man, I also didn't really understand what he said, maybe you got it right, MAYBE I did, it's always better to have multiple different choices, and he will pick the one he wishes.
Re: Help SetTimer -
xganyx - 06.07.2013
you guys don't understand me ? it's like trucker job. when i loadtruck it have a time it's 10 second and the gametext will countdown 10, 9, 8, 7, 6, ....
Re: Help SetTimer -
nickyW - 06.07.2013
pawn Код:
new CountDownTime = 10; // 10 seconds, countdown
new Timer;
forward Timer(playerid);
public Timer(playerid)
{
new string[128];
CountDownTime--;
if(CountDownTime == 0) {
KillTimer(Timer);
CountDownTime= 4;
} else
{
format(string, sizeof(string), "%d", CountDownTime);
GameTextForPlayer(playerid, string, 1000, 1);
}
return 1;
}
Place this there where the timer must to start
Timer = SetTimer("CountDownTime", 1000, false);
Re: Help SetTimer -
xganyx - 06.07.2013
Quote:
Originally Posted by nickyW
pawn Код:
new CountDownTime = 10; // 10 seconds, countdown new Timer; forward Timer(playerid);
public Timer(playerid) { new string[128]; CountDownTime--; if(CountDownTime == 0) { KillTimer(Timer); CountDownTime= 4; } else { format(string, sizeof(string), "%d", CountDownTime); GameTextForPlayer(playerid, string, 1000, 1); } return 1; }
Place this there where the timer must to start
Timer = SetTimer("CountDownTime", 1000, false);
|
not work ingame i'm just type the command to settimer and don't have any text.
PS: have you try to compiler it ?
Re: Help SetTimer -
nickyW - 06.07.2013
Oh, sorry. I was sleeping xD
pawn Код:
new Time = 10;
new Timer;
forward Countdown(playerid);
public Countdown(playerid) {
new string[128];
Time--;
if(Time == 0)
{
Time = 10;
KillTimer(Timer);
} else {
format(string, sizeof(string), "%d", Timer);
GameTextForPlayer(playerid, string, 1000, 1);
}
return 1;
}
Timer = SetTimer("Countdown", 1000, false); - This must to be added in your loadtruck command. If it does not working again, give me your loadtruck command.
Re: Help SetTimer -
xganyx - 07.07.2013
Quote:
Originally Posted by nickyW
Oh, sorry. I was sleeping xD
pawn Код:
new Time = 10; new Timer; forward Countdown(playerid);
public Countdown(playerid) { new string[128]; Time--; if(Time == 0) { Time = 10; KillTimer(Timer); } else { format(string, sizeof(string), "%d", Timer); GameTextForPlayer(playerid, string, 1000, 1); } return 1; }
Timer = SetTimer("Countdown", 1000, false); - This must to be added in your loadtruck command. If it does not working again, give me your loadtruck command.
|
don't work when i type the command it have a gametext but only 1 number is : 2.
then it disappeared
Re: Help SetTimer -
xganyx - 07.07.2013
any help please... i'm very need this.