I have tried for over 4 hours to get this to work. What I'm trying to do is that when the person is randomly selected to be given a weapon, they get a certain ammount of ammo and a message is shown to all players. The person recieves the weapon, but no message is shown and they have a full clip. Help please!
PHP Code:
public SeekerItems(id) {
new rand = random_num(1,10)
strip_user_weapons(id)
give_item(id, "weapon_knife")
switch(rand) {
case 1: giveusp(id)
case 3: {
give_item(id, "weapon_hegrenade")
client_print(id, print_chat, "You got a HE Grenade!")
}
case 4: {
give_item(id, "weapon_shield")
client_print(id, print_chat, "You got a Shield!")
}
case 7: giveawp(id)
}
cs_set_user_nvg(id)
set_user_footsteps(id,0)
}
//------------------------------------------------------------------------------------------------------------
public HiderItems(id) {
new rand = random_num(1,10)
strip_user_weapons(id)
give_item(id, "weapon_flashbang")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_smokegrenade")
csset_user_armor(id, 100.0, 2)
switch(rand) {
case 1: giveusp(id)
case 3: {
give_item(id, "weapon_hegrenade")
client_print(id, print_chat, "You got a HE Grenade!");
}
case 4: {
give_item(id, "weapon_shield")
client_print(id, print_chat, "You got a Shield!");
}
case 7: giveawp(id)
}
cs_set_user_nvg(id, 0)
set_user_footsteps(id,1)
}
//------------------------------------------------------------------------------------------------------------
public giveusp(id) {
new WeapEntIndex = find_ent_by_owner(-1, "weapon_usp", id, 0);
give_item(id, "weapon_usp")
cs_set_weapon_ammo(WeapEntIndex, 2);
glbprint(id, 1)
}
//------------------------------------------------------------------------------------------------------------
public giveawp(id) {
new WeapEntIndex = find_ent_by_owner(-1, "weapon_awp", id, 0);
give_item(id, "weapon_awp")
cs_set_weapon_ammo(WeapEntIndex, 3);
glbprint(id, 2)
}
//------------------------------------------------------------------------------------------------------------
public csset_user_armor(id, Float:amount, type) {
entity_set_float(id,EV_FL_armorvalue, amount)
set_pdata_int(id,ARMORTYPE_OFFSET,type)
}
//------------------------------------------------------------------------------------------------------------
glbprint(id, wep) {
if(wep == 1) {
new name[32]
get_user_name(id, name, 31)
client_print(0, print_chat, "%s now has a USP!", name)
}
if(wep == 2) {
new name[32]
get_user_name(id, name, 31)
client_print(0, print_chat, "%s now has an AWP!", name)
}
}