Raised This Month: $51 Target: $400
 12% 

wall kill scripting help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SAMURAI16
BANNED
Join Date: Sep 2006
Old 12-30-2006 , 12:47   wall kill scripting help
Reply With Quote #1

i maked this plugin and i have an problem :
When i switch team appear that message like when i kill an enemy trough wall
Rest of all plugin works (when i kill an enemy trough wall appear message correct)
Please if somebody can fix
Code :
Code:
#include <amxmodx>
#include <fakemeta>
#include <xs>

new const PLUGIN[] = "Wall Shot"
new const VERSION[] = "0.1"
new const AUTHOR[] = "SAMURAI"

new mWallKills[33]
new cvartipe
new cvarduration

new mlist[2][]=
{
    "%s killed %s trough wall !",
    "%s killed %s with him Wallhack :)"
}

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_event("DeathMsg", "deathMSG", "a")
    cvartipe = register_cvar("wallshot_showtype","1")
    cvarduration = register_cvar("wallshot_hudtime","5.0") // time in seconds
    
}

public deathMSG()
{
    new iAttacker = read_data(1)
    new iVictim = read_data(2)
    new kname[32], vname[32]
    get_user_name(iVictim,kname,31) 
    get_user_name(iAttacker,vname,31) 
    
    new bool:qVisible = fm_is_ent_visible(iAttacker, iVictim)
    if (!qVisible)
    {
        mWallKills[iAttacker]++
        switch (get_pcvar_num(cvartipe))
        {
            case 1:
            {
                set_hudmessage(0, 0, 255, 0.28, 0.26, 0, 6.0, get_pcvar_float(cvarduration))
                show_hudmessage(0,(mlist[random_num(0,1)]),vname,kname)
            }
            case 2:
            {
                client_print(0,print_chat,(mlist[random_num(0,1)]),vname,kname) 
            }
            case 3:
            {
                client_print(0,print_center,(mlist[random_num(0,1)]),vname,kname)
            }
        }
    }
}
        
stock bool:fm_is_ent_visible(index, entity) {
    new Float:origin[3], Float:view_ofs[3], Float:eyespos[3]
    pev(index, pev_origin, origin)
    pev(index, pev_view_ofs, view_ofs)
    xs_vec_add(origin, view_ofs, eyespos)

    new Float:entpos[3]
    pev(entity, pev_origin, entpos)
    engfunc(EngFunc_TraceLine, eyespos, entpos, 0, index)

    switch (pev(entity, pev_solid)) {
        case SOLID_BBOX..SOLID_BSP: return global_get(glb_trace_ent) == entity
    }

    new Float:fraction
    global_get(glb_trace_fraction, fraction)
    if (fraction == 1.0)
        return true

    return false
}
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
stupok
Veteran Member
Join Date: Feb 2006
Old 12-30-2006 , 13:11   Re: wall kill scripting help
Reply With Quote #2

You have to check not only if the attacker is not visible, but if the attacker is another player. So check if the attacker is alive or connected. If the player commits suicide or switches teams, the "attacker" may not be visible.
stupok is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 12-30-2006 , 13:31   Re: wall kill scripting help
Reply With Quote #3

something like this ?
Code:
#include <amxmodx>
#include <fakemeta>
#include <xs>

new const PLUGIN[] = "Wall Shot"
new const VERSION[] = "0.1"
new const AUTHOR[] = "SAMURAI"

new mWallKills[33]
new cvartipe
new cvarduration

new mlist[2][]=
{
    "%s killed %s trough wall !",
    "%s killed %s with him Wallhack :)"
}

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_event("DeathMsg", "deathMSG", "a")
    cvartipe = register_cvar("wallshot_showtype","1")
    cvarduration = register_cvar("wallshot_hudtime","5.0") // time in seconds
    
}

public deathMSG()
{
    new iAttacker = read_data(1)
    new iVictim = read_data(2)
    new kname[32], vname[32]
    get_user_name(iVictim,kname,31) 
    get_user_name(iAttacker,vname,31) 
    
    new bool:qVisible = fm_is_ent_visible(iAttacker, iVictim)
    if ((qVisible) && !is_user_connected(iAttacker) && !is_user_alive(iAttacker)) 
    {
        return PLUGIN_HANDLED
}
    
    if ((!qVisible) && !(iAttacker == iVictim) && is_user_alive(iAttacker) && is_user_connected(iAttacker))
    {
        mWallKills[iAttacker]++
        switch (get_pcvar_num(cvartipe))
        {
            case 1:
            {
                set_hudmessage(0, 0, 255, 0.28, 0.26, 0, 6.0, get_pcvar_float(cvarduration))
                show_hudmessage(0,(mlist[random_num(0,1)]),vname,kname)
            }
            case 2:
            {
                client_print(0,print_chat,(mlist[random_num(0,1)]),vname,kname) 
            }
            case 3:
            {
                client_print(0,print_center,(mlist[random_num(0,1)]),vname,kname)
            }
        }
    }
    return PLUGIN_CONTINUE
}
        
stock bool:fm_is_ent_visible(index, entity) {
    new Float:origin[3], Float:view_ofs[3], Float:eyespos[3]
    pev(index, pev_origin, origin)
    pev(index, pev_view_ofs, view_ofs)
    xs_vec_add(origin, view_ofs, eyespos)

    new Float:entpos[3]
    pev(entity, pev_origin, entpos)
    engfunc(EngFunc_TraceLine, eyespos, entpos, 0, index)

    switch (pev(entity, pev_solid)) {
        case SOLID_BBOX..SOLID_BSP: return global_get(glb_trace_ent) == entity
    }

    new Float:fraction
    global_get(glb_trace_fraction, fraction)
    if (fraction == 1.0)
        return true

    return false
}
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
stupok
Veteran Member
Join Date: Feb 2006
Old 12-30-2006 , 13:46   Re: wall kill scripting help
Reply With Quote #4

Looks good, check the results. However:

Code:
!(something == anothersomething)
Should be replaced with:

Code:
something != anothersomething
stupok is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 12-30-2006 , 13:47   Re: wall kill scripting help
Reply With Quote #5

ya works thanks man
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode