new g_czbot
RegisterHam(Ham_Spawn, "player", "Spawn_post", 1)
public client_putinserver(id) // 讓BOT也能讀到Spawn_post
{
new classname[32]
pev(id, pev_classname, classname, 31)
if (!equal(classname, "player") && !g_czbot)
{
set_task(0.1, "registerham_from_czbot", id)
g_czbot = 1
}
}
public registerham_from_czbot(id)
{
RegisterHamFromEntity(Ham_Spawn, id, "Spawn_post", 1)
if (is_user_alive(id)) Spawn_post(id)
}
public Spawn_post(id)
{
if(is_user_bot(id)) //如果玩家是BOT
{
strip_user_weapons(id) //扒光他
give_item(id, "weapon_knife") //給刀
random_weapon(id) //隨機主槍
random_weapon2(id) //隨機小槍
}
return PLUGIN_HANDLED
}
隨機主槍部分public random_weapon(id)
{
if(!is_user_alive(id))
return
if(!is_user_bot(id))
return
new num = random_num(0,2) //隨機抽0至2
if(num == 0){ //抽中0就給ak47
give_item(id, "weapon_ak47")
cs_set_user_bpammo(id, CSW_AK47, 270)
}
if(num == 1){ //抽中1就給galil
give_item(id, "weapon_galil")
cs_set_user_bpammo(id, CSW_GALIL, 270)
}
if(num == 2){ //抽中2就給awp
give_item(id, "weapon_awp")
cs_set_user_bpammo(id, CSW_AWP, 60)
}
}
隨機小槍部分如此類推public random_weapon2(id)
{
if(!is_user_alive(id))
return
if(!is_user_bot(id))
return
new num = random_num(0,2)
if(num == 0){
give_item(id, "weapon_usp")
cs_set_user_bpammo(id, CSW_USP, 270)
}
if(num == 1){
give_item(id, "weapon_glock18")
cs_set_user_bpammo(id, CSW_GLOCK18, 270)
}
if(num == 2){
give_item(id, "weapon_elite")
cs_set_user_bpammo(id, CSW_ELITE, 270)
}
}