AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [TESTING] No Wall Bullets (https://forums.alliedmods.net/showthread.php?t=40394)

GHW_Chronic 06-26-2006 23:23

[TESTING] No Wall Bullets
 
1 Attachment(s)
Made this plugin so that you can restrict people from shooting through walls. simply set mp_wallshots to 0 (default) and people SHOULDNT be able to shoot through walls. Needs testing which is why it is here. Please get back to me on this.

Cheap_Suit 06-26-2006 23:31

Re: [TESTING] No Wall Bullets
 
I think this is a better and easier way. Credits goes to VEN

Code:

public FW_TraceLine(Float:v1[3], Float:v2[3], noMonsters, id)

    if(!is_user_connected(id) || !is_user_alive(id))
        return FMRES_IGNORED
   
    new victim = get_tr(TR_pHit)
    if(!is_user_connected(victim) || !is_user_alive(victim))
        return FMRES_IGNORED

    if(!fm_is_ent_visible(id, victim)) {
        set_tr(TR_flFraction, 1.0)
    }
    return FMRES_IGNORED
}

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
}


allenwr 06-26-2006 23:44

Re: [TESTING] No Wall Bullets
 
I had this idea a while ago, back before i knew anything about scripting...

Good Job on making it

VEN 06-27-2006 12:34

Re: [TESTING] No Wall Bullets
 
PHP Code:

register_event("Damage","Damage","3=DMG_BULLET"

Will not work at least for 2 reasons:

1. Macros is igoned by precompiler if it's inside a string, so you have to convert intiger constant to a string or hardcode it.

2. Flag isn't specified (event type: global/specified).


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

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