Raised This Month: $ Target: $400
 0% 

Add max health


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eyal282
Veteran Member
Join Date: Aug 2011
Old 04-13-2019 , 15:13   Re: Add max health
Reply With Quote #1

Check my plugin when I set the VIP's max health, CS:GO but should work for all games.

https://forums.alliedmods.net/showth...47#post2644547

If I recall correctly:

SetEntProp(client, Prop_Send, "m_iMaxHealth", 500);
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-13-2019 , 16:56   Re: Add max health
Reply With Quote #2

Quote:
Originally Posted by eyal282 View Post
Check my plugin when I set the VIP's max health, CS:GO but should work for all games.

https://forums.alliedmods.net/showth...47#post2644547

If I recall correctly:

SetEntProp(client, Prop_Send, "m_iMaxHealth", 500);
Actually, it doesn't work for all games. Not sure about L4D1/2, but it definitely doesn't work in TF2.

SDKHooks has a callback that works on all Valve games, though: SDKHook_GetMaxHealth

I haven't used it, but it should look something like this:

PHP Code:
// At the top of the plugin
#include <sdkhooks>

// Elsewhere in the plugin
public void OnClientPostAdminCheck(int client)
{
    
// Replace ADMFLAG_RESERVATION with whatever access level your VIPs have
    // or use the "vip" override
    
if (CheckCommandAccess(client"vip"ADMFLAG_RESERVATIONtrue))
    {
        
SDKHook(clientSDKHook_GetMaxHealthSetMaxHealth);
    }
}

public 
Action SetMaxHealth(int entityint &maxhealth)
{
    
// We already checked if they're a VIP before hooking them
    
maxhealth 500;
    return 
Plugin_Changed;

Edit: If you expect VIP status to change during a game, you can just hook all players in OnClientPutInGame and move the VIP check to the callback.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 04-13-2019 at 16:58.
Powerlord 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 06:02.


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