diff --git a/scorehud.sma b/scorehud.sma new file mode 100644 index 0000000..594d3c3 --- /dev/null +++ b/scorehud.sma @@ -0,0 +1,57 @@ +#include +#include +#include + +new TerrScore = 0, CTScore = 0; +new rounds_elapsed = 0; +new g_maxplayers; + +public plugin_init() +{ + register_plugin("Team Score HUD", "1.0", "bacalhau"); + + register_event("TeamScore", "terr_score", "a", "1=TERRORIST"); + register_event("TeamScore", "ct_score", "a", "1=CT"); + register_event("HLTV", "new_round", "a", "1=0", "2=0"); + register_event("TextMsg", "restart_round", "a", "2=#Game_will_restart_in"); + + // Obter número máximo de jogadores + g_maxplayers = get_maxplayers(); + + // Mostrar pontuações no HUD + set_task(2.0, "show_scores"); +} + +public new_round() +{ + // increase on new round + rounds_elapsed += 1; +} + +public restart_round() +{ + // reset round + rounds_elapsed = 0; +} + +public terr_score() +{ + // T score update + TerrScore = read_data(2); +} + +public ct_score() +{ + // CT score update + CTScore = read_data(2); +} + +public show_scores() +{ + // HUD config + set_hudmessage(0, 100, 255, -1.0, 0.03, _, _, 2.0, _, _, -1); + show_hudmessage(0, "|T %i| [Round %d] |%i CT|", TerrScore, rounds_elapsed, CTScore); + + // show score + set_task(2.0, "show_scores"); +}