圖 1.
new player_xp[33];
new player_level[33];
new player_point[33];
new next_level_xp[33];
new arm[33] =
{
2, 0, 0, 0, 0, 0, 0, 0, 0, 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 gmsgStatusText;
new buy_jy_jl[33];
new buy_jy_jg = 15;
new buy_dj_jl[33];
new buy_dj_jg = 20;
new money[33];
new buy_wp_point[4] =
{
3, 5, 4, 0
}
new buy_speed_point[4] =
{
1, 1, 2, 0
}
new human_buyarmor[20] =
{
105, 116, 101, 109, 115, 47, 116, 114, 95, 107, 101, 118, 108, 97, 114, 46, 119, 97, 118, 0
}
new player_jn[33][9][1];
new LevelXP[40] =
{
0, 80, 200, 350, 550, 700, 800, 1100, 1300, 1500, 1800, 1950, 2150, 2450, 3000, 3500, 3700, 4000, 4600, 5300, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000, 21000, 22000, 23000, 24000, 100000000
}
new INVIS_lever[4] =
{
150, 100, 50, 0
}
fakedamage(idvictim, String:szClassname[], Float:takedmgdamage, damagetype)
{
new entity = create_entity(0);
if (entity)
{
DispatchKeyValue(entity, "classname", "trigger_hurt");
new szDamage[16];
format(szDamage, 15, "%f", takedmgdamage * 2);
DispatchKeyValue(entity, "dmg", szDamage);
format(szDamage, 15, "%i", damagetype);
DispatchKeyValue(entity, "damagetype", szDamage);
DispatchKeyValue(entity, "origin", "8192 8192 8192");
DispatchSpawn(entity);
entity_set_string(entity, 0, szClassname);
fake_touch(entity, idvictim);
remove_entity(entity);
return 1;
}
return 0;
}
public plugin_init()
{
register_plugin("manlevel", "2.0", "xiaoyaoyou");
register_cvar("amx_zp_hdmg", "20", 0, 0.00);
register_cvar("amx_XP_hit_bonus", "4", 0, 0.00);
register_cvar("amx_killer", "30", 0, 0.00);
register_clcmd("say human", "ShowMenu", -1, "Shows The menu", -1);
register_clcmd("say /human", "ShowMenu", -1, "Shows The menu", -1);
register_concmd("human", "ShowMenu", -1, "", -1);
register_menucmd(register_menuid(4808, 0), 1023, "MenuCommand");
register_event("Damage", "damage_msg", "b", "2!0", "3=0", "4!0");
register_event("CurWeapon", "CurWeapon", "be", "");
register_event("HLTV", "round_start", "a", "1=0", "2=0");
register_event("DeathMsg", "event_death", "a", "");
register_cvar("bullet_damage", "0", 0, 0.00);
gmsgStatusText = get_user_msgid("StatusText");
register_forward(FM_PlayerPreThink, "fw_prethink", 0);
set_task(0.80, "UpdateHUD", 0, "", 0, "b", 0);
return 0;
}
public ShowMenu(id)
{
if (player_point[id][0][0] >= 1 && var8[0][var8] < 6)
{
new var9 = player_jn[id][0][0];
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\y1. 身?如燕(%i?,共6?,需1?)", var9[0][var9]) + nLen;
}
else
{
new var10 = player_jn[id][0][0];
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\d1. 身?如燕(%i?,共6?,需1?)", var10[0][var10]) + nLen;
}
if (player_point[id][0][0] >= 1 && player_jn[id][0][0][1] < 6)
{
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\y2. ? 甲(%i?,共6?,需1?)", player_jn[id][0][0][1]) + nLen;
}
else
{
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\d2. ? 甲(%i?,共6?,需1?)", player_jn[id][0][0][1]) + nLen;
}
if (player_point[id][0][0] >= 3 && player_jn[id][0][0][2] < 3)
{
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\y3. ? 身(%i?,共3?,需3?)", player_jn[id][0][0][2]) + nLen;
}
else
{
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\d3. ? 身(%i?,共3?,需3?)", player_jn[id][0][0][2]) + nLen;
}
if (player_point[id][0][0] >= buy_wp_point[player_jn[id][0][0][3]][0][0] && player_jn[id][0][0][3] < 3)
{
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\y4. 武器威力(%i?,共3?,需%i?)", player_jn[id][0][0][3], buy_wp_point[player_jn[id][0][0][3]]) + nLen;
}
else
{
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\d4. 武器威力(%i?,共3?,需%i?)", player_jn[id][0][0][3], buy_wp_point[player_jn[id][0][0][3]]) + nLen;
}
if (player_point[id][0][0] >= buy_speed_point[player_jn[id][0][0][4]][0][0] && player_jn[id][0][0][4] < 3)
{
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\y5. 加速行走(%i?,共3?,需2?)", player_jn[id][0][0][4]) + nLen;
}
else
{
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\d5. 加速行走(%i?,共3?,需2?)", player_jn[id][0][0][4]) + nLen;
}
if (zp_get_user_ammo_packs(id) >= buy_jy_jg && buy_jy_jl[id][0][0])
{
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\y6. ????(只有一次机?,用%i??包??300???值)", buy_jy_jg) + nLen;
}
else
{
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\d6. ????(只有一次机?,用%i??包??300???值)", buy_jy_jg) + nLen;
}
if (zp_get_user_ammo_packs(id) >= buy_dj_jg && buy_dj_jl[id][0][0])
{
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\y7. ??等?(只有一次机?,用%i??包??1?等?)", buy_dj_jg) + nLen;
}
else
{
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\d7. ??等?(只有一次机?,用%i??包??1?等?)", buy_dj_jg) + nLen;
}
if (80 <= player_xp[id][0][0])
{
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\y8. 技能重置(可以重新分配技能?,每次扣除80???)") + nLen;
}
else
{
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\d8. 技能重置(可以重新分配技能?,每次扣除80???)") + nLen;
}
nLen = format(szMenuBody[nLen], 511 - nLen, "\n\n\w0. 退出 (未分配??:%i?)", player_point[id]) + nLen;
keys = 1023;
show_menu(id, keys, szMenuBody, -1, "");
return 0;
}
public MenuCommand(id, key)
{
switch (key)
{
case 0:
{
if (player_point[id][0][0] >= 1 && var11[0][var11] < 6)
{
if (zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_survivor(id))
{
client_print(id, print_chat, "[www.xysq.net]??只有人?可以??! ");
}
else
{
SetGravity(id);
}
}
else
{
new var15 = player_jn[id][0][0];
if (6 <= var15[0][var15])
{
new var16 = player_jn[id][0][0];
client_print(id, print_chat, "[www.xysq.net]你已??到了最高??的身?如燕 ,我?里已??有可以教你的?西了!", var16[0][var16]);
}
}
}
case 1:
{
if (player_point[id][0][0] >= 1 && player_jn[id][0][0][1] < 6)
{
if (zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_survivor(id))
{
client_print(id, print_chat, "[www.xysq.net]??只有人?可以??! ");
}
else
{
human_armor(id);
}
}
else
{
if (6 <= player_jn[id][0][0][1])
{
client_print(id, print_chat, "[www.xysq.net]你已??到了最高??的?甲 ,我?里已??有可以教你的?西了!", player_jn[id][0][0][1]);
}
}
}
case 2:
{
if (player_point[id][0][0] >= 3 && player_jn[id][0][0][2] < 3)
{
if (zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_survivor(id))
{
client_print(id, print_chat, "[www.xysq.net]??只有人?可以??! ");
}
else
{
INVIS_Set(id);
}
}
else
{
if (3 <= player_jn[id][0][0][2])
{
client_print(id, print_chat, "[www.xysq.net]你已??到了最高??的?身? ,?里已??有可以教你的?西了!", player_jn[id][0][0][2]);
}
}
}
case 3:
{
if (player_point[id][0][0] >= buy_wp_point[player_jn[id][0][0][3]][0][0] && player_jn[id][0][0][3] < 3)
{
if (zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_survivor(id))
{
client_print(id, print_chat, "[www.xysq.net]??只有人?可以??! ");
}
}
else
{
if (3 <= player_jn[id][0][0][3])
{
client_print(id, print_chat, "[www.xysq.net]你已??到了最高??的武器威力 ,?里已??有可以教你的?西了!", player_jn[id][0][0][3]);
}
}
}
case 4:
{
if (player_point[id][0][0] >= buy_speed_point[player_jn[id][0][0][4]][0][0] && player_jn[id][0][0][4] < 3)
{
if (zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_survivor(id))
{
client_print(id, print_chat, "[www.xysq.net]??只有人?可以??! ");
}
else
{
speed(id);
}
}
else
{
if (3 <= player_jn[id][0][0][4])
{
client_print(id, print_chat, "[www.xysq.net]你已??到了最高??的加速 ,?里已??有可以教你的?西了!", player_jn[id][0][0][4]);
}
}
}
case 5:
{
buy_jy(id);
client_print(id, print_chat, "[www.xysq.net]你用15???袋??了300???值! ");
}
case 6:
{
buy_dj(id);
client_print(id, print_chat, "[www.xysq.net]你用30???袋?制升了一?! ");
}
case 7:
{
if (80 <= player_xp[id][0][0])
{
if (1 <= player_jn[id][0][0][1])
{
static Float:armor;
pev(id, pev_armorvalue, armor);
if (armor > player_jn[id][0][0][1] * 15)
{
set_pev(id, pev_armorvalue, armor - player_jn[id][0][0][1] * 15);
}
set_pev(id, pev_armorvalue, 0);
}
new i = 0;
while (i < 9)
{
player_jn[id][0][0][i][0] = 0;
i++;
}
player_xp[id] = player_xp[id][0][0] - 80;
player_point[id] = player_level[id][0][0] - 1;
if (80 > player_point[id][0][0] - LevelXP[player_level[id][0][0] - 1][0][0])
{
player_level[id] = player_level[id][0][0] - 1;
player_point[id] = player_point[id][0][0] - 1;
}
set_user_gravity(id, 1.00);
set_user_rendering(id, 0, 0, 0, 0, 2, 255);
set_pev(id, pev_maxspeed, 240.00);
client_print(id, print_chat, "[www.xysq.net]你??重新分配技能,扣除80???值! ");
write_hud(id);
}
}
case 9:
{
client_print(id, print_chat, "[www.xysq.net]可以使用human再次打?菜?");
}
default:
{
}
}
return 1;
}
public write_hud(id)
{
if (is_user_connected(id) && is_user_alive(id) && !zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
{
if (!player_level[id][0][0])
{
player_level[id] = 1;
player_point[id] = 0;
}
new tpstring[512];
new i = 0;
while (i < 3)
{
if (LevelXP[player_level[id][0][0]][0][0] < player_xp[id][0][0])
{
player_level[id] = player_level[id][0][0] + 1;
player_point[id] = player_point[id][0][0] + 1;
ShowMenu(id);
i++;
}
i++;
}
next_level_xp[id] = LevelXP[player_level[id][0][0]][0][0] - player_xp[id][0][0];
format(tpstring, 511, "等?: %i ??值: %i ? 升?需: %i ?", player_level[id][0][0] - 1, player_xp[id], next_level_xp[id]);
message_begin(MSG_ONE, gmsgStatusText, 14560, id);
write_byte(0);
write_string(tpstring);
message_end();
}
return 0;
}
public UpdateHUD()
{
new tpstring[512];
new id = 0;
while (id < 32)
{
if (is_user_connected(id))
{
if (is_user_alive(id) && zp_get_user_zombie(id))
{
format(tpstring, 511, "");
message_begin(MSG_ONE, gmsgStatusText, 14576, id);
write_byte(0);
write_string(tpstring);
message_end();
write_hud(id);
}
if (is_user_alive(id) && !zp_get_user_nemesis(id))
{
format(tpstring, 511, "");
message_begin(MSG_ONE, gmsgStatusText, 14592, id);
write_byte(0);
write_string(tpstring);
message_end();
write_hud(id);
}
if (is_user_connected(id) && is_user_alive(id) && !zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
{
write_hud(id);
}
else
{
if (index >= 0 && index < 32 && is_user_connected(index) && is_user_alive(index) && !zp_get_user_zombie(index) && !zp_get_user_nemesis(index) && !zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
{
new pname[32];
get_user_name(index, pname, 31);
new Msg[1024];
set_hudmessage(255, 255, 255, 0.02, 0.63, 0, 6.00, 3.00, 0.10, 0.20, 4);
new var5 = player_jn[index][0][0];
format(Msg, 511, "等?:%i ??值:%i ? 升?需:%i ?\n1、 %i?身?如燕\n2、 %i??甲\n3、 %i??身\n4、 %i?武器威力\n5、 %i?加速行走", player_level[index][0][0] - 1, player_xp[index], next_level_xp[index], var5[0][var5], player_jn[index][0][0][1], player_jn[index][0][0][2], player_jn[index][0][0][3], player_jn[index][0][0][4]);
show_hudmessage(id, Msg);
}
}
}
id++;
}
return 0;
}
public CurWeapon(id)
{
write_hud(id);
return 0;
}
public damage_msg(vIndex)
{
if (attacker != vIndex && is_user_connected(attacker) && is_user_alive(attacker) && !get_user_godmode(vIndex) && !zp_get_user_survivor(attacker) && !zp_get_user_zombie(attacker) && !zp_get_user_nemesis(attacker) && !zp_get_user_nemesis(vIndex))
{
if (player_jn[attacker][0][0][3] && wpn == 29)
{
new XP_hit_bonus = get_cvar_num("amx_XP_hit_bonus");
new zp_hdmg = get_cvar_num("amx_zp_hdmg");
if (damage >= zp_hdmg)
{
player_xp[attacker] = XP_hit_bonus + player_xp[attacker][0][0];
if (zp_hdmg <= damage - zp_hdmg)
{
player_xp[attacker] = player_xp[attacker][0][0] + 1;
}
write_hud(attacker);
}
}
else
{
event_damage(vIndex, damage);
}
}
return 0;
}
public SetGravity(id)
{
if (is_user_connected(id) && is_user_alive(id) && !zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && !zp_get_user_survivor(id))
{
new var2 = player_jn[id][0][0];
set_user_gravity(id, 1.00 - 0.10 * var2[0][var2]);
}
return 0;
}
public round_start()
{
welcome_msg();
new id = 0;
while (id < 33)
{
if (is_user_connected(id) && is_user_alive(id))
{
write_hud(id);
id++;
}
id++;
}
return 0;
}
public fw_prethink(id)
{
if (is_user_connected(id) && is_user_alive(id) && !zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
{
new var3 = player_jn[id][0][0];
if (0 < var3[0][var3])
{
new var4 = player_jn[id][0][0];
set_user_gravity(id, 1.00 - 0.10 * var4[0][var4]);
}
if (player_jn[id][0][0][1] > 0 && arm[id][0][0] == 2)
{
arm[id] = 1;
set_pev(id, pev_armorvalue, float(player_jn[id][0][0][1] * 15));
}
if (0 < player_jn[id][0][0][2])
{
set_user_rendering(id, 0, 0, 0, 0, 2, INVIS_lever[player_jn[id][0][0][2] - 1][0][0]);
}
if (0 < player_jn[id][0][0][4])
{
set_pev(id, pev_maxspeed, float(player_jn[id][0][0][4] * 20 + 240));
}
}
return 0;
}
public human_armor(id)
{
if (is_user_connected(id) && is_user_alive(id) && !zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && !zp_get_user_survivor(id))
{
static Float:armor;
pev(id, pev_armorvalue, armor);
set_pev(id, pev_armorvalue, armor + 15);
engfunc(EngFunc_EmitSound, id, 4, human_buyarmor, 1.00, 0.80, 0, 100);
}
return 0;
}
public INVIS_Set(id)
{
if (is_user_connected(id) && is_user_alive(id) && !zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && !zp_get_user_survivor(id))
{
set_user_rendering(id, 0, 0, 0, 0, 2, INVIS_lever[player_jn[id][0][0][2] - 1][0][0]);
}
return 0;
}
public event_damage(victim, damage)
{
if (attacker != victim && !is_user_connected(attacker) && !is_user_alive(attacker) && zp_get_user_survivor(attacker) && zp_get_user_zombie(attacker) && zp_get_user_nemesis(attacker) && zp_get_user_nemesis(victim))
{
return 0;
}
if (damage <= 0 || get_user_health(victim) <= 0)
{
return 0;
}
if (damage < get_user_health(victim))
{
if (player_jn[attacker][0][0][3] - 0.80 * damage >= get_user_health(victim))
{
new var3;
if (weapid == 4)
{
var3 = 64;
}
else
{
var3 = 2;
}
fakedamage(victim, weaponname, float(get_user_health(victim) - 1), var3);
}
else
{
new var4;
if (weapid == 4)
{
var4 = 64;
}
else
{
var4 = 2;
}
fakedamage(victim, weaponname, float(damage) * player_jn[attacker][0][0][3] - 0.80, var4);
if (0.20 + player_jn[attacker][0][0][3] * damage >= zp_hdmg)
{
player_xp[attacker] = XP_hit_bonus + player_xp[attacker][0][0];
if (0.20 + player_jn[attacker][0][0][3] * damage - zp_hdmg >= zp_hdmg)
{
player_xp[attacker] = player_xp[attacker][0][0] + 1;
}
}
}
write_hud(attacker);
}
return 0;
}
public speed(id)
{
if (!is_user_alive(id) || zp_get_user_zombie(id) || zp_get_user_nemesis(id))
{
return 0;
}
if (is_user_connected(id) && is_user_alive(id))
{
set_pev(id, pev_maxspeed, float(player_jn[id][0][0][4] * 15 + 240));
}
return 0;
}
public event_death()
{
if (zp_get_user_zombie(iKiller) || zp_get_user_nemesis(iKiller) || iVictim != iKiller)
{
return 0;
}
player_xp[iKiller] = killer_jl + player_xp[iKiller][0][0];
return 0;
}
public welcome_msg()
{
client_print(0, print_chat, "[www.xysq.net提醒您]直接?human,可以?出人?技能菜?!");
client_print(0, print_chat, "[www.xysq.net提醒您]如果有???直接到www.xysq.net提出!");
return 0;
}
public client_putinserver(id)
{
player_xp[id] = 0;
player_level[id] = 0;
player_point[id] = 0;
buy_jy_jl[id] = 0;
new i = 0;
while (i < 9)
{
player_jn[id][0][0][i][0] = 0;
i++;
}
return 0;
}
public buy_jy(id)
{
if (!buy_jy_jl[id][0][0])
{
if (is_user_connected(id) && is_user_alive(id) && !zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
{
write_hud(id);
}
}
if (0 < buy_jy_jl[id][0][0])
{
return 0;
}
return 0;
}
public buy_dj(id)
{
if (!buy_dj_jl[id][0][0])
{
if (is_user_connected(id) && is_user_alive(id) && !zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
{
write_hud(id);
}
}
if (0 < buy_dj_jl[id][0][0])
{
return 0;
}
return 0;
}
public plugin_precache()
{
precache_sound(human_buyarmor);
return 0;
}