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

[TF2] Force players(their ragdolls) to gib


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
luki1412
Veteran Member
Join Date: Oct 2008
Location: OnPluginStart()
Old 10-30-2016 , 18:58   [TF2] Force players(their ragdolls) to gib
Reply With Quote #1

Is there a way to force player ragdolls to gib without creating another ragdoll?

Also, no weapon attributes because I dont want every single ragdoll to gib.
__________________

Last edited by luki1412; 10-30-2016 at 18:59.
luki1412 is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 10-31-2016 , 05:45   Re: [TF2] Force players(their ragdolls) to gib
Reply With Quote #2

If you are familiar with DHooks you can hook the function CTFPlayer::ShouldGib on players.

If you aren't familiar with it I made the hook for you anyway:
Code:
void SDK_Init() {     int iOffset = GameConfGetOffset(hGamedata, "CTFPlayer::ShouldGib");     g_hSDKShouldGib = DHookCreate(iOffset, HookType_Entity, ReturnType_Bool, ThisPointer_CBaseEntity, CTFPlayer_ShouldGib);     DHookAddParam(g_hSDKShouldGib, HookParamType_Unknown);//This is the param CTakeDamageInfo const& but we don't wanna mess with it     if (g_hSDKShouldGib == INVALID_HANDLE)     {         SetFailState("Failed to create hook CTFPlayer::ShouldGib offset from YOUR gamedata!");     } } public MRESReturn CTFPlayer_ShouldGib(int iClient, Handle hReturn, Handle hParams) {     if (IsClientSomethingIcheckInMyPlugin(iClient))     {         if (GetClientTeam(iClient) == 2)         {             DHookSetReturn(hReturn, true);//override the function return, and force the player to gib             return MRES_Supercede;         }         else         {             DHookSetReturn(hReturn, false);//override the function return, and don't allow the player to gib             return MRES_Supercede;         }     }     return MRES_Ignored;//Leave the original function chose the return }
I didn't test it but it should work.
__________________

Last edited by Benoist3012; 10-31-2016 at 05:45.
Benoist3012 is offline
luki1412
Veteran Member
Join Date: Oct 2008
Location: OnPluginStart()
Old 10-31-2016 , 12:27   Re: [TF2] Force players(their ragdolls) to gib
Reply With Quote #3

Quote:
Originally Posted by Benoist3012 View Post
If you are familiar with DHooks you can hook the function CTFPlayer::ShouldGib on players.

If you aren't familiar with it I made the hook for you anyway:
Code:
void SDK_Init() {     int iOffset = GameConfGetOffset(hGamedata, "CTFPlayer::ShouldGib");     g_hSDKShouldGib = DHookCreate(iOffset, HookType_Entity, ReturnType_Bool, ThisPointer_CBaseEntity, CTFPlayer_ShouldGib);     DHookAddParam(g_hSDKShouldGib, HookParamType_Unknown);//This is the param CTakeDamageInfo const& but we don't wanna mess with it     if (g_hSDKShouldGib == INVALID_HANDLE)     {         SetFailState("Failed to create hook CTFPlayer::ShouldGib offset from YOUR gamedata!");     } } public MRESReturn CTFPlayer_ShouldGib(int iClient, Handle hReturn, Handle hParams) {     if (IsClientSomethingIcheckInMyPlugin(iClient))     {         if (GetClientTeam(iClient) == 2)         {             DHookSetReturn(hReturn, true);//override the function return, and force the player to gib             return MRES_Supercede;         }         else         {             DHookSetReturn(hReturn, false);//override the function return, and don't allow the player to gib             return MRES_Supercede;         }     }     return MRES_Ignored;//Leave the original function chose the return }
I didn't test it but it should work.
Was hoping I wouldnt need an extension for this. Thank you though. I'll use it if I cant find a better option.
__________________
luki1412 is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 10-31-2016 , 12:59   Re: [TF2] Force players(their ragdolls) to gib
Reply With Quote #4

Well you can still hook player_death event, find their tf_ragdoll kill it, and remake one with m_bGib on true
__________________
Benoist3012 is offline
luki1412
Veteran Member
Join Date: Oct 2008
Location: OnPluginStart()
Old 10-31-2016 , 14:30   Re: [TF2] Force players(their ragdolls) to gib
Reply With Quote #5

Quote:
Originally Posted by Benoist3012 View Post
Well you can still hook player_death event, find their tf_ragdoll kill it, and remake one with m_bGib on true
Shame DMG_ALWAYSGIB doesnt work. What if I change m_bGib through OnEntityCreated?
__________________
luki1412 is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 10-31-2016 , 14:40   Re: [TF2] Force players(their ragdolls) to gib
Reply With Quote #6

Quote:
Originally Posted by luki1412 View Post
Shame DMG_ALWAYSGIB doesnt work. What if I change m_bGib through OnEntityCreated?
I think that's too earlier to know the owner of the body, and if you request a frame, I believe it will be too late, the client will have created the ragdoll. But worth a shot.
__________________
Benoist3012 is offline
luki1412
Veteran Member
Join Date: Oct 2008
Location: OnPluginStart()
Old 10-31-2016 , 15:00   Re: [TF2] Force players(their ragdolls) to gib
Reply With Quote #7

Quote:
Originally Posted by Benoist3012 View Post
I think that's too earlier to know the owner of the body, and if you request a frame, I believe it will be too late, the client will have created the ragdoll. But worth a shot.
PHP Code:
public void OnEntityCreated(int ent, const char[] classname)
{
    if (
StrEqual(classname"tf_ragdoll"false))
    {
        
SetEntProp(entProp_Send"m_bGib"1);
    }

Doesnt do anything. Am I doing something wrong here?

EDIT: I'll have to kill ragdolls and create new ones that gib.
__________________

Last edited by luki1412; 11-14-2016 at 14:18.
luki1412 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 15:49.


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