View Single Post
xtheone
Junior Member
Join Date: Sep 2010
Old 04-03-2012 , 04:12   Re: HE suicide (double kill)? BUG?
Reply With Quote #2

Hmm, it looks like blueflash.amxx is causing this.

This is the .sma file, could anyone look this through?

Code:
#include <amxmodx>
#include <fun>

#define PLUGIN_VERSION "1.0c"

#define MAX_PLAYERS    32 + 1

new health_add
new health_hs_add
new health_max

new nKiller
new nKiller_hp
new nHp_add
new nHp_max

new g_iScreenFade

new bool:g_bHasFade[MAX_PLAYERS]

public plugin_init()
{
    register_plugin("Vampire", PLUGIN_VERSION, "Shalfey")
    
    g_iScreenFade    = get_user_msgid("ScreenFade")
    
    
    new sFunction[]    = "cmdFade"
    
    register_clcmd("say /fade",        sFunction)
    register_clcmd("say_team /fade",    sFunction)
    
    
    health_add    = register_cvar("amx_vampire_hp", "0")
    health_hs_add    = register_cvar("amx_vampire_hp_hs", "0")
    health_max    = register_cvar("amx_vampire_max_hp", "100")
    
    register_event("DeathMsg", "hook_death", "a", "1>0")
}

public client_putinserver(id)
    g_bHasFade[id] = true

public hook_death()
{
    // Killer id
    nKiller = read_data(1)
    
    if ( (read_data(3) == 1) && (read_data(5) == 0) )
    {
        nHp_add = get_pcvar_num (health_hs_add)
    }
    else
        nHp_add = get_pcvar_num (health_add)
    
    nHp_max = get_pcvar_num (health_max)
    
    // Updating Killer HP
    nKiller_hp = get_user_health(nKiller)
    nKiller_hp += nHp_add
    
    // Maximum HP check
    if (nKiller_hp > nHp_max) nKiller_hp = nHp_max
    
    set_user_health(nKiller, nKiller_hp)
    
    // Screen fading
    if ( !g_bHasFade[nKiller] )
        return
    
    message_begin(MSG_ONE_UNRELIABLE, g_iScreenFade, {0,0,0}, nKiller)
    write_short(1<<10)
    write_short(1<<10)
    write_short(0x0000)
    write_byte(0)
    write_byte(0)
    write_byte(200)
    write_byte(75)
    message_end()
}

public cmdFade(id)
{
    g_bHasFade[id] = !g_bHasFade[id]
    client_print(id, print_chat, "Blueflash %s. To %s, type /fade.", g_bHasFade[id] ? "enabled" : "disabled", g_bHasFade[id] ? "disable" : "enable")
}

Last edited by xtheone; 04-03-2012 at 04:14.
xtheone is offline