AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Fake damage (https://forums.alliedmods.net/showthread.php?t=147632)

Doc-Holiday 01-11-2011 19:16

Fake damage
 
I found a few different methods out there
PHP Code:

ExecuteHamB(Ham_TakeDamageattackerinflictorattackerFloat:damagedamagebits); 

The one above. Does it call Ham_TakeDamage? meaning if i was to use this inside of Ham_TakeDamage callback would it make a loop and kill the person?

PHP Code:

#include <amxmodx>
#include <hamsandwich>

new dmg_reducerdmg_mirrorbool:gBotsRegistered;


public 
plugin_init( )
{
    
register_plugin"Variable Friendly Fire""1.7""=(GrG)= Doc Holiday" );

    
RegisterHamHam_TakeDamage"player""PlayerHurt");
    
    
dmg_reducer get_cvar_pointer("mp_friendlyfire");
    
dmg_mirror get_cvar_pointer("mp_mirrordamage");

}

public 
client_authorizedid )
{
    if( !
gBotsRegistered && is_user_botid ) )
    {
        
set_task0.1"register_bots"id );
    }
}

public 
register_botsid )
{
    if( !
gBotsRegistered && is_user_connectedid ) )
    {
        
RegisterHamFromEntityHam_TakeDamageid"PlayerHurt");
        
gBotsRegistered true;
    }
}


public 
PlayerHurtvictiminflictorattackerFloat:damagedamagebits )
{

    if(
is_user_connectedattacker // Makes sure valid target
    
&& get_user_team(attacker) == get_user_team(victim)) //Checks if the same team
    
{
        if(
get_pcvar_num(dmg_mirror))
        {
            
SetHamParamFloat(4, (damage 2.86 ) * floatclamp(get_pcvar_float(dmg_reducer), 0.01.0));
            
ExecuteHamB(Ham_TakeDamageattackerinflictorattackerFloat:damagedamagebits);
        }
        else
        {
            
SetHamParamFloat(4, (damage 2.86 ) * floatclamp(get_pcvar_float(dmg_reducer), 0.01.0));
        }
    }



Bugsy 01-11-2011 21:24

Re: Fake damage
 
Why don't you test it yourself?

ConnorMcLeod 01-12-2011 01:36

Re: Fake damage
 
ExecuteHamB calls all hooks, so yes your callback will be called.
If you check if victim is different from attacker, then your call back will be just call twice when there is a team attack.

Doc-Holiday 01-12-2011 18:50

Re: Fake damage
 
Quote:

Originally Posted by ConnorMcLeod (Post 1391798)
ExecuteHamB calls all hooks, so yes your callback will be called.
If you check if victim is different from attacker, then your call back will be just call twice when there is a team attack.

To bugs... i did.. but the one shot killed me.. thats why i asked if it loops...

and thanks.... ill have to check why it kills me thanks


All times are GMT -4. The time now is 01:57.

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