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

[REQ] [CSGO] Nade Heal


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Celty
Junior Member
Join Date: Jun 2015
Old 06-30-2015 , 00:58   [REQ] [CSGO] Nade Heal
Reply With Quote #1

I would like to know if anyone could make a Nade Heal plugin for me, i would pay $10 if it can be done.

The details:
If You or a Teammate is hit by a frag grenade of yours, then you and/or teammate gets +health instaid of -health, so instaid of -60 damage, you would get the opposite (if this part cant be done then we can still work something out)

Although, an enemy would still take normal frag grenade damage.

Post or message me if you can do this.
__________________

Celty is offline
Darkness_
Veteran Member
Join Date: Nov 2014
Old 06-30-2015 , 01:15   Re: [REQ] [CSGO] Nade Heal
Reply With Quote #2

$10 for a simple ~20 line plugin?

Try this, not tested.

PHP Code:
#pragma semicolon 1
#include <sourcemod>


public void OnPluginStart()
{
    
HookEvent("player_hurt"Event_PlayerHurtEventHookMode_Pre);
}

public 
Action Event_PlayerHurt(Event event, const char[] namebool dontBroadcast)
{
    
int victim GetClientOfUserId(GetEventInt(event"userid"));
    
int attacker GetClientOfUserId(GetEventInt(event"attacker"));

    if (!
victim || !attacker || victim MaxClients || attacker MaxClients)
        return 
Plugin_Continue;
    if (
GetClientTeam(victim) != GetClientTeam(attacker))
        return 
Plugin_Continue;

    
char weapon[32];
    
GetEventString(event"weapon"weaponsizeof(weapon));
    if(
StrContains(weapon"hegrenade"false) == -1)
        return 
Plugin_Continue;

    
int health GetEventInt(event"health");
    
int armor GetEventInt(event"armor");
    
int dmg_health GetEventInt(event"dmg_health");
    
int dmg_armor GetEventInt(event"dmg_armor");

    if (
dmg_health 0)
        
SetEntProp(victimProp_Send"m_iHealth", (health dmg_health), 4);
    if (
dmg_armor 0)
        
SetEntProp(victimProp_Send"m_ArmorValue", (armor dmg_armor), 4);

    return 
Plugin_Continue;


Last edited by Darkness_; 06-30-2015 at 01:36. Reason: Tucking fypos.
Darkness_ is offline
Lannister
Veteran Member
Join Date: Apr 2015
Old 06-30-2015 , 01:22   Re: [REQ] [CSGO] Nade Heal
Reply With Quote #3

I'm looking foward this plugin too, seems interesting !
Lannister is offline
Celty
Junior Member
Join Date: Jun 2015
Old 06-30-2015 , 01:26   Re: [REQ] [CSGO] Nade Heal
Reply With Quote #4

Quote:
Originally Posted by Darkness_ View Post
$10 for a simple ~20 line plugin?

Try this, not tested.

PHP Code:
#pragma semicolon 1
#include <sourcemod>


public void OnPluginStart()
{
    
HookEvent("player_hurt"Event_PlayerHurtEventHookMode_Pre);
}

public 
Action Event_PlayerHurt(Event event, const char[] namebool dontBroadcast)
{
    
int victim GetClientOfUserId(GetEventInt(event"userid"));
    
int attacker GetClientOfUserId(GetEventInt(event"attacker"));

    if (!
victim || !attacker || victim MaxClients || attacker MaxClients)
        return 
Plugin_Continue;
    if (
GetClientTeam(victim) != GetClientTeam(attacker))
        return 
Plugin_Continue;

    
int health GetEventInt(event"health");
    
int armor GetEventInt(event"armor");
    
int dmg_health GetEventInt(event"dmg_health");
    
int dmg_armor GetEventInt(event"dmg_armor");
    
char weapon[32];
    
GetEventString(event"weapon"weaponsizeof(weapon));

    if(
StrContains(weapon"hegrenade"false) == -1)
        return 
Plugin_Continue;
    if (
dmg_health 0)
        
SetEntProp(victimProp_Send"m_iHealth", (health dmg_health), 4);
    if (
dmg_armor 0)
        
SetEntProp(victimProp_Send"m_ArmorValue", (armor dmg_armor), 4);

    return 
Plugin_Continue;

It did not seem to work :/
Although it did compile correctly and ran without errors.
__________________

Celty is offline
lay295
Senior Member
Join Date: Sep 2013
Old 06-30-2015 , 02:21   Re: [REQ] [CSGO] Nade Heal
Reply With Quote #5

Just change (Tested and works)

PHP Code:
if (dmg_health 0)
        
SetEntProp(victimProp_Send"m_iHealth", (health dmg_health), 4);
    if (
dmg_armor 0)
        
SetEntProp(victimProp_Send"m_ArmorValue", (armor dmg_armor), 4); 
To:
PHP Code:
if (dmg_health 0)
        
SetEntProp(victimProp_Send"m_iHealth", (health dmg_health dmg_health), 4);
    if (
dmg_armor 0)
        
SetEntProp(victimProp_Send"m_ArmorValue", (armor dmg_armor dmg_armor), 4); 
Because dmg_health and dmg_armor is the value after the damage is already subtracted from their current HP/Armor
__________________


Last edited by lay295; 06-30-2015 at 02:23.
lay295 is offline
Celty
Junior Member
Join Date: Jun 2015
Old 06-30-2015 , 02:48   Re: [REQ] [CSGO] Nade Heal
Reply With Quote #6

Quote:
Originally Posted by lay295 View Post
Just change (Tested and works)

PHP Code:
if (dmg_health 0)
        
SetEntProp(victimProp_Send"m_iHealth", (health dmg_health), 4);
    if (
dmg_armor 0)
        
SetEntProp(victimProp_Send"m_ArmorValue", (armor dmg_armor), 4); 
To:
PHP Code:
if (dmg_health 0)
        
SetEntProp(victimProp_Send"m_iHealth", (health dmg_health dmg_health), 4);
    if (
dmg_armor 0)
        
SetEntProp(victimProp_Send"m_ArmorValue", (armor dmg_armor dmg_armor), 4); 
Because dmg_health and dmg_armor is the value after the damage is already subtracted from their current HP/Armor

Thanks lay, it works great C:

Is there any change i can do to make sure the players health does not go over 100, because it is giving us whatever our current health is + the heal and going over 100 hp.
__________________

Celty is offline
lay295
Senior Member
Join Date: Sep 2013
Old 06-30-2015 , 03:03   Re: [REQ] [CSGO] Nade Heal
Reply With Quote #7

Sure, just change the lines we were talking about earlier to this

PHP Code:
    if (dmg_health 0)
        if(
health dmg_health dmg_health >= 100)
        
SetEntProp(victimProp_Send"m_iHealth"1004);
        else
        
SetEntProp(victimProp_Send"m_iHealth", (health dmg_health dmg_health), 4);
    if (
dmg_armor 0)
        if(
armor dmg_armor dmg_armor >= 100)
        
SetEntProp(victimProp_Send"m_ArmorValue"1004);
        else
        
SetEntProp(victimProp_Send"m_ArmorValue", (armor dmg_armor dmg_armor), 4); 
__________________

lay295 is offline
Celty
Junior Member
Join Date: Jun 2015
Old 06-30-2015 , 03:06   Re: [REQ] [CSGO] Nade Heal
Reply With Quote #8

Quote:
Originally Posted by lay295 View Post
Sure, just change the lines we were talking about earlier to this

PHP Code:
    if (dmg_health 0)
        if(
health dmg_health dmg_health >= 100)
        
SetEntProp(victimProp_Send"m_iHealth"1004);
        else
        
SetEntProp(victimProp_Send"m_iHealth", (health dmg_health dmg_health), 4);
    if (
dmg_armor 0)
        if(
armor dmg_armor dmg_armor >= 100)
        
SetEntProp(victimProp_Send"m_ArmorValue"1004);
        else
        
SetEntProp(victimProp_Send"m_ArmorValue", (armor dmg_armor dmg_armor), 4); 
It just killed me this time around, have no clue why either.
__________________

Celty is offline
Celty
Junior Member
Join Date: Jun 2015
Old 06-30-2015 , 03:07   Re: [REQ] [CSGO] Nade Heal
Reply With Quote #9

Also after playing with it more, if the player has 100 health it will not hurt them, if they have below 100 it will hurt them.
__________________

Celty is offline
Lannister
Veteran Member
Join Date: Apr 2015
Old 06-30-2015 , 12:14   Re: [REQ] [CSGO] Nade Heal
Reply With Quote #10

Looking foward this plugin!
Lannister 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 13:44.


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