AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ham Take Damage help (https://forums.alliedmods.net/showthread.php?t=104831)

Doc-Holiday 09-28-2009 02:22

Ham Take Damage help
 
So what the code below does is for humans only removes friendly fire completly

how ever bots still remain getting damaged by friendly fire any ideas?


PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN    "Variable Friendly Fire"
#define AUTHOR    "David"
#define VERSION    "1.0"

new dmg_reduce;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
dmg_reduce register_cvar("dmg_var""0.0")
    
    
RegisterHamHam_TakeDamage "player" "PlayerHurt"0);
}

public 
PlayerHurtvictim,inflictor,attacker,Float:damageDamageBits )
{
    if(
is_user_alive(victim) && is_user_alive(attacker) && cs_get_user_team(victim""0) == cs_get_user_team(attacker""0))
    {
        
SetHamParamFloat(4damage get_pcvar_float(dmg_reduce));
    }
    return 
HAM_IGNORED



Xellath 09-28-2009 05:00

Re: Ham Take Damage help
 
PHP Code:

#include < amxmodx >
#include < cstrike >
#include < hamsandwich >
 
new const VERSION[ ] = "1.0";
 
public 
plugin_init( )
{
    
register_plugin"Friendly Fire Blocker"VERSION"NcB_Sav" );
 
    
RegisterHamHam_TakeDamage "player" "fwd_HamTakeDamage");
}
 
public 
fwd_HamTakeDamageiClientiInflictoriAttackerFloat:fDamagem_Damagebits )
{
    if ( 
is_user_aliveiClient ) && cs_get_user_teamiClient ) == cs_get_user_teamiAttacker ) )
    {
        return 
HAM_SUPERCEDE;
    }
 
    return 
HAM_IGNORED;


You could do that, or you could simply set 'mp_friendlyfire' to 0.

EDIT: What bots are you using? Because they should obey the 'mp_friendlyfire' cvar.

3Di 09-28-2009 08:51

Re: Ham Take Damage help
 
You're never checking if the client is a bot..

Doc-Holiday 09-28-2009 10:25

Re: Ham Take Damage help
 
Quote:

Originally Posted by 3Di (Post 945708)
You're never checking if the client is a bot..

I dont want it only for bots

and the reason its done the way it is with the multiplyer is for variable damage

say you want friendly fire so ppl dont shoot just any where but you want to make it harder to kill a teammate you set dmg_var to 0.25 and it does 25% of the damage originally.

But it seems to only work on humans..

I also ran a check ith no ifs just print chats and it only worked if i shot another human player

Im thinking it only picks up human player hurts. using ham player hook

Exolent[jNr] 09-28-2009 11:57

Re: Ham Take Damage help
 
Bots cannot be hooked with Ham_TakeDamage.

Doc-Holiday 09-28-2009 14:44

Re: Ham Take Damage help
 
Quote:

Originally Posted by Exolent[jNr] (Post 945858)
Bots cannot be hooked with Ham_TakeDamage.

damn defeats that o well

Hmm know of any other way of setting damage lower using a multiplier that can hook bots?


All times are GMT -4. The time now is 22:37.

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