28.06.2014, 05:03
A good textdraw design for : Stats: Kills/Deaths/Score , i'v tried to make and its worked but after few hours it keep disappearing with out anyreasn, i was using functions under onplayerupdate , can you help me?
new Text:TEAM[MAX_PLAYERS]; new Text:SCORE[MAX_PLAYERS]; new Text:KILL[MAX_PLAYERS]; new Text:DEATH[MAX_PLAYERS]; public OnGameModeInit() { SetTimer("Status", 300, 1); for(new i = 0; i < MAX_PLAYERS; i++) { TEAM[i] = TextDrawCreate(495.000000, 118.000000, "_"); TextDrawBackgroundColor(TEAM[i], 255); TextDrawFont(TEAM[i], 1); TextDrawLetterSize(TEAM[i], 0.420000, 1.900000); TextDrawColor(TEAM[i], -1); TextDrawSetOutline(TEAM[i], 1); TextDrawSetProportional(TEAM[i], 1); SCORE[i] = TextDrawCreate(495.000000, 136.000000, "_"); TextDrawBackgroundColor(SCORE[i], 255); TextDrawFont(SCORE[i], 1); TextDrawLetterSize(SCORE[i], 0.420000, 1.900000); TextDrawColor(SCORE[i], -1); TextDrawSetOutline(SCORE[i], 1); TextDrawSetProportional(SCORE[i], 1); KILL[i] = TextDrawCreate(495.000000, 156.000000, "_"); TextDrawBackgroundColor(KILL[i], 255); TextDrawFont(KILL[i], 1); TextDrawLetterSize(KILL[i], 0.420000, 1.900000); TextDrawColor(KILL[i], -1); TextDrawSetOutline(KILL[i], 1); TextDrawSetProportional(KILL[i], 1); DEATH[i] = TextDrawCreate(495.000000, 175.000000, "_"); TextDrawBackgroundColor(DEATH[i], 255); TextDrawFont(DEATH[i], 1); TextDrawLetterSize(DEATH[i], 0.420000, 1.900000); TextDrawColor(DEATH[i], -1); TextDrawSetOutline(DEATH[i], 1); TextDrawSetProportional(DEATH[i], 1); } return 1; } public OnGameModeExit() { for(new i = 0;i < MAX_PLAYERS; i++) { TextDrawDestroy(TEAM[i]); TextDrawDestroy(SCORE[i]); TextDrawDestroy(KILL[i]); TextDrawDestroy(DEATH[i]); } return 1; } public OnPlayerDisconnect(playerid, reason) { return 1; } public OnPlayerSpawn(playerid) { TextDrawShowForPlayer(playerid, TEAM[playerid]); TextDrawShowForPlayer(playerid, SCORE[playerid]); TextDrawShowForPlayer(playerid, KILL[playerid]); TextDrawShowForPlayer(playerid, DEATH[playerid]); return 1; } forward Status(playerid); public Status(playerid) { new String[256]; format(String, sizeof(String), "Team: %s"); TextDrawSetString(TEAM[playerid], String); format(String, sizeof(String), "Score: %d"); TextDrawSetString(SCORE[playerid], String); format(String, sizeof(String), "Kills: %d"); TextDrawSetString(KILL[playerid], String); format(String, sizeof(String), "Deaths: %d"); TextDrawSetString(DEATH[playerid], String); }