AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Block lava / toxic damage (CS) (https://forums.alliedmods.net/showthread.php?t=301547)

Ricky 09-25-2017 16:56

Block lava / toxic damage (CS)
 
Looking for a simple script to block damage or death that occurs on certain custom maps, whether it be a pool of lava or a out of bounds area of the map. This damage is not the same as drowning but similar.

CrazY. 09-25-2017 21:24

Re: Block lava / toxic damage (CS)
 
I think with the "dmg_bits" you can block a specific damage. Example:

Code:
public fw_TakeDamage(const victim, inflictor, const attacker, Float:damage, dmg_bits) {     if (victim != attacker || !is_user_alive(attacker))         return HAM_IGNORED;         // Isn't fall damage?     if (~(dmg_bits & DMG_FALL))         return HAM_IGNORED;         return HAM_SUPERCEDE; }

Ricky 09-25-2017 23:06

Re: Block lava / toxic damage (CS)
 
Thanks for the attempt but it didn't work for my needs! The death type is trigger_hurt and I think there should be several topics regarding this matter.

NiHiLaNTh 09-26-2017 05:36

Re: Block lava / toxic damage (CS)
 
I modified the code above. Also you can play with trigger_hurt's key values and set damage to 0.

Code:

public fw_TakeDamage(const victim, inflictor, const attacker, Float:damage, dmg_bits)
{
    if (!attacker)
        return HAM_IGNORED

    static class[32]
    pev(attacker, pev_classname, class, charsmax(class))
 
    if (equal(class, "trigger_hurt"))
        return HAM_SUPERCEDE

    return HAM_IGNORED;
}


Ricky 09-29-2017 15:19

Re: Block lava / toxic damage (CS)
 
Quote:

Originally Posted by NiHiLaNTh (Post 2550919)
I modified the code above. Also you can play with trigger_hurt's key values and set damage to 0.

Code:

public fw_TakeDamage(const victim, inflictor, const attacker, Float:damage, dmg_bits)
{
    if (!attacker)
        return HAM_IGNORED

    static class[32]
    pev(attacker, pev_classname, class, charsmax(class))
 
    if (equal(class, "trigger_hurt"))
        return HAM_SUPERCEDE

    return HAM_IGNORED;
}


Solved. Thank you!


All times are GMT -4. The time now is 09:17.

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