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

[TF2] Problem with pushback, damage & damagetype


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Facksy
Senior Member
Join Date: Apr 2017
Location: +2+2
Old 07-28-2018 , 07:58   [TF2] Problem with pushback, damage & damagetype
Reply With Quote #1

Hello guys, I got a problem with my code using SDK_HooksOnTakeDamage(),
What I want to do is to 1st set to all clients a lot of hp, after that, i use the above native to increase the damage received by players if they are low hp, but the thing which is interest me here is the pushback done by weapons which increase with the damage amount, so actually it works well along that, players received more and more damage and more and more pushback.
The problem come when the client is about to die, actually i dont want it to die, but just receive a big pushback:

Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype) 
{
    if(damage > iHealth)
    {
        SetEntityHealth(victim, 10300);
        damage = 10000;
        damagetype &= ~DMG_PREVENT_PHYSICS_FORCE;
        RequestFrame(clb, victim);
        return Plugin_Changed;
    }
}

void clb(client)
{
	SetEntityHealth(client, 300);
}
Its set hp correctly but there isnt any pushback there, the client isnt pushed, can you help me? Or is there any other way to set pushback
__________________
My Steam I take private requests if related with TF2
My Plugins

Last edited by Facksy; 07-28-2018 at 09:00.
Facksy is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 07-28-2018 , 10:54   Re: [TF2] Problem with pushback, damage & damagetype
Reply With Quote #2

Your code literally makes no sense.

You first set the client's health to 10300, then to 300 and yet on the next frame to 300 again?

Also use "|=", instead of "&= ~".

Return a value on OnTakeDamage, then we gucci. :p
mug1wara is offline
Facksy
Senior Member
Join Date: Apr 2017
Location: +2+2
Old 07-28-2018 , 12:21   Re: [TF2] Problem with pushback, damage & damagetype
Reply With Quote #3

If I did that its because sometimes the client died I didnt know why.
Also why should i use "|="? I want the client to dont block pushback.
__________________
My Steam I take private requests if related with TF2
My Plugins
Facksy is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 07-28-2018 , 12:48   Re: [TF2] Problem with pushback, damage & damagetype
Reply With Quote #4

Quote:
Originally Posted by Facksy View Post
Or is there any other way to set pushback
mug1wara 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 09:03.


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