Quote:
Originally Posted by zmd94
New update!
When someone enter your server, they will get a hud message that displayed their current ranking. ;)
The hud message come with colorful message. Feel free to use it.
|
PHP Code:
#include amxmodx
#include csstats
new name[32]
const SHOW_TYPE = 1 // 1 - Show Hud | 2 - Show Chat
new const typecmd [][] =
{
"say /rank",
"say rank"
}
public plugin_init()
{
for(new cmd = 0; cmd < sizeof typecmd; cmd++)
{
register_clcmd(typecmd[cmd], "cmdrank")
}
}
public cmdrank(Player)
{
static stats[8], body[8]
static Deaths = 0, Kills = 0, Float:Ratio = 0.0
new position = get_user_stats(Player, stats, body)
new totalposition = get_statsnum()
get_user_name(Player, name, charsmax(name))
Deaths = stats[1]
Kills = stats[0]
Ratio = Deaths == 0 ? (float(Kills)) : (float(Kills) / float(Deaths))
switch(SHOW_TYPE)
{
case 1: // Hud
{
set_hudmessage(42, 255, 42, 0.27, 0.83, 1, 0.0, 3.0, 2.0, 1.0, -1)
ShowSyncHudMsg(Player, CreateHudSyncObj(), "%s You have rank %d/%d^nKills: %d Deaths: %d^nKPD: %.2f", name, totalposition, position, stats[0], stats[1], Ratio)
}
case 2: // Chat
{
client_print(Player, print_chat, "%s You have rank %d/%d. With Kills: %d Deaths: %d KPD: %.2f", name, totalposition, position, stats[0], stats[1], Ratio)
}
}
}
Me old version.
__________________