图 1.
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#include <dhudmessage>
#include <fvault>
#define TASK_USERINFO 4444
new Cvar_BlockKill
new g_msgSync
new g_xp[33] = 0 , g_level[33] = 1 , g_CE[33] = 25 , g_damage[33] , g_guns[33]
new g_skills[33], g_hp[33], g_gravity[33], g_speed[33], g_atk[33], g_blood[33], g_crit[33], g_recoil[33], g_render[33]
new damage_give , damage_exp , damage_CE , ctkill_exp , ctkill_CE , up_lvexp , trkill_exp ,trkill_CE
new red , green , blue , x_site , y_site
new g_vault[] = "12Bosx_newlevel"
new const uplv_sound[] = { "12Boss/uplv.wav" }
public plugin_init()
{
register_plugin("等级系统", "1.0", "Eric")
register_clcmd("say /guns", "gunmenu")
register_clcmd("guns", "gunmenu")
register_clcmd("say /save" ,"player_save")
register_clcmd("say /shop", "shopmenu")
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink", 1)
register_forward(FM_ClientKill, "FwdClientKill" )
register_message(get_user_msgid("TextMsg"), "message_textmsg")
Cvar_BlockKill = register_cvar( "blockkill", "1" )
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post",1)
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
RegisterHam(Ham_Killed, "player", "fw_KilledPlayer")
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
register_clcmd("chooseteam", "clcmd_chooseteam")
register_concmd("give_level", "cmd_give_level", ADMIN_KICK, "- give__exp <玩家> <数量> : 增送等级")
register_concmd("give_CE", "cmd_give_CE", ADMIN_KICK, "- give__exp <玩家> <数量> : 增送CE")
register_concmd("give_exp", "cmd_give_exp", ADMIN_KICK, "- give__exp <玩家> <数量> : 增送exp")
register_concmd("give_skills", "cmd_give_skills", ADMIN_KICK, "- give__exp <玩家> <数量> : 增送技能点数")
ctkill_exp = register_cvar("ctkill_exp", "50")
ctkill_CE = register_cvar("ctkill_CE", "2")
trkill_exp = register_cvar("trkill_exp", "150")
trkill_CE = register_cvar("trkill_CE", "2")
up_lvexp = register_cvar("uplv_exp", "2000")
red = register_cvar("color_red", "0")
green = register_cvar("color_green", "100")
blue = register_cvar("color_blue", "0")
x_site = register_cvar("x_site", "0.75")
y_site = register_cvar("y_site", "0.60")
public plugin_natives()
{
register_native("set_user_cash", "native_set_user_cash", 1)
register_native("get_user_cash", "native_get_user_cash", 1)
register_native("get_user_level", "native_get_user_level", 1)
}
public native_set_user_cash(id, value)
{
g_cash[id] = value
}
public native_get_user_cash(id)
{
return g_cash[id]
}
public native_get_user_level(id)
{
return g_level[id]
}
if (get_gametime() - last_check_time >= 0.2)
{
if (g_xp[id] >= (g_level[id] * get_pcvar_num(up_lvexp)))
{
g_level[id] ++
g_cash[id] += 5
g_skills[id] ++
SaveData(id)
client_printc(0, "\t%s \g- 已经升至\t%d\g等级。", name , g_level[id])
emit_sound(id, CHAN_AUTO, uplv_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
}
}
public clcmd_chooseteam(id)
{
{
system_menu(id)
}
return PLUGIN_HANDLED
}
public system_menu(id)
{
{
new menu = menu_create("《主选单》", "system_menu2")
menu_additem(menu, "选择枪械", "1", 0)
menu_additem(menu, "储存经验", "2", 0)
menu_display(id, menu, 0)
}
}
public system_menu2(id, menu, item, Float:damge)
{
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item , access, data,5, iName, 63, callback)
new key = str_to_num(data)
switch(key)
{
case 1:
{
gunmenu(id)
}
case 2:
{
player_save(id)
client_cmd(id,"saveguns")
}
}
public gunmenu(id)
{
{
new menu = menu_create("\w《选择枪械》", "gunmenu2")
menu_additem(menu, "等级枪械", "1", 0)
menu_display(id, menu, 0)
}
}
public gunmenu2(id, menu, item, Float:damage)
{
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
new key = str_to_num(data)
switch(key)
{
case 1:
{
level_guns(id)
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
public level_guns(id)
{
{
if(g_guns[id] < 1 )
{
new menu = menu_create("\w《等级枪械》:", "level_guns2")
menu_additem(menu, "等级 \r0\w : UMP45", "1", 0)
menu_additem(menu, "等级 \r5\w : MP5", "2", 0)
menu_additem(menu, "等级 \r10\w : P90", "3", 0)
menu_additem(menu, "等级 \r15\w : M3", "4", 0)
menu_additem(menu, "等级 \r20\w : XM1014", "5", 0)
menu_additem(menu, "等级 \r25\w : Galil", "6", 0)
menu_additem(menu, "等级 \r30\w : AK47", "7", 0)
menu_additem(menu, "等级 \r35\w : M4A1", "8", 0)
menu_additem(menu, "等级 \r40\w : SCOUT", "9", 0)
menu_additem(menu, "等级 \r45\w : AWP", "10", 0)
menu_additem(menu, "等级 \r50\w : SG550", "11", 0)
menu_additem(menu, "等级 \r55\w : G3SG1", "12", 0)
menu_additem(menu, "等级 \r60\w : M249", "13", 0)
menu_additem(menu, "等级 \r65\w : 未推出", "14", 0)
menu_additem(menu, "等级 \r70\w : 未推出", "15", 0)
menu_display(id, menu, 0)
}
else
{
client_printc(id, "每回合只能选择了一次等级枪械!")
}
}
return PLUGIN_HANDLED
}
public level_guns2(id, menu, item)
{
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
new key = str_to_num(data)
switch(key)
{
case 1:
{
if(g_level[id] >= 0)
{
client_printc(id, "\g[等级枪械] 您已获得 -UMP45套装。")
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_ump45")
give_item(id, "weapon_deagle")
g_guns[id] += 1
return PLUGIN_HANDLED
}
else
{
client_printc(id,"\g你不够等级:\t0\g使用!")
}
}
case 2:
{
if(g_level[id] >= 5)
{
client_printc(id, "\g[等级枪械] 您已获得 -MP5套装。")
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_mp5navy")
give_item(id, "weapon_deagle")
g_guns[id] += 1
return PLUGIN_HANDLED
}
else
{
client_printc(id,"\g你不够等级:\t5\g使用!")
}
}
case 3:
{
if(g_level[id] >= 10)
{
client_printc(id, "\g[等级枪械] 您已获得 -P90套装。")
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_p90")
give_item(id, "weapon_deagle")
g_guns[id] += 1
return PLUGIN_HANDLED
}
else
{
client_printc(id,"\g你不够等级:\t10\g使用!")
}
}
case 4:
{
if(g_level[id] >= 15)
{
client_printc(id, "\g[等级枪械] 您已获得 -M3套装。")
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_m3")
give_item(id, "weapon_deagle")
g_guns[id] += 1
return PLUGIN_HANDLED
}
else
{
client_printc(id,"\g你不够等级:\t15\g使用!")
}
}
case 5:
{
if(g_level[id] >= 20)
{
client_printc(id, "\g[等级枪械] 您已获得 - XM1014套装。")
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_xm1014")
give_item(id, "weapon_deagle")
g_guns[id] += 1
return PLUGIN_HANDLED
}
else
{
client_printc(id,"\g你不够等级:\t20\g使用!")
}
}
case 6:
{
if(g_level[id] >= 25)
{
client_printc(id, "\g[等级枪械] 您已获得 - Galil套装。")
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_galil")
give_item(id, "weapon_deagle")
g_guns[id] += 1
return PLUGIN_HANDLED
}
else
{
client_printc(id,"\g你不够等级:\t25\g使用!")
}
}
case 7:
{
if(g_level[id] >= 30)
{
client_printc(id, "\g[等级枪械] 您已获得 - AK47套装。")
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_ak47")
give_item(id, "weapon_deagle")
g_guns[id] += 1
return PLUGIN_HANDLED
}
else
{
client_printc(id,"\g你不够等级:\t30\g使用!")
}
}
case 8:
{
if(g_level[id] >= 35)
{
client_printc(id, "\g[等级枪械] 您已获得 - M4A1套装。")
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_m4a1")
give_item(id, "weapon_deagle")
g_guns[id] += 1
return PLUGIN_HANDLED
}
else
{
client_printc(id,"\g你不够等级:\t35\g使用!")
}
}
case 9:
if(glevel[id] >=40
client_print(id,"\g[等级枪械] 您已获得 - SCOUT套装。")
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_scout")
give_item(id, "weapon_deagle")
g_guns[id] += 1
return PLUGIN_HANDLED
}
else
{
client_printc(id,"\g你不够等级:\t40\g使用!")
}
}
case 10:
{
if(g_level[id] >= 45)
{
client_printc(id, "\g[等级枪械] 您已获得 - AWP套装。")
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_awp")
give_item(id, "weapon_deagle")
g_guns[id] += 1
return PLUGIN_HANDLED
}
else
{
client_printc(id,"\g你不够等级:\t45\g使用!")
}
}
case 11:
{
if(g_level[id] >= 50)
{
client_printc(id, "\g[等级枪械] 您已获得 - 连狙SG550套装。")
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_sg550")
give_item(id, "weapon_deagle")
g_guns[id] += 1
return PLUGIN_HANDLED
}
else
{
client_printc(id,"\g你不够等级:\t50\g使用!")
}
}
case 12:
{
if(g_level[id] >= 55)
{
client_printc(id, "\g[等级枪械] 您已获得 - G3SG1套装。")
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_g3sg1")
give_item(id, "weapon_deagle")
g_guns[id] += 1
return PLUGIN_HANDLED
}
else
{
client_printc(id,"\g你不够等级:\t55\g使用!")
}
}
case 13:
{
if(g_level[id] >= 60)
{
client_printc(id, "\g[等级枪械] 您已获得 - M249套装。")
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_m249")
give_item(id, "weapon_deagle")
g_guns[id] += 1
return PLUGIN_HANDLED
}
else
{
client_printc(id,"\g你不够等级:\t60\g使用!")
}
}
case 14:
{
client_printc(id,"\g[等级枪械]此枪械尚未推出 。")
}
case 15:
{
client_printc(id,"\g[等级枪械]此枪械尚未推出 。")
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}