1.INFO_DRISS_PLAYER
Код за потвърждение: Избери целия код
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <csstats>
#include <csx>
#define PLUGIN "Show Rank"
#define VERSION "1.0"
#define AUTHOR "Driss (Go Svoi)"
#define ID_SHOWHUD (taskid - TASK_SHOWHUD)
enum {
INT_STATS_KILLS = 0,
INT_STATS_DEATHS
};
enum (+= 100)
{
TASK_SHOWHUD
};
const PEV_SPEC_TARGET = pev_iuser2 // Traget Spectating
new g_player_name
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_player_name = register_cvar("ds_player_name", "1") // on/off
// Chat Hook Rank Or /Rank
register_clcmd( "say", "Chat_Player_Rank" );
register_clcmd( "say_team", "Chat_Player_Rank" );
// Hud Player Name + Rank
register_event("StatusValue","show_status_player","be","1=2","2!0")
// Language files
register_dictionary("Driss_rank.txt")
}
public Chat_Player_Rank(id)
{
static STRING_ARGUMENT[ 11 ];
read_argv( 1, STRING_ARGUMENT, charsmax( STRING_ARGUMENT ) );
if( equali( STRING_ARGUMENT, "rank" ) || equali( STRING_ARGUMENT, "/rank" ) )
{
new INT_RANK_POS, STRING_STATS[ 8 ], STRING_BODY[ 8 ], STRING_NAME[ 32 ];
INT_RANK_POS = get_user_stats( id, STRING_STATS, STRING_BODY );
get_user_name( id, STRING_NAME, charsmax( STRING_NAME ) );
print_chatColor(0, "%L",LANG_PLAYER, "CHAT_INFO" ,STRING_NAME, INT_RANK_POS, get_statsnum( ) , STRING_STATS[ INT_STATS_KILLS ], STRING_STATS[ INT_STATS_DEATHS ],
float( STRING_STATS[ INT_STATS_KILLS ] ) * 1.002 / float( STRING_STATS[ INT_STATS_DEATHS ] ) * 1.002 * 30.346647 );
client_cmd( id, "spk items/medshotno1.wav" );
}
}
public client_putinserver(id)
{
if (!is_user_bot(id))
{
// Set the custom HUD display task
set_task(1.0, "ShowHUD", id+TASK_SHOWHUD, _, _, "b")
}
}
public ShowHUD(taskid)
{
static id
new INT_RANK_POS, STRING_STATS[ 8 ], STRING_BODY[ 8 ], STRING_NAME[ 32 ];
INT_RANK_POS = get_user_stats( id, STRING_STATS, STRING_BODY );
get_user_name( id, STRING_NAME, charsmax( STRING_NAME ) );
id = ID_SHOWHUD;
// Player died?
if (!is_user_alive(id))
{
// Get spectating target
id = pev(id, PEV_SPEC_TARGET)
// Target not alive
if (!is_user_alive(id))return;
}
static red, green, blue
if (cs_get_user_team(id) == CS_TEAM_T) // Terrorest
{
red = 255
green = 0
blue = 0
}
else // CT
{
red = 0
green = 255
blue = 0
}
if (id != ID_SHOWHUD)
{
set_hudmessage(255, 0, 255, -1.0, 0.80, 0, 7.0, 1.2)
show_hudmessage(ID_SHOWHUD,"%L",LANG_PLAYER, "SPECTATING_PLAYER", STRING_NAME, INT_RANK_POS, get_statsnum( ) , STRING_STATS[ INT_STATS_KILLS ], STRING_STATS[ INT_STATS_DEATHS ],
float( STRING_STATS[ INT_STATS_KILLS ] ) * 1.002 / float( STRING_STATS[ INT_STATS_DEATHS ] ) * 1.002 * 30.346647 );
}
else
{
set_hudmessage(red, green, blue, -1.0, 0.91, 0, 7.0, 1.2)
show_hudmessage(ID_SHOWHUD,"%L",LANG_PLAYER,"ON_PLAYER", INT_RANK_POS, get_statsnum( ), STRING_STATS[ INT_STATS_KILLS ], STRING_STATS[ INT_STATS_DEATHS ],
float( STRING_STATS[ INT_STATS_KILLS ] ) * 1.002 / float( STRING_STATS[ INT_STATS_DEATHS ] ) * 1.002 * 30.346647 );
}
}
public show_status_player(id)
{
new name[32],pid = read_data(2)
get_user_name(pid,name,31)
new INT_RANK_POS, STRING_STATS[ 8 ], STRING_BODY[ 8 ], STRING_NAME[ 32 ];
INT_RANK_POS = get_user_stats( pid, STRING_STATS, STRING_BODY );
get_user_name( pid, STRING_NAME, charsmax( STRING_NAME ) );
if (!(cs_get_user_team(pid) == CS_TEAM_T) && !(cs_get_user_team(id) == CS_TEAM_T) && (get_pcvar_num(g_player_name) == 1) )
{
set_hudmessage(153,50,204, -1.0, 0.60, 2, 0.05, 0.1, 0.01, 01.0, -1);
show_hudmessage(id, "%L",LANG_PLAYER, "INFO_DRISS_PLAYER", name, INT_RANK_POS, get_statsnum( ) , STRING_STATS[ INT_STATS_KILLS ], STRING_STATS[ INT_STATS_DEATHS ],
float( STRING_STATS[ INT_STATS_KILLS ] ) * 1.002 / float( STRING_STATS[ INT_STATS_DEATHS ] ) * 1.002 * 30.346647 );
}
if((cs_get_user_team(id) == CS_TEAM_T) && (cs_get_user_team(pid) == CS_TEAM_T) && (get_pcvar_num(g_player_name) == 1))
{
set_hudmessage(255,0,0,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, -1);
show_hudmessage(id, "%L",LANG_PLAYER,"INFO_DRISS_PLAYER", name, INT_RANK_POS, get_statsnum( ) , STRING_STATS[ INT_STATS_KILLS ], STRING_STATS[ INT_STATS_DEATHS ],
float( STRING_STATS[ INT_STATS_KILLS ] ) * 1.002 / float( STRING_STATS[ INT_STATS_DEATHS ] ) * 1.002 * 30.346647 );
}
}
stock print_chatColor(const id,const input[], any:...)
{
new msg[191], players[32], count = 1;
vformat(msg,190,input,3);
replace_all(msg,190,"!g","^x04");// green
replace_all(msg,190,"!n","^x01");// normal
replace_all(msg,190,"!t","^x03");// team
if (id) players[0] = id; else get_players(players,count,"ch");
for (new i=0;i<count;i++)
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}