Code:
if(is_user_alive(id))
{
ColorChat(id, NORMAL, "%s You are ^4dead^1.", g_szPrefix)
client_cmd(id, "spk %s", g_szNo)
}
What?! I think you forgot the
! sign before
is_user_alive
Also, if you want to stop the function, use
else after the check, or return something inside it, so the function will stop.
It's better to use the
item variable, instead of getting menu info. Just make a
PHP Code:
new key = item + 1
and then you may use the same switch between key.
Now, on the thread. You should register Ham_TakeDamage like this:
PHP Code:
RegisterHam(Ham_TakeDamage, "player", "Event_TakeDamage")
I see you have already made a bool for the user having golden ak47, so we can use it in the ham function to check if the user holds golden ak and then multiple his damage.
Like this:
PHP Code:
public Event_TakeDamage(victim, inflictor, attacker, Float:damage, dmgbits)
{
if(is_user_alive(attacker) && get_user_weapon(attacker) == CSW_AK47 && Golden[attacker])//Checking if the user holds AK47 and it's golden
SetHamParamFloat(4, damage * 2) //Here we multiple his damage! The second param is the value of the damage.
//Now it's multiplied by 2, but you can increase this number to higher or lower one.
}
P.S.: I see you reset the bool only on spawn. But if player drops his golden ak47, he will still have that damage increase with another ak47, which is not golden. So you may set the bool to false on ak47 dropping, if it's true when the user drops the ak47.
Also, you may register cvars in variables, so it'll be more easy to use them. And it's better to use get_
pcvar_num instead of get_cvar_num, because it's faster.
And you may use read_data(2) in CurWeapon event insted of get_user_weapon, because I think it's more proper.
In the function of the menu, where you give the golden ak47, you don't actually give it to him, but only check if he already has one. So you will have to give_item(id, "weapon_ak47") and then there is no need to check if he already has one, because you gave him. Otherwise, what if he hasn't got ak47? No sense. I'm not really sure if giving the item will automaticaly switch to it, but I think so.
In the menu, you don't have to addblank 0 and then switch it and destroy the menu there. Just use that check in the handlers and it's all okay.
PHP Code:
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
The code with all changes precached.