Kod:
#include <amxmodx>
#include <amxmisc>
#include <csstats>
#define HUD_INTERVAL 1.0
#define MAXRANKS 17
new PlayerRank[33]
new const rankNames[MAXRANKS][] =
{
"Onbasi",
"Cavus",
"Uzman",
"Astsubay",
"Astegmen",
"Tegmen",
"Ustegmen",
"Yuzbasi",
"Binbasi",
"Yarbay",
"Albay",
"Tuggeneral",
"Tumgeneral",
"Korgeneral",
"Genelkurmay",
"Maresal",
"EFSANE LIDER"
}
// Kill = XP
new const rankXP[MAXRANKS] =
{
0,
50,
100,
200,
350,
500,
750,
1000,
1500,
2200,
3000,
4000,
5000,
6500,
8000,
9000,
10000 // SON RÜTBE
}
public plugin_init()
{
register_plugin("Rank System", "1.0", "ChatGPT")
// Chat yakalama
register_clcmd("say", "HookSay")
register_clcmd("say_team", "HookSay")
}
public client_putinserver(id)
{
set_task(HUD_INTERVAL, "ShowHUD", id)
}
public ShowHUD(id)
{
if(!is_user_connected(id))
return
static stats[8], hits[8]
get_user_stats(id, stats, hits)
new xp = stats[0] // kill = XP
new currentRank = 0
while(currentRank < MAXRANKS - 1)
{
if(xp >= rankXP[currentRank + 1])
currentRank++
else
break
}
PlayerRank[id] = currentRank
new nextXP = rankXP[currentRank]
if(currentRank < MAXRANKS - 1)
nextXP = rankXP[currentRank + 1]
set_hudmessage(150, 50, 255, 0.30, 0.91, 2, 0.0, 1.5)
show_hudmessage(id,
"Level: %d | Rutbe: %s | XP: %d",
currentRank,
rankNames[currentRank],
xp)
set_task(HUD_INTERVAL, "ShowHUD", id)
}
public HookSay(id)
{
if(!is_user_connected(id))
return PLUGIN_CONTINUE;
new message[192];
read_args(message, charsmax(message));
remove_quotes(message);
if(!message[0])
return PLUGIN_HANDLED;
new name[32];
get_user_name(id, name, charsmax(name));
new rank = PlayerRank[id];
// Admin kontrolü
new bool:isAdmin = (get_user_flags(id) & ADMIN_KICK) ? true : false;
if(isAdmin)
{
// Admin yeşil yazı
client_print_color(0, id,
"^4[%s] ^3%s ^1: %s",
rankNames[rank],
name,
message);
}
else
{
// Normal oyuncu
client_print_color(0, id,
"^3[%s] %s ^1: %s",
rankNames[rank],
name,
message);
}
return PLUGIN_HANDLED;
}
Bir daha denermisin hocam.