14.12.2010, 17:31
Welcome Canna
Many people say that but its not an excuse -_-
By the way there is the MIGHTY ****** translator
so you have a "Durst" variable (playerbased ? I suppose)
and a textdraw which shows it
Now our timer, we just start him if the gamemode starts
We add our textdraw at OnPlayerConnect with TextDrawCreate
And destroy it at OnPlayerDisconnect
Now our timer code
Many people say that but its not an excuse -_-
By the way there is the MIGHTY ****** translator
Quote:
I have a TextDraw with "Durst" and a String and a Timer.
And the TextDraw soll "Durst: 1- 100 %". Wie? Canna |
and a textdraw which shows it
pawn Код:
new Durst[MAX_PLAYERS] = {100, ...}; //Sets the whole array to 100
new Text:t_Durst[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...};
pawn Код:
//OnGameModeInit
SetTimer("Thirsty", 30 * 1000, true); //All 30 seconds
And destroy it at OnPlayerDisconnect
pawn Код:
//OnPlayerConnect
t_Durst[playerid] = TextDrawCreate(0.0, 0.0, "_");
//You can change the font and so on with the function on the bottom of the TextDrawCreate page
pawn Код:
//OnPlayerDisconnect
TextDrawDestroy(t_Durst[playerid]);
t_Durst[playerid] = Text:INVALID_TEXT_DRAW;
pawn Код:
forward Thirsty();
public Thirsty()
{
for(new i, string[16], Float:health; i != MAX_PLAYERS; i++)
{
if(t_Durst[i] != (Text:INVALID_TEXT_DRAW))
{
if(Durst[i] > 0.0)
{
Durst[i] --;
format(string, sizeof string, "Durst: %d%%", Durst[i]);
TextDrawSetString(t_Durst[i], string);
} else {
GetPlayerHealth(i, health);
SetPlayerHealth(i, (health - 1.0));
TextDrawSetString(t_Durst[i], "Durst: 0%");
}
}
}
}