Forum
No self gauss - Printable Version

+- Forum (https://dm20.net/forum)
+-- Forum: Scripting (https://dm20.net/forum/forumdisplay.php?fid=5)
+--- Forum: Showcase (https://dm20.net/forum/forumdisplay.php?fid=6)
+--- Thread: No self gauss (/showthread.php?tid=7)



No self gauss - marcudaniel1337 - 07-28-2024

This is a HLDM plugin that prevents the player from killing himself from firing gauss.

Code:
#include <amxmodx>
#include <hamsandwich>
#include <engine>

#define PLUGIN "Gauss"
#define VERSION "1.0"
#define AUTHOR "sToP !"

new  e_class[64]

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
    if(attacker != victim || !(1 <= attacker <= 32) )
        return HAM_IGNORED

    entity_get_string(inflictor, EV_SZ_classname, e_class, 63)
   
    if (attacker == inflictor || equal(e_class, "weapon_gauss"))
    {
        return HAM_SUPERCEDE
    }
    return HAM_IGNORED
}