Raised This Month: $ Target: $400
 0% 

Ham Take Damage help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 09-28-2009 , 02:22   Ham Take Damage help
Reply With Quote #1

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

Doc-Holiday is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 09-28-2009 , 05:00   Re: Ham Take Damage help
Reply With Quote #2

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.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!

Last edited by Xellath; 09-28-2009 at 05:02.
Xellath is offline
3Di
Member
Join Date: Sep 2009
Location: #php_title
Old 09-28-2009 , 08:51   Re: Ham Take Damage help
Reply With Quote #3

You're never checking if the client is a bot..
3Di is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 09-28-2009 , 10:25   Re: Ham Take Damage help
Reply With Quote #4

Quote:
Originally Posted by 3Di View Post
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
Doc-Holiday is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-28-2009 , 11:57   Re: Ham Take Damage help
Reply With Quote #5

Bots cannot be hooked with Ham_TakeDamage.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 09-28-2009 , 14:44   Re: Ham Take Damage help
Reply With Quote #6

Quote:
Originally Posted by Exolent[jNr] View Post
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?
Doc-Holiday is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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