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

TF2 Health 200+


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 06-23-2014 , 18:46   TF2 Health 200+
Reply With Quote #1

Is there any way to increase the life of a player to greater than 200, without it be decreasing?

I searched and did not find, I have tried timers but could not.

Thanks.
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM
rodrigo286 is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 06-23-2014 , 19:02   Re: TF2 Health 200+
Reply With Quote #2

Use TF2Items or TF2Attributes and apply an attribute such as "hidden maxhealth non buffed" or "max health additive bonus" on one of their weapons or the player.
__________________
pheadxdll is offline
keyboard1333
Senior Member
Join Date: Aug 2013
Old 06-23-2014 , 21:36   Re: TF2 Health 200+
Reply With Quote #3

Code:
new currentHealth = GetEntProp(client, Prop_Data, "m_iMaxHealth");
        new newHealth = currentHealth + 200;
        TF2Attrib_SetByName(client, "max health additive bonus", float(newHealth) - currentHealth);
        SetEntProp(client, Prop_Data, "m_iMaxHealth", newHealth);
        SetEntityHealth(client, newHealth);
You can use that to increase their health. If you want to do it on spawn hook post_inventory_application and then call a timer of 0.0.
keyboard1333 is offline
Tylerst
Veteran Member
Join Date: Oct 2010
Old 06-23-2014 , 22:09   Re: TF2 Health 200+
Reply With Quote #4

I use SDKHooks OnGetMaxHealth on my server. Haven't had any problems so far.

PHP Code:
#pragma semicolon 1

#include <sdkhooks>

public Plugin:myinfo =
{
    
name "TF2 Set Health",
    
author "Tylerst",
    
description "Set player Base HP",
    
version "1.0.2",
    
url "None"
}

new 
g_iHealth[MAXPLAYERS+1] = 0;

public 
OnPluginStart()
{
    
RegAdminCmd("sm_sethealth"Command_SetHealthADMFLAG_SLAY"Set Player Health");
}

public 
OnClientPutInServer(client)
{
    
g_iHealth[client] = 0;
    
SDKHook(clientSDKHook_GetMaxHealthOnGetMaxHealth);
}

public 
Action:OnGetMaxHealth(entity, &maxhealth)
{
    new 
client entity;
    if(!
IsValidClient(client)) return Plugin_Continue;
    if(!
g_iHealth[client]) return Plugin_Continue;
    
maxhealth g_iHealth[client];
    return 
Plugin_Changed;
}

public 
Action:Command_SetHealth(clientargs)
{
    if(
args != 2)
    {
        
ReplyToCommand(client"[SM] Usage: sm_sethealth \"target\" \"amount\"");
        return 
Plugin_Handled;
    }

    new 
String:strTarget[MAX_TARGET_LENGTH], String:strHealth[8], iHealthString:target_name[MAX_TARGET_LENGTH],target_list[MAXPLAYERS], target_countbool:tn_is_ml;
    
GetCmdArg(1strTargetsizeof(strTarget));
    if((
target_count ProcessTargetString(strTargetclienttarget_listMAXPLAYERSCOMMAND_FILTER_CONNECTEDtarget_namesizeof(target_name), tn_is_ml)) <= 0)
    {
        
ReplyToTargetError(clienttarget_count);
        return 
Plugin_Handled;
    }

    
GetCmdArg(2strHealthsizeof(strHealth));
    
iHealth StringToInt(strHealth);
    for(new 
i=0;i<target_count;i++)
    {
        
g_iHealth[target_list[i]] = iHealth;
        
SetEntityHealth(clientg_iHealth[client]);
    }

    
ShowActivity2(client"[SM] ","Set health of %s to %i"target_name);    

    return 
Plugin_Handled;
}

stock bool:IsValidClient(clientbool:bCheckAlive=true)
{
    if(
client || client MaxClients) return false;
    if(!
IsClientInGame(client)) return false;
    if(
IsClientSourceTV(client) || IsClientReplay(client)) return false;
    if(
bCheckAlive) return IsPlayerAlive(client);
    return 
true;


Last edited by Tylerst; 06-23-2014 at 22:09.
Tylerst is offline
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 06-23-2014 , 22:09   Re: TF2 Health 200+
Reply With Quote #5

Thanks for methods.

SOLVED =)
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM
rodrigo286 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-24-2014 , 09:45   Re: TF2 Health 200+
Reply With Quote #6

Quote:
Originally Posted by keyboard1333 View Post
Code:
new currentHealth = GetEntProp(client, Prop_Data, "m_iMaxHealth");
        new newHealth = currentHealth + 200;
        TF2Attrib_SetByName(client, "max health additive bonus", float(newHealth) - currentHealth);
        SetEntProp(client, Prop_Data, "m_iMaxHealth", newHealth);
        SetEntityHealth(client, newHealth);
You can use that to increase their health. If you want to do it on spawn hook post_inventory_application and then call a timer of 0.0.
You only need to do the TF2Attrib_SetByName. The game does the rest for you when the item is refreshed (which SetByName does automatically).

The only exception is if you're adjusting weapon max ammo... it won't be fixed the first time.
__________________
Not currently working on SourceMod plugin development.
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:38.


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