1.В момента е със set_dhudmessage искам да се промени да е с set_hudmessage
set_dhudmessage( 255, 255, 255, -1.0, 0.01, 0, 0.0, 1.0, 0.1, 0.1, true )
show_dhudmessage
2.Да се центрира да излиза долу в средата.
Благодаря ви предварително.
Код за потвърждение: Избери целия код
#include <amxmodx>
#include <dhudmessage>
#define PLUGIN "Score HUD"
#define VERSION "1.0"
#define AUTHOR "AndrewZ"
enum _:SCORE_DATA
{
DISABLE,
KILLS,
HEADSHOTS,
KNIFEKILLS,
GRENADEKILLS,
DEATHS
}
new g_user_score[ 33 ][ SCORE_DATA + 1 ]
new g_maxplayers
new bool:g_reset_data
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR )
g_maxplayers = get_maxplayers()
register_clcmd( "say /score", "cmd_score" )
register_event( "DeathMsg", "event_death", "a" )
register_event( "TextMsg", "event_textmsg_restart", "a", "2=#Game_will_restart_in" )
register_logevent( "logevent_game_commencing", 2, "1=Game_Commencing" )
register_logevent( "logevent_round_start", 2, "1=Round_Start" )
set_task( 1.0, "rtask_show_hud", _, _, _, "b" )
}
public cmd_score( id )
{
if( g_user_score[ id ][ DISABLE ] )
{
g_user_score[ id ][ DISABLE ] = 0
client_print( id, print_chat, "HUD Statistics informer is on" )
}
else
{
g_user_score[ id ][ DISABLE ] = 1
client_print( id, print_chat, "HUD Statistics informer is off." )
}
return PLUGIN_HANDLED
}
public clear_data( id )
{
if( !id )
{
for( new i = 1; i <= g_maxplayers; i ++ )
{
for( new data; data <= SCORE_DATA; data ++ )
g_user_score[ i ][ data ] = 0
}
}
else
{
for( new data; data <= SCORE_DATA; data ++ )
g_user_score[ id ][ data ] = 0
}
}
public client_connect( id ) clear_data( id )
public client_disconnect( id ) clear_data( id )
public logevent_game_commencing() clear_data( 0 )
public event_textmsg_restart() g_reset_data = true
public logevent_round_start()
{
if( g_reset_data )
{
clear_data( 0 )
g_reset_data = false
}
}
public event_death()
{
new killer = read_data( 1 )
new victim = read_data( 2 )
new headshot = read_data( 3 )
new weapon[ 12 ]; read_data( 4, weapon, 11 )
if( !is_user_connected( killer ) && !is_user_connected( victim ) )
return
if( killer == victim )
{
g_user_score[ victim ][ DEATHS ] ++
return
}
g_user_score[ killer ][ KILLS ] ++
if( headshot )
g_user_score[ killer ][ HEADSHOTS ] ++
if( equal( weapon, "knife" ) )
g_user_score[ killer ][ KNIFEKILLS ] ++
else if( equal( weapon, "grenade" ) )
g_user_score[ killer ][ GRENADEKILLS ] ++
g_user_score[ victim ][ DEATHS ] ++
}
public rtask_show_hud()
{
for( new id = 1; id <= g_maxplayers; id ++ )
{
if( !is_user_alive( id ) || g_user_score[ id ][ DISABLE ] )
continue
new Float:kd,
Float:k = float( g_user_score[ id ][ KILLS ] ),
Float:d = float( g_user_score[ id ][ DEATHS ] )
if( k && d )
kd = k / d
else kd = 0.0
set_dhudmessage( 255, 255, 255, -1.0, 0.01, 0, 0.0, 1.0, 0.1, 0.1, true )
show_dhudmessage
(
id, "Kills: %d | Headshots: %d | Knife kills: %d | Grenade kills: %d | Deaths: %d | К/D: %.2f",
g_user_score[ id ][ KILLS ],
g_user_score[ id ][ HEADSHOTS ],
g_user_score[ id ][ KNIFEKILLS ],
g_user_score[ id ][ GRENADEKILLS],
g_user_score[ id ][ DEATHS ],
kd
)
}
}