Thread: No Fall Damage
View Single Post
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 05-10-2011 , 03:32   Re: No Fall Damage
Reply With Quote #7

Quote:
Originally Posted by TnTSCS View Post
I edited it to add a CVAR to enable/disable it, and received compile warning 209, but it still works and now I can turn it on and off.



I can put the .sp file if you want so you can review and maybe figure out why I'm receiving the warning
added cvar sm_nofalldamage, default value 0 disabled
PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

new Handle:sm_nofalldamage INVALID_HANDLE;
new 
bool:nofalldamage;

#define PLUGIN_VERSION "0.0.1.9"

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

public 
OnPluginStart()
{
    
sm_nofalldamage CreateConVar("sm_nofalldamage""0""Enable/disable player fall damage"FCVAR_NONEtrue0.0true1.0);
    
nofalldamage GetConVarBool(sm_nofalldamage);
    
HookConVarChange(sm_nofalldamageConVarChanged);
}

public 
ConVarChanged(Handle:convar, const String:oldValue[], const String:newValue[])
{
    
nofalldamage GetConVarBool(sm_nofalldamage);
}

public 
OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action:OnTakeDamage(client, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if (
nofalldamage && damagetype DMG_FALL)
    {
        return 
Plugin_Handled;
    }
    return 
Plugin_Continue;

- Then you just add in map config ...maps/cfg/map_name.cfg sm_nofalldamage 1 and reset back sm_nofalldamage 0 from server.cfg

Last edited by Bacardi; 05-10-2011 at 03:35.
Bacardi is offline