Thnx solve
Code:
ham_strip_weapon(id,"weapon_c4")
I dont want make
spam that's why i am posting another topic related with C4 bomb.
PHP Code:
public plugin_init()
{
if(find_ent_by_class(-1, "func_bomb_target")>0||find_ent_by_class(-1, "info_bomb_target")>0)
{
RegisterHam(Ham_Spawn, "player", "inventory", true)
}
}
public inventory(id)
{
if( is_user_alive(id) && get_user_team(id) == 1 && cs_get_user_bpammo(id, CSW_C4) == 0 )
{
fm_give_item(id, "weapon_c4")
}
}
I tried to give C4 bomb to all terrorist when they spawn expect those who alredy have one C4 bomb.
Why above code is giving C4 bomb to all terrorist?
If terrorist is already have C4 bomb then it should not receive another C4 bomb.
My code is correct or not?
How could i stop default c4 giving function?
Or is there any another way to find if terrorist already have c4 bomb?
Is there any solution?
EDIT:
Thnx solved!
Game already have there default spawn function! For custom function it need little bit delay! It is done through
set_task.
Tested and works perfect for me!
PHP Code:
public plugin_init()
{
if(find_ent_by_class(-1, "func_bomb_target")>0||find_ent_by_class(-1, "info_bomb_target")>0)
{
RegisterHam(Ham_Spawn, "player", "inventory", true)
}
}
public inventory(id)
{
if( is_user_alive(id) && get_user_team(id) == 1)
{
set_task(0.1, "give_c4")
}
}
public give_c4(id)
{
if(is_user_alive(id) && cs_get_user_bpammo(id, CSW_C4) == 0)
{
fm_give_item(id, "weapon_c4")
cs_set_user_plant(id, 1)
}
}
__________________