06.03.2014, 02:20
Hello. I'm currently developing a hunger system. I have a timer which will start the round, and when the timer is called I want it to immediately show the text draw. But for some reason, it's not.
I also have another timer for the "Hunger Textdraw" which will decrease it's variable by 1 every 30 seconds. Would this be interfering with the Show text draw?
I also have another timer for the "Hunger Textdraw" which will decrease it's variable by 1 every 30 seconds. Would this be interfering with the Show text draw?
pawn Code:
forward HungerTimer(playerid);
public HungerTimer(playerid)
{
format(hungerstring,sizeof(hungerstring), "Hunger: %d", hunger[playerid]);
TextDrawSetString(Textdraw3, hungerstring);
hunger[playerid]--;
return 1;
}
pawn Code:
forward RoundStartTimer(playerid);
public RoundStartTimer(playerid)
{
if(LobbyCount > 1)
{
for(new i; i != GetMaxPlayers(); i++)
{
if(IsPlayerReady[i])
{
SetTimerEx("HungerTimer", 30000, true, "i", i);
SetPlayerTeam(i, NO_TEAM);
new rand = random(sizeof(rSpawns));
SetPlayerPos(i, rSpawns[rand][0], rSpawns[rand][1], rSpawns[rand][2]);
SetCameraBehindPlayer(i);
GameProgress = true;
LobbyCount = 0;
TogglePlayerControllable(i, 1);
hunger[i] = 100;
TextDrawSetString(Textdraw3, hungerstring);
TextDrawShowForPlayer(i, Textdraw3);
}
}
new string[128];
format(string,sizeof(string), "Total players: %d.", players);
SendClientMessageToAll(COLOR_GREY, string);
ShowNameTags(0);
SendClientMessage(playerid, COLOR_GREEN, "The Hunger games is prepairing to start, please be patient... (Name tags disabled)");
}
return 1;
}