AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   No shoot through wall (https://forums.alliedmods.net/showthread.php?t=326086)

Ykaru 07-17-2020 18:39

No shoot through wall
 
Hi, I need a plugin that won't let you shoot through the glass.
I searched a lot but I cant find one.
Thank you

MagNNusS 07-18-2020 14:10

Re: No shoot through wall
 
PHP Code:

/* Sublime AMXX Editor v2.2 */

#include <amxmodx>
// #include <amxmisc>
// #include <cstrike>
// #include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
// #include <xs>
// #include <dhudmessage>

new const PluginAuthority[][] =
{
    
"No damage through glasses",
    
"0.0.1",
    
"SayWhat?!"
}

public 
plugin_init()
{
    
register_plugin(PluginAuthority[0], PluginAuthority[1], PluginAuthority[2])
    
RegisterHam(Ham_TraceAttack"func_wall""Ham_PlayerTraceAttackPre"false)
}

public 
Ham_PlayerTraceAttackPre(entattackerfloat:damageFloat:direction[3], tracebits)
{
    if(!
is_user_alive(attacker) || ~bits DMG_BULLET)
        return 
HAM_IGNORED

    
if(pev(entpev_rendermode) != kRenderNormal)
    {
        
set_user_hitzones(attacker00)
        return 
HAM_SUPERCEDE
    
}

    return 
HAM_HANDLED


Or you can use this one, but it supports walls, glass etc.

Ykaru 07-18-2020 15:04

Re: No shoot through wall
 
Quote:

Originally Posted by MagNNusS (Post 2710621)
PHP Code:

/* Sublime AMXX Editor v2.2 */

#include <amxmodx>
// #include <amxmisc>
// #include <cstrike>
// #include <engine>
#include <fakemeta>
#include <hamsandwich>
// #include <fun>
// #include <xs>
// #include <dhudmessage>

new const PluginAuthority[][] =
{
    
"No damage through glasses",
    
"0.0.1",
    
"SayWhat?!"
}

public 
plugin_init()
{
    
register_plugin(PluginAuthority[0], PluginAuthority[1], PluginAuthority[2])
    
RegisterHam(Ham_TraceAttack"func_wall""Ham_PlayerTraceAttackPre"false)
}

public 
Ham_PlayerTraceAttackPre(entattackerfloat:damageFloat:direction[3], tracebits)
{
    if(!
is_user_alive(attacker) || ~bits DMG_BULLET)
        return 
HAM_IGNORED

    
if(pev(entpev_rendermode) != kRenderNormal)
    {
        
set_tr(TR_vecEndPosFloat:{ 4096.04096.04096.0 })
        
set_tr(TR_pHit0)
        
set_tr(TR_iHitgroup0)
        
set_tr(TR_flFraction1.0)
        return 
HAM_SUPERCEDE
    
}

    return 
HAM_HANDLED


Or you can use this one, but it supports walls, glass etc.

The one you gave me causes the server to crash when I shoot a bullet.
And the one on the link doesn't work.

MagNNusS 07-19-2020 06:17

Re: No shoot through wall
 
Check the code, now I've realized my mistake.


All times are GMT -4. The time now is 10:19.

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