25.07.2015, 00:53
Normally you do it like that, you use a global variable, create the textdraw somewhere at the beginning (= OnGameModeInit), show it to everyone if they connect and update it where you want it (we want it to be if the kill variable change = OnPlayerDeath)
You don't need timers, just use OnPlayerDeath ... because it is the only place where you increase rKills, isn't it?
If you update it anywhere else (for example if a new round starts) just update the textdraw there likewise
Also there is something wrong with your code "roundstats[playerid][rKills]++;", additionally there is no need to pVars at all
pawn Код:
// globally
new Text: gKillText;
// OnGameModeInit
gKillText = TextDrawCreate(320.0, 240.0, "~r~Highest Kills~n~~w~Noone");
// OnPlayerConnect
TextDrawShowForPlayer(playerid, gKillText);
// OnPlayerDeath
if(killerid != INVALID_PLAYER_ID || killerid != playerid)
{
// CODE
new string[128];
GetPlayerName(GetHighestKiller(), string, MAX_PLAYER_NAME);
format(string, sizeof string, "~r~Highest Kills~n~~w~%s", string);
TextDrawSetString(gKillText, string);
}
If you update it anywhere else (for example if a new round starts) just update the textdraw there likewise
Also there is something wrong with your code "roundstats[playerid][rKills]++;", additionally there is no need to pVars at all