|
发表于 2015-4-27 14:56:56
|
显示全部楼层
|阅读模式
来自 中国–吉林–吉林市
小弟偶得一插件,希望高人能帮助编译成中文,无尽感谢
#include <amxmodx>
#include <amxmisc>
#include <csstats>
#define HUD_INTERVAL 1.0
#define RANK_Just_Joined 0
#define RANK_PRIVATE 1
#define RANK_PRIVATE_FIRST_CLASS 2
#define RANK_CORPORAL 3
#define RANK_SERGEANT 4
#define RANK_STAFF_SERGEANT 5
#define RANK_GUNNERY_SERGEANT 6
#define RANK_MASTER_SERGEANT 7
#define RANK_COMMAND_SERGEANT 8
#define RANK_SECOND_LIEUTENANT 9
#define RANK_FIRST_LIEUTENANT 10
#define RANK_COLONEL 11
#define RANK_BRIGADIER_GENERAL 12
#define RANK_MAJOR_GENERAL 13
#define RANK_LIEUTENANT_GENERAL 14
#define RANK_GENERAL 15
#define RANK_GENERAL_OF_THE_ARMY 16
#define MAXRANKS 17
new PlayerRank[33]
new const RANKS[MAXRANKS][] =
{
"Just Joined",
"Private",
"Private First Class",
"Corporal",
"Sergeant",
"Staff Sergeant",
"Gunnery Sergeant",
"Master Sergeant",
"Command Sergeant",
"Second Lieutenant",
"First Lieutenant",
"Colonel",
"Brigadier General",
"Major General",
"Lietenant General",
"General",
"General of the Army"
}
public plugin_init()
{
register_plugin("Rank Display", "1.0", "Kensai")
register_cvar("sv_mranks","1")
}
public client_putinserver(id)
{
set_task(HUD_INTERVAL, "ShowHUD", id)
if(get_cvar_num("sv_mranks")==0)
{
return PLUGIN_HANDLED
}
return 0
}
public ShowHUD(id)
{
if(!is_user_connected(id))
return 0
new stats[8]
new hits[8]
get_user_stats(id, stats, hits)
new name[33]
get_user_name(id, name, 32)
if(stats[0] < 100)
{
PlayerRank[id] = RANK_Just_Joined
}
if(stats[0] >= 100 || stats[0] <= 200)
{
PlayerRank[id] = RANK_PRIVATE
}
if(stats[0] >= 201 || stats[0] <= 400)
{
PlayerRank[id] = RANK_PRIVATE_FIRST_CLASS
}
if(stats[0] >= 401 || stats[0] <= 800)
{
PlayerRank[id] = RANK_CORPORAL
}
if(stats[0] >= 801 || stats[0] <= 1000)
{
PlayerRank[id] = RANK_SERGEANT
}
if(stats[0] >= 1001 || stats[0] <= 2000)
{
PlayerRank[id] = RANK_STAFF_SERGEANT
}
if(stats[0] >= 2001 || stats[0] <= 4000)
{
PlayerRank[id] = RANK_GUNNERY_SERGEANT
}
if(stats[0] >= 4001 || stats[0] <= 8000)
{
PlayerRank[id] = RANK_MASTER_SERGEANT
}
if(stats[0] >= 8001 || stats[0] <= 10000)
{
PlayerRank[id] = RANK_COMMAND_SERGEANT
}
if(stats[0] >= 10001 || stats[0] <= 12000)
{
PlayerRank[id] = RANK_SECOND_LIEUTENANT
}
if(stats[0] >= 12001 || stats[0] <= 15000)
{
PlayerRank[id] = RANK_FIRST_LIEUTENANT
}
if(stats[0] >= 15001 || stats[0] <= 20000)
{
PlayerRank[id] = RANK_COLONEL
}
if(stats[0] >= 20001 || stats[0] <= 40000)
{
PlayerRank[id] = RANK_BRIGADIER_GENERAL
}
if(stats[0] >= 40001 || stats[0] <= 50000)
{
PlayerRank[id] = RANK_MAJOR_GENERAL
}
if(stats[0] >= 50001 || stats[0] <= 80000)
{
PlayerRank[id] = RANK_LIEUTENANT_GENERAL
}
if(stats[0] >= 80001 || stats[0] <= 100000)
{
PlayerRank[id] = RANK_GENERAL
}
if(stats[0] >= 100001)
{
PlayerRank[id] = RANK_GENERAL_OF_THE_ARMY
}
set_hudmessage(237, 245, 9, 0.0, 0.6, 0, 6.0, 12.0)
show_hudmessage(id, "[%s - %s] Kills: %i", name, RANKS[PlayerRank[id]], stats[0])
set_task(HUD_INTERVAL, "ShowHUD", id)
return 0
}
|
|