Quote:
Originally Posted by TnTSCS
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_NONE, true, 0.0, true, 1.0);
nofalldamage = GetConVarBool(sm_nofalldamage);
HookConVarChange(sm_nofalldamage, ConVarChanged);
}
public ConVarChanged(Handle:convar, const String:oldValue[], const String:newValue[])
{
nofalldamage = GetConVarBool(sm_nofalldamage);
}
public OnClientPutInServer(client)
{
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
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