Hi guys.
I was wondering, could someone show me an example, how to make this plugin sort players showing in the HUD msg, by HP? I cant understand it at all..
Code:
#include <amxmodx>
#include <cstrike>
#include <colorchat>
#pragma semicolon 1
public plugin_init()
{
register_plugin("Show info after death", "1.0", "JocA");
register_clcmd( "say /showhp", "HPInfo" );
}
public HPInfo( id )
{
new players[32], brojigraca, name[32], player;
new ctinfo[500], tinfo[500], ctlen, tlen;
get_players( players, brojigraca, "ah" );
for ( new i = 0; i < brojigraca; i++ )
{
player = players[i];
get_user_name( player, name, 31 );
new user_health = get_user_health( player );
switch ( cs_get_user_team( player ) )
{
case CS_TEAM_CT: ctlen += formatex( ctinfo[ctlen], charsmax(ctinfo) - ctlen, "%s - %d^n", name, user_health );
case CS_TEAM_T: tlen += formatex( tinfo[tlen], charsmax(tinfo) - tlen, "%s - %d^n", name, user_health );
}
}
set_hudmessage( 0, 50, 255, 0.06, 0.6, 0, 0.0, 3.1, 0.0, 0.0, -1 );
show_hudmessage( id, ctinfo );
set_hudmessage( 255, 40, 0, 0.7, 0.6, 0, 0.0, 3.1, 0.0, 0.0, -1 );
show_hudmessage( id, tinfo );
set_task( 3.0, "HPcInfo", id );
return PLUGIN_CONTINUE;
}
__________________