Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- The plugin constantly displays text at the top of the screen with the nickname of the best player.
- The best player is the one who has the most frags at the moment.
- [v1.1] - Shows only non-live players on the server.
- */
- #include <amxmodx>
- #define PLUGIN "Top Killer"
- #define VERSION "1.0.0"
- #define AUTHOR "CheezPuff"
- new const colors[] = {50, 200, 0} // rgb colors
- new const Float:FR_TASK = 1.9 // alert frequency
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR);
- set_task(FR_TASK - 0.1, "task_hud_info", 0, _, _, "b")
- }
- public task_hud_info()
- {
- static player, text_best_player[192], name[32]
- player = get_best_player_now()
- if(is_user_connected(player))
- {
- get_user_name(player, name, charsmax(name));
- formatex(text_best_player, charsmax(text_best_player), "%s %s [%d KILLS]", "BEST PLAYER:", name, get_user_frags(player))
- set_hudmessage(colors[0], colors[1], colors[2], -1.0, 0.15, 0, 0.0, FR_TASK, 0.0, 0.10, -1)
- new count, players[32]
- get_players(players, count, "bch")
- for(new i = 0; i < count; i++)
- {
- show_hudmessage(players[i], text_best_player)
- }
- }
- }
- public get_best_player_now()
- {
- new best_frags, the_best_player
- new count, players[32]
- get_players(players, count, "h") // not hltv
- for(new i = 0; i < count; i++)
- {
- new frags = get_user_frags(players[i])
- if(frags <= 0) continue;
- if(frags > best_frags)
- {
- best_frags = frags
- the_best_player = players[i]
- }
- // P.S. - if a pair of players has the same number of frags, that player will be the best.
- // whose id will be lower. Basically this is the player who previously connected to the server.
- }
- return the_best_player;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement