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

Solved Help with OnTakeDamage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ShadowMarioBR
Member
Join Date: Feb 2018
Old 07-25-2018 , 19:45   Help with OnTakeDamage
Reply With Quote #1

I tried making my hits while rocketjumping & on ground be crits, but it's not working for some reason


Code:
bool rocketJumping[MAXPLAYERS + 1]; //This line is over "Plugin myinfo" public void TF2_OnConditionAdded(int client, TFCond condition) {     if(condition == TFCond_BlastJumping)     {         rocketJumping[client] = true;     } } public void TF2_OnConditionRemoved(int client, TFCond condition) {     if(condition == TFCond_BlastJumping)     {         rocketJumping[client] = false;     } } public Action OnTakeDamage(int client, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3], int damagecustom) {     if(rocketJumping[attacker] && !(damagetype & DMG_CRIT) && (GetEntityFlags(attacker) & FL_ONGROUND))     {         damagetype|=DMG_CRIT;     } }

Last edited by ShadowMarioBR; 07-26-2018 at 11:26. Reason: Solved by nosoop
ShadowMarioBR is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 07-25-2018 , 22:13   Re: Help with OnTakeDamage
Reply With Quote #2

While rocket jumping and while on the ground? I don't believe you can be both at the same time.
You may want to use or to allow either to crit:

Code:
public Action OnTakeDamage(int client, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3], int damagecustom)
{
    if(TF2_IsPlayerInCondition(attacker, TFCond_BlastJumping) || (GetEntityFlags(attacker) & FL_ONGROUND))
    {
        damagetype|=DMG_CRIT;
        return Plugin_Changed;
    }
}
Unless you omitted it for brevity, don't forget to call SDKHook to hook OnTakeDamage on all the players.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

Last edited by nosoop; 07-25-2018 at 22:18.
nosoop is offline
ShadowMarioBR
Member
Join Date: Feb 2018
Old 07-26-2018 , 11:25   Re: Help with OnTakeDamage
Reply With Quote #3

Quote:
Originally Posted by nosoop View Post
While rocket jumping and while on the ground? I don't believe you can be both at the same time.
Yeah, that was a mistake. It is "Or", like you said.
The main problem was that i forgot about the Plugin_Changed, thank you very much mate!
ShadowMarioBR 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 19:52.


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