Raised This Month: $32 Target: $400
 8% 

Restore an amout off taken fall damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rineek
Member
Join Date: Jan 2018
Old 01-15-2019 , 13:14   Restore an amout off taken fall damage
Reply With Quote #1

Hi

I'm looking for Fall Damage HP Restore for CSGO. When you take damage from world (ground) you get back(you get restored) a certain amount of damage

Last edited by Rineek; 01-15-2019 at 14:32.
Rineek is offline
Nomad_pl
New Member
Join Date: Nov 2018
Old 01-15-2019 , 15:27   Re: Restore an amout off taken fall damage
Reply With Quote #2

I have absolutely no clue if this will work but try it out, the sm_falldamage_restore cvar determines the health to restore.
Attached Files
File Type: sp Get Plugin or Get Source (falldamageheal.sp - 175 views - 988 Bytes)

Last edited by Nomad_pl; 01-15-2019 at 15:30.
Nomad_pl is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-15-2019 , 16:24   Re: Restore an amout off taken fall damage
Reply With Quote #3

Here quick sample.
- Red screen fade when fall damage.
- If player survive after fall, player health restore half of fall damage.
PHP Code:


#include <sdkhooks>
#include <sdktools>
#include <cstrike>

public void OnPluginStart()
{
    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i)) OnClientPutInServer(i);
    }
}

public 
void OnClientPutInServer(int client)
{
    
SDKHook(clientSDKHook_OnTakeDamageAlivePostOnTakeDamageAlivePost);
}

public 
void OnTakeDamageAlivePost(int victimint attackerint inflictorfloat damageint damagetype)
{
    if(
attacker != || attacker != inflictor || damagetype != DMG_FALL) return;

    if(
GetClientHealth(victim) <= 0) return;

    
DataPack pack;
    
CreateDataTimer(0.5regpackTIMER_FLAG_NO_MAPCHANGE);
    
pack.WriteCell(GetClientUserId(victim));
    
pack.WriteFloat(damage);
    
pack.Reset();



    
int duration 255;
    
int hold_time 128;
    
int flags 0x0001;
    
int clr[4];
    
clr[0] = 255;
    
clr[1] = 0;
    
clr[2] = 0;
    
clr[3] = 255;



    
Protobuf fade view_as<Protobuf>(StartMessageOne("Fade"victim));
    
fade.SetInt("duration"duration);
    
fade.SetInt("hold_time"hold_time);
    
fade.SetInt("flags"flags);
    
fade.SetColor("clr"clr);
    
EndMessage();

    return;
}

public 
Action reg(Handle timerDataPack pack)
{
    
int victim GetClientOfUserId(pack.ReadCell());

    if(
victim == || !IsClientInGame(victim) || !IsPlayerAlive(victim)) return Plugin_Stop;

    
int heal RoundFloat(pack.ReadFloat());
    
SetEntityHealth(victimGetClientHealth(victim) + heal/2);
    return 
Plugin_Continue;

__________________
Do not Private Message @me
Bacardi is offline
Nomad_pl
New Member
Join Date: Nov 2018
Old 01-16-2019 , 00:42   Re: Restore an amout off taken fall damage
Reply With Quote #4

Also, I was being stupid in my last one and forgot to add the original health onto the restore ammount, meaning right now it just sets you to 15 HP no matter what... I would go with bacardis solution, or I can edit mine if you want me to...
Nomad_pl is offline
Rineek
Member
Join Date: Jan 2018
Old 01-16-2019 , 01:30   Re: Restore an amout off taken fall damage
Reply With Quote #5

Bacardi, Nomad_pl Thank you
Rineek is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 01-16-2019 , 09:11   Re: Restore an amout off taken fall damage
Reply With Quote #6

PHP Code:
sv_falldamage_scale 0.5 
You can control the fall damage with this cvar, if you don't need at all the restore thing.
0 = no fall damage, 1 = normal fall damage.
__________________

Last edited by Ilusion9; 01-16-2019 at 09:25.
Ilusion9 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:14.


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