View Single Post
eyal282
Veteran Member
Join Date: Aug 2011
Old 10-30-2018 , 06:30   Re: [CS:GO] No Fall Damage (Updated: 02/16/2018)
Reply With Quote #6

Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#pragma newdecls required

#define DMG_FALL   (1 << 5)

public Plugin myinfo =  
{
	name = "[CS:GO] No Fall Damage",
	author = "alexip121093 & Neoxx",
	description = "No Falling Damage & No Fall Damage Sound",
	version = "1.0.1",
	url = "https://forums.alliedmods.net/showthread.php?p=2316188"
}

public void OnPluginStart() 
{
	AddNormalSoundHook(SoundHook);
	
	for(int i=1;i <= MaxClients;i++)
	{
		if(!IsClientInGame(i))
			continue;
			
		SDKHook(i, SDKHook_OnTakeDamage, OnTakeDamage);
	}
}

public void OnClientPutInServer(int client) 
{
	SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}

public Action SoundHook(int clients[64], int &numClients, char sound[PLATFORM_MAX_PATH], int &entity, int &channel, float &volume, int &level, int &pitch, int &flags) 
{
	if(StrContains(sound, "player/damage", false) >= 0)
		return Plugin_Handled;
	
	return Plugin_Continue;
}

public Action OnTakeDamage(int client, int &attacker, int &inflictor, float &damage, int &damagetype) 
{
	if (damagetype & DMG_FALL)
	{
		damage = 0.0;
		return Plugin_Changed;
	}
	return Plugin_Continue;
}
I think setting damage to 0 removes a bug that makes the fun facts of the round say "%N took 500 damage from the earth"
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline