07-28-2024, 11:14 PM
Description: A simple plugin that shows at the end of the map who has won it.
Code:
#include <amxmodx>
public plugin_init()
{
register_plugin("Winner", "1.0", "sToP !")
initial_function()
}
initial_function()
{
new variable
variable = get_cvar_num("mp_timelimit")
set_task(60.0 * variable, "main_function")
}
public main_function()
{
new frags, deaths, score
new max, winner_id
new winner[32]
frags = get_user_frags(1)
deaths = get_user_deaths(1)
score = frags - deaths
max = score
winner_id = 1
for(new id = 2; id <= get_playersnum(); id++)
{
frags = get_user_frags(id)
deaths = get_user_deaths(id)
score = frags - deaths
if( score > max)
{
max = score
winner_id = id
}
}
get_user_name(winner_id, winner, charsmax(winner))
client_print(0, print_chat, "[HL.DM20.NET] Winner is %s with score %d!", winner, max)
return PLUGIN_HANDLED
}