Делаю плагин, чтобы при нажатии ПКМ с диглом в руках менялся мод на Супер и урона от дигла наносилось больше, но чё то не работает. Помогите!
Код:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#define PLUGIN "Super Deagle"
#define VERSION "1.0"
#define AUTHOR "FDGOD"
new bool:super_mode[33]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_forward(FM_PlayerPreThink, "super_deagle", 0)
RegisterHam(Ham_Item_AddToPlayer, "weapon_deagle", "fw_AddToPlayer", 1)
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
}
public client_putinserver(id)
{
super_mode[id] = false
}
public client_disconnect(id)
{
super_mode[id] = false
}
public super_deagle(id)
{
if(!is_user_alive(id))
return PLUGIN_HANDLED
static button;
button = pev(id, pev_button)
if(button & IN_ATTACK2 && get_user_weapon(id) == CSW_DEAGLE)
{
SecondaryAttack(id)
}
return PLUGIN_HANDLED
}
public SecondaryAttack(weapon)
{
new id = pev(weapon, pev_owner)
if(super_mode[id] == false)
{
set_task(0.2, "SuperMode1", id)
}
else if(super_mode[id] == true)
{
set_task(0.2, "SuperMode2", id)
}
}
public fw_AddToPlayer(weapon, id)
{
if(!is_user_connected(id) || !pev_valid(weapon))
{
return HAM_IGNORED
}
super_mode[id] = false
return HAM_IGNORED
}
public fw_TakeDamage(victim, attacker, Float:damage)
{
if(get_user_weapon(attacker) == CSW_DEAGLE && super_mode[attacker] == true)
{
SetHamParamFloat(4, damage * 4.0)
client_print(attacker, print_chat, "You have caused damage! ", damage)
}
}
public SuperMode1(id)
{
client_print(id, print_center, "You have activated Super-Mode")
super_mode[id] = true
}
public SuperMode2(id)
{
client_print(id, print_center, "You have activated Default-Mode")
super_mode[id] = false
}