No I did not. I waned to use one function for all. I saw this kind of work in many plugins, but I dont't know results in them.
If this is normal behaviour I will format message for each player and display separately.
Will the message be formated this way than:
Code:
public showTimeVoteResults(){
new players[32];
new num;
get_players(players, num, "ch");
new result = get_pcvar_num(gCvarTimeVoteResults);
if(get_pcvar_num(gCvarTimeVoteWin) != 2 && result == 3)
result = 1;
for(new i=0;i<num;i++)
showTimeVoteResultsForPlayer(players[i], result);
if(!mapTimeVoteEnd){
set_task(0.5, "showTimeVoteResults");
}
}
public showTimeVoteResultsForPlayer(id, result) {
new t;
new msg[256];
new item[32];
switch(result){
case 0: return;
case 1:{
for(new i=0;i<mapTimesCount;i++){
t = mapTimes[i];
formatex(item, charsmax(item), "%d %L [%d]^n", t, id, LANG_PLAYER, "MINUTES", mapTimesVotes[i]);
add(msg, charsmax(msg), item);
}
}
case 2: {
new itm1 = -1, itm1count=-1, idx1, idx2, itm2=-1,itm2count=-1;
getTop2(mapTimes, mapTimesVotes, mapTimesCount, itm1, idx1,itm1count,itm2,idx2, itm2count);
formatex(item, charsmax(item), "%d %L [%d]^n", itm1, id, LANG_PLAYER, "MINUTES", itm1count);
add(msg, charsmax(msg), item);
formatex(item, charsmax(item), "%d %L [%d]", itm2, id, LANG_PLAYER, "MINUTES", itm2count);
add(msg, charsmax(msg), item);
}
case 3:{
new sum = 0;
for(new i =1;i<mapTimesCount;i++){
sum += mapTimesVotes[i] * mapTimes[i];
}
new num = getRealPlayersnum();
formatex(msg, charsmax(msg), "%d %L", floatround(float(sum)/ float(num)), id, LANG_PLAYER, "MINUTES");
}
}
trim(msg);
set_hudmessage(255, 0, 0, 0.01, 0.14, 0, 6.0, 1.0);
ShowSyncHudMsg(id, gHudCenteredMsg, msg);
}
Or should it be formated in other way ?
Can I use one SyncHudObject for all players?