Raised This Month: $51 Target: $400
 12% 

Solved [TF2] OnTakeDamage damage value help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Ravrob
Junior Member
Join Date: Oct 2019
Location: The Ice
Old 07-15-2020 , 20:32   [TF2] OnTakeDamage damage value help
Reply With Quote #1

I'm trying to create a script that will allow players to leech health under certain conditions and what I wrote does that just fine, only if you call the damage parameter it'll return some huge insane number that creates unstoppable juggernauts, not exactly my intentions. Is there any way to convert this into a normal usable number or am I missing something? Any help would be appreciated.

PHP Code:
public void OnClientPutInServer(int client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3], int damagecustom)
{
    if (
attacker <= || attacker MaxClients)
    { 
        return 
Plugin_Continue;
    }
    
int vHealth GetClientHealth(attacker);
    
int color[4];
    
GetEntityRenderColor(attackercolor[0], color[1], color[2], color[3]);
    
PrintToChatAll("%N dealt %i damage."attackerdamage);
    if(
attacker && color[0] == 210 && vitim != attacker)
    {
        if(
TF2_GetPlayerClass(attacker) == TFClass_Heavy && vHealth 300)
        {
            
SetEntProp(attackerProp_Send"m_iHealth"vHealth damage1);
        }
        if(
TF2_GetPlayerClass(attacker) == TFClass_Scout && vHealth 150)
        {
            
SetEntProp(attackerProp_Send"m_iHealth"vHealth damage1);
        }
    }
    return 
Plugin_Continue;


Last edited by Ravrob; 07-16-2020 at 06:25.
Ravrob is offline
 



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 09:05.


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