圖 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
}