06.07.2013, 12:49
i have a settimer and i want the GameText About The Time How Do I Make That ?
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;
}
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);
}
}
I did not understand you, but I will try to help you.
//GameTextForPlayer with timer 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;
}
pawn Код:
Place this there where the timer must to start Timer = SetTimer("CountDownTime", 1000, false); |
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;
}
Oh, sorry. I was sleeping xD
pawn Код:
|