PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fun>
#include <cstrike>
#include <fakemeta_util>
new xs__ITaskId = 72;
new xs__ITaskParam[1033] =
{
72, 97, 109, 70, 105, 108, 116, 101, 114, 0, 132, 256, 380, 504, 628, 752, 876, 1000, 1124, 1248, 1372, 1496, 1620, 1744, 1868, 1992, 2116, 2240, 2364, 2488, 2612, 2736, 2860, 2984, 3108, 3232, 3356, 3480, 3604, 3728, 3852, 3976, 4100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
new xs__TaskFlags[5] =
{
72, 97, 109, 70, 105
};
new xs__TaskFunc[48] =
{
72, 97, 109, 70, 105, 108, 116, 101, 114, 0, 132, 256, 380, 504, 628, 752, 876, 1000, 1124, 1248, 1372, 1496, 1620, 1744, 1868, 1992, 2116, 2240, 2364, 2488, 2612, 2736, 2860, 2984, 3108, 3232, 3356, 3480, 3604, 3728, 3852, 3976, 4100, 0, 0, 0, 0, 0
};
new xs__TaskId = 72;
new Float:xs__TaskInterval = 72;
new xs__TaskParam[1033] =
{
72, 97, 109, 70, 105, 108, 116, 101, 114, 0, 132, 256, 380, 504, 628, 752, 876, 1000, 1124, 1248, 1372, 1496, 1620, 1744, 1868, 1992, 2116, 2240, 2364, 2488, 2612, 2736, 2860, 2984, 3108, 3232, 3356, 3480, 3604, 3728, 3852, 3976, 4100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
new xs__TaskRepeat = 72;
new xs__global_null = 72;
new xs__internalseed = 72;
new xs__logtypenames[6][0] =
{
{
1124, ...
},
{
1140850695, ...
},
{
872415241, ...
},
{
98041856, ...
},
{
-1342177270, ...
},
{
2860, ...
}
};
new xs__maxnum = 72;
new String:xs__replace_buf[12288] = "HamFilter";
new g_playername[33][32];
new SayText;
new g_level[32];
new g_level_data;
new g_frags_level;
new g_ScreenFade;
new g_level_del[33];
new g_level_bonus;
new g_level_max;
new g_level_num;
new g_level_info;
new g_levels[32];
new g_h_armor;
new level_exp[32];
new g_level_exp[32];
new g_exp_data;
new g_Players;
new nameid[32];
new h_armor[32];
new bool:g_bonus[32];
new g_trime[32];
new String:sound_level_up[84] = "misc/zp_level_up.wav";
new cvar_statssave;
replace_all(string[], len, what[], with[])
{
new pos;
if ((pos = contain(string, what)) == -1)
{
return 0;
}
new total;
new with_len = strlen(with);
new diff = strlen(what) - with_len;
new total_len = strlen(string);
new temp_pos;
while (replace(string[pos], len - pos, what, with))
{
total++;
pos = with_len + pos;
total_len -= diff;
if (!(pos >= total_len))
{
temp_pos = contain(string[pos], what);
if (!(temp_pos == -1))
{
pos = temp_pos + pos;
}
return total;
}
return total;
}
return total;
}
is_user_admin(id)
{
new __flags = get_user_flags(id, "%L");
new var1;
return __flags > 0 && !__flags & 33554432;
}
cmd_access(id, level, cid, num, bool:accesssilent)
{
new has_access;
new var1;
if (is_dedicated_server())
{
var1 = 0;
}
else
{
var1 = 1;
}
if (var1 == id)
{
has_access = 1;
}
else
{
if (level == 16777216)
{
if (is_user_admin(id))
{
has_access = 1;
}
}
if (level & get_user_flags(id, "%L"))
{
has_access = 1;
}
if (!level)
{
has_access = 1;
}
}
if (has_access)
{
if (num > read_argc())
{
new hcmd[32];
new hinfo[128];
new hflag;
get_concmd(cid, hcmd, 31, hflag, hinfo, 127, level, -1);
console_print(id, "%L: %s %s", id, "USAGE", hcmd, hinfo);
return 0;
}
return 1;
}
if (!accesssilent)
{
console_print(id, "%L", id, "NO_ACC_COM");
}
return 0;
}
fm_set_user_armor(index, armor)
{
set_pev(index, 47, float(armor));
return 1;
}
public __fatal_ham_error(Ham:id, HamError:err, reason[])
{
new func = get_func_id(xs__ITaskId, -1);
new bool:fail = 1;
new var1;
if (func != -1 && callfunc_begin_i(func, -1) == 1)
{
callfunc_push_int(id);
callfunc_push_int(err);
callfunc_push_str(reason, "%L");
if (callfunc_end() == 1)
{
fail = false;
}
}
if (fail)
{
set_fail_state(reason);
}
return 0;
}
public plugin_precache()
{
precache_sound(sound_level_up);
return 0;
}
public plugin_init()
{
g_frags_level = register_cvar("zp_level_frags", "10", "%L", "%L");
g_level_max = register_cvar("zp_level_max", "1000", "%L", "%L");
g_h_armor = register_cvar("zp_level_h_armor", 6020, "%L", "%L");
g_level_info = register_cvar("zp_level_info", 6084, "%L", "%L");
g_level_bonus = register_cvar("zp_level_bonus_on", 6164, "%L", "%L");
g_level_num = register_cvar("zp_level_number", 6236, "%L", "%L");
cvar_statssave = register_cvar("stats_save", 6288, "%L", "%L");
g_level_data = nvault_open("Leveling_Save");
g_exp_data = nvault_open("Exp_Save");
register_clcmd("say", "say_info", -1, 6440, -1);
register_clcmd("say_team", "say_info", -1, 6440, -1);
register_clcmd("xp_give", "expa_give", 1, "<Name> <xp>", -1);
register_clcmd("level_give", "level_give", 1, "<Name> <Level>", -1);
SayText = get_user_msgid("SayText");
g_Players = get_maxplayers();
register_event("HLTV", "Round_Start", 6884, "1=0", "2=0");
register_event("DeathMsg", "Frags_Manager", 7016, "1>0");
register_dictionary("zp_level_system_xp.txt");
register_event("StatusValue", "hide_status", "be", "1=1", "2=0");
register_event("StatusValue", "show_status", "be", "1=2", "2!0");
register_event("StatusValue", "show_status1", "be", "1=2", "2!0");
g_ScreenFade = get_user_msgid("ScreenFade");
register_plugin("\r[Gh[O]st] \yLevelUp System", "3.2", "Re.Act!ve");
return 0;
}
public plugin_natives()
{
register_native("zp_level_1", "native_zp_level_1", 1);
register_native("zp_level_exp", "native_zp_level_exp", 1);
register_native("zp_level_exp1", "native_zp_level_exp1", 1);
return 0;
}
public Round_Start()
{
new id = 1;
while (id <= g_Players)
{
set_task(1077936128, "Level", id, 8184, "%L", 8188, "%L");
id++;
}
return 0;
}
public Level(id)
{
if (is_user_alive(id))
{
g_trime[id] = 0;
new n = 1;
while (g_level[id] > n)
{
h_armor[id] = get_pcvar_num(g_h_armor) * n;
n += 1;
}
fm_set_user_armor(id, h_armor[id][get_user_armor(id)]);
}
return 0;
}
public show_status(id)
{
new name[32];
new pid = read_data(2);
get_user_name(pid, name, 31);
new idAiming;
new iBodyPart;
get_user_aiming(id, idAiming, iBodyPart, 9999);
new var1;
if (is_user_alive(idAiming) && is_user_alive(id))
{
new var2;
if (cs_get_user_team(id, 0) == 2 && cs_get_user_team(idAiming, 0) == 2)
{
set_hudmessage(255, 128, 64, -1082130432, 1058642330, 2, 1028443341, 1036831949, 1008981770, 1065353216, -1);
show_hudmessage(id, "%s \n\n[ Health: %d | Level: %i | Exp: %i/%i | Money: %d ]", name, get_user_health(pid), cs_get_user_money(id), g_level[pid], level_exp[pid], g_level_exp[pid]);
}
new var3;
if (cs_get_user_team(id, 0) == 1 && cs_get_user_team(idAiming, 0) == 2)
{
set_hudmessage(238, 201, "%L", -1082130432, 1058642330, 1, 1008981770, 1077936128, 1008981770, 1008981770, -1);
show_hudmessage(id, "%s \n\n[ Health: %d | Level: %i | Exp: %i/%i | Money: %d ]", name, get_user_health(pid), cs_get_user_money(id), g_level[pid], level_exp[pid], g_level_exp[pid]);
}
}
return 0;
}
public show_status1(id)
{
new name[32];
new pid = read_data(2);
get_user_name(pid, name, 31);
new idAiming;
new iBodyPart;
get_user_aiming(id, idAiming, iBodyPart, 9999);
new var1;
if (is_user_alive(idAiming) && is_user_alive(id))
{
new var2;
if (cs_get_user_team(id, 0) == 1 && cs_get_user_team(idAiming, 0) == 1)
{
set_hudmessage(255, "%L", 128, -1082130432, 1058642330, 1, 1008981770, 1077936128, 1008981770, 1008981770, -1);
show_hudmessage(id, "%s \n\n[ Health: %d | Level: %i | Exp: %i/%i | Money: %d ]", name, get_user_health(pid), cs_get_user_money(id), g_level[pid], level_exp[pid], g_level_exp[pid]);
}
}
return 0;
}
public expa_give(id, level, cid)
{
if (!cmd_access(id, level, cid, 2, false))
{
console_print(id, 8876);
return 1;
}
new target[32];
new count[32];
read_argv(1, target, 31);
read_argv(2, count, 31);
new target_id;
new name[32];
new nameid[32];
target_id = find_player("bl", target);
get_user_name(target_id, name, 31);
get_user_name(id, nameid, 31);
if (!target_id)
{
console_print(id, "Can't find that player");
return 1;
}
if (read_argc() != 3)
{
return 1;
}
if (g_level_exp[target_id] - level_exp[target_id] > str_to_num(count))
{
if (str_to_num(count))
{
console_print(id, "Player %s gives for %i exp, Her Maximum %i", name, str_to_num(count), g_level_exp[target_id]);
level_exp[target_id] = level_exp[target_id][str_to_num(count)];
}
else
{
console_print(id, "Exp Player %s in %i / %i", name, level_exp[target_id], g_level_exp[target_id]);
}
}
else
{
console_print(id, "Maximum Exp in player %i", g_level_exp[target_id]);
}
return 1;
}
public level_give(id, level, cid)
{
if (!cmd_access(id, level, cid, 2, false))
{
console_print(id, 9356);
return 1;
}
new target[32];
new count[32];
read_argv(1, target, 31);
read_argv(2, count, 31);
new target_id;
new name[32];
new level_id = str_to_num(count);
target_id = find_player("bl", target);
get_user_name(target_id, name, 31);
if (!target_id)
{
console_print(id, "Can't find that player");
return 1;
}
if (read_argc() != 3)
{
return 1;
}
new var1;
if (g_level[target_id][level_id] <= get_pcvar_num(g_level_max) && level_id && g_level[target_id][level_id] > 0)
{
if (0 < level_id)
{
g_level[target_id] = g_level[target_id][level_id];
level_exp[target_id] = 0;
message_begin(8, g_ScreenFade, 9464, target_id);
write_short(4096);
write_short(1);
write_short("%L");
write_byte(1);
write_byte(200);
write_byte("%L");
write_byte(205);
message_end();
emit_sound(target_id, 5, sound_level_up, 1065353216, 1061997773, "%L", 120);
}
else
{
g_level[target_id] = g_level[target_id][level_id];
level_exp[target_id] = 0;
message_begin(8, g_ScreenFade, 9464, target_id);
write_short(4096);
write_short(1);
write_short("%L");
write_byte(200);
write_byte(40);
write_byte("%L");
write_byte(205);
message_end();
}
console_print(id, "Player %s gives add %i level", name, level_id);
}
else
{
console_print(id, "Operation Invalid");
}
return 1;
}
public client_putinserver(id)
{
Level_Load(id);
new name[32];
g_trime[id] = 0;
g_bonus[id] = 1;
nameid[id] = get_user_name(id, name, 31);
get_user_name(id, g_playername[id], 31);
if (!is_user_bot(id))
{
set_task(1065353216, "ShowHUD", id + 0, 8184, "%L", 9696, "%L");
}
if (is_user_alive(id))
{
g_trime[id] = 0;
new n = 1;
while (g_level[id] != n)
{
h_armor[id] = set_user_armor(id, get_pcvar_num(g_h_armor)) * n;
n += 1;
}
}
if (!g_level[id])
{
g_level[id] = 1;
}
if (get_pcvar_num(cvar_statssave))
{
if (g_level[id] == level_exp[id])
{
level_exp[id] = 0;
}
}
if (get_pcvar_num(g_level_num) > g_level[id])
{
g_levels[id] = get_pcvar_num(g_level_num);
}
else
{
if (g_levels[id] != g_level[id])
{
new x = 1;
while (get_pcvar_num(g_level_num) * x < g_level[id])
{
x += 1;
g_levels[id] = get_pcvar_num(g_level_num) * x;
}
}
}
new y;
while (y != g_level[id])
{
y += 1;
g_level_exp[id] = get_pcvar_num(g_frags_level) * y;
}
return 0;
}
public client_disconnect(id)
{
new name[32];
new player_nick[32];
player_nick[id] = get_user_name(id, name, 31);
if (nameid[id] == player_nick[id])
{
Level_Save(id);
}
if (is_user_alive(id))
{
if (get_pcvar_num(cvar_statssave))
{
g_trime[id] = 0;
}
}
return 0;
}
public hide_status(id)
{
set_hudmessage("%L", "%L", "%L", "%L", "%L", "%L", "%L", 1008981770, "%L", "%L", 4);
show_hudmessage(id, 9704);
return 0;
}
public say_info(id)
{
new text[70];
new arg1[32];
new target[32];
new count[32];
read_args(text, 69);
remove_quotes(text);
arg1[0] = 0;
target[0] = 0;
count[0] = 0;
parse(text, arg1, 31, target, 31, count, 31);
if (equali(arg1, "info", 4))
{
info_player(id, target);
}
new var1;
if (equali(arg1, "bonusme", 7) && get_pcvar_num(g_level_info) == 1)
{
bonus_player(id);
}
new var2;
if (equali(arg1, "levelexp", 7) && get_pcvar_num(g_level_info) == 1)
{
expa_player(id);
}
return 0;
}
public info_player(id, target[])
{
new target_2 = find_player("bl", target);
static nameid[32];
static name[32];
get_user_name(target_2, name, 31);
get_user_name(id, nameid, 31);
if (!target_2)
{
ChatColor(id, "!g[Level System] !y%L", -1, "LEVEL_INFO_NONAME");
return 1;
}
if (is_user_alive(id))
{
if (target_2 != id)
{
ChatColor(id, "!g[Level System]!t %L", -1, "LEVEL_INFOZM", name, g_level[target_2]);
ChatColor(target_2, "!g[Level System]!t%L ", -1, "LEVEL_INFO_YOU", nameid);
}
else
{
ChatColor(id, "!g[Level System]!t%L", -1, "LEVEL_INFOME_ZM");
}
}
else
{
if (target_2 != id)
{
ChatColor(id, "!g[Level System]!t%s!y:!g%i Level", name, g_level[target_2]);
ChatColor(target_2, "!g[Level System]!t%L ", -1, "LEVEL_INFO_YOU", nameid);
}
ChatColor(id, "!g[Level System]!t%L", -1, "LEVEL_INFOME");
}
return 1;
}
public bonus_player(id)
{
new var1;
if (g_level[id] >= g_levels[id] && g_bonus[id] && get_pcvar_num(g_level_bonus))
{
g_levels[id] = g_levels[id] * 2;
g_level_del[id] = g_level[id];
g_bonus[id] = 0;
ChatColor(id, "!g[Level System] !tyou have New !g%i !tLevel Good", g_level[id]);
Level_Save(id);
}
else
{
if (g_levels[id] > g_level[id])
{
g_levels[id] = get_pcvar_num(g_level_num);
ChatColor(id, "!g[Level System] !y to Remove a bonus it will be possible only on! g%i Level!t. The bonus makes", g_levels[id]);
}
else
{
new x = 1;
while (get_pcvar_num(g_level_num) * x < g_level[id])
{
g_levels[id] = get_pcvar_num(g_level_num) * x;
x += 1;
}
ChatColor(id, "!g[Level System] !y to Remove a bonus it will be possible only on! g%i Level!t. The bonus makes", g_levels[id]);
}
Level_Save(id);
}
return 1;
}
public expa_player(id)
{
ChatColor(id, "!g[Level System] %L", -1, "LEVEL_EXP", level_exp[id], g_level_exp[id]);
return 1;
}
public ShowHUD(taskid)
{
static id;
id = taskid - 0;
if (!is_user_alive(id))
{
id = pev(id, 101);
if (!is_user_alive(id))
{
return 0;
}
}
if (taskid - 0 != id)
{
set_hudmessage(125, 38, 205, -1082130432, 1061997773, "%L", 1086324736, 1066192077, "%L", "%L", -1);
show_hudmessage(taskid - 0, "Spectating: %s \n\n[ Health: %d | Level : %d | Exp : %d/%d | Money : %d ]", g_playername[id], get_user_health(id), g_level[id], level_exp[id], g_level_exp[id], cs_get_user_money(id));
}
else
{
set_hudmessage("%L", 255, "%L", -1082130432, 1062836634, "%L", 1086324736, 1066192077, "%L", "%L", -1);
show_hudmessage(taskid - 0, "[ Health: %d | Level : %d | Exp : %d/%d | Money : %d ]", get_user_health(taskid - 0), g_level[taskid - 0], level_exp[taskid - 0], g_level_exp[taskid - 0], cs_get_user_money(taskid - 0));
}
return 0;
}
public Level_Save(id)
{
new key[64];
new data[256];
new data_exp[256];
new key_exp[64];
new name[33];
get_user_name(id, name, 32);
format(key, 63, "%s-/", name);
format(data, 255, "%i#", g_level[id]);
format(key_exp, 63, "%s-/", name);
format(data_exp, 255, "%i#", level_exp[id]);
nvault_set(g_level_data, key, data);
nvault_set(g_exp_data, key_exp, data_exp);
return 0;
}
public Level_Load(id)
{
new key[64];
new data[256];
new data_exp[256];
new key_exp[64];
new name[33];
get_user_name(id, name, 32);
format(key, 63, "%s-/", name);
format(data, 255, "%i#", g_level[id]);
format(key_exp, 63, "%s-/", name);
format(data_exp, 255, "%i#", level_exp[id]);
nvault_get(g_level_data, key, data, 255);
nvault_get(g_exp_data, key_exp, data_exp, 255);
replace_all(data, 255, 12824, 12832);
replace_all(data_exp, 255, 12840, 12848);
new givelevel[32];
new give_exp[32];
parse(data, givelevel, 31);
parse(data_exp, give_exp, 31);
g_level[id] = str_to_num(givelevel);
level_exp[id] = str_to_num(give_exp);
return 0;
}
public Frags_Manager()
{
new aname[32];
new attacker = read_data(1);
new y = 1;
get_user_name(attacker, aname, 31);
new var1;
if (level_exp[attacker] >= g_level_exp[attacker] - 1 && g_level[attacker] <= get_pcvar_num(g_level_max) && is_user_alive(attacker))
{
g_bonus[attacker] = 1;
g_level[attacker] = g_level[attacker] + 1;
level_exp[attacker] = 0;
while (y != g_level[attacker])
{
y += 1;
g_level_exp[attacker] = get_pcvar_num(g_frags_level) * y;
}
message_begin(8, g_ScreenFade, 9464, attacker);
write_short(4096);
write_short(1);
write_short("%L");
write_byte(1);
write_byte(200);
write_byte("%L");
write_byte(205);
message_end();
emit_sound(attacker, 5, sound_level_up, 1065353216, 1061997773, "%L", 120);
set_hudmessage("%L", 200, "%L", 1059481190, 1056964608, "%L", "%L", 1077936128, 1073741824, 1065353216, -1);
show_hudmessage("%L", "%L", -1, "LEVEL_UP", aname, g_level[attacker]);
Level_Save(attacker);
}
else
{
if (get_pcvar_num(g_level_max) == g_level[attacker])
{
ChatColor(attacker, "!g[Level System]!y %L", -1, "LEVEL_MAX", g_level[attacker]);
}
level_exp[attacker] = level_exp[attacker] + 1;
Level_Save(attacker);
}
return 0;
}
ChatColor(id, input[])
{
new count = 1;
new players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!g", 13808);
replace_all(msg, 190, "!y", 13828);
replace_all(msg, 190, "!t", 13848);
replace_all(msg, 190, "!t2", 13872);
if (id)
{
players[0] = id;
}
else
{
get_players(players, count, "ch", 13892);
}
new i;
while (i < count)
{
if (is_user_connected(players[i]))
{
message_begin(8, SayText, 9464, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
i++;
}
return 0;
}
public native_zp_level_1(id)
{
return g_level[id];
}
public native_zp_level_exp(id)
{
return level_exp[id];
}
public native_zp_level_exp1(id)
{
return g_level_exp[id];
}