Thread: No Fall Damage
View Single Post
stickz
Senior Member
Join Date: Oct 2012
Location: Ontario, Canada
Old 07-23-2015 , 23:42   Re: No Fall Damage
Reply With Quote #9

-Added convar support with transitional syntax. (sm 1.7.x required)
-Improved code efficiency

Code:
#include <sourcemod>
#include <sdkhooks>

#define PLUGIN_VERSION "0.0.1.9"

ConVar g_NoFallDamage;

public Plugin:myinfo = 
{
	name = "No Fall Damage",
	author = "alexip121093",
	description = "no falling damage",
	version = PLUGIN_VERSION,
	url = "www.sourcemod.net"
}

#define DMG_FALL   (1 << 5)

public OnPluginStart()
{
	g_NoFallDamage = CreateConVar("sm_nofalldamage", "1", "Enable/disable player fall damage", FCVAR_NONE, true, 0.0, true, 1.0);
}

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

public Action:OnTakeDamage(client, &attacker, &inflictor, &Float:damage, &damagetype)
{
	return g_NoFallDamage.BoolValue && damagetype & DMG_FALL ? Plugin_Handled : Plugin_Continue;
}

Last edited by stickz; 07-23-2015 at 23:49.
stickz is offline