AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   No Fall Damage (https://forums.alliedmods.net/showthread.php?t=138748)

pa1nq3 09-22-2010 02:17

No Fall Damage
 
2 Attachment(s)
I used the code provided in the script forum.. I credited the author for the use of his code in the plugin..

The only reason I posted this is because I run a zombiemod server and players falling to their death before the first zombie spawn was causing issues. Also turning mp_falldamage 0 does not work with HL2 or CS:S so I had to get something working. Thanks for the post in the script forums as it works quite well.

Requires: SDKhooks

Credits: alexip121093, sourcemod scripting forums.

I added the compiled version as the compiler on the site does not support sdkhooks

gtamike 10-09-2010 08:14

Re: No Fall Damage
 
cool

TnTSCS 05-01-2011 10:50

Re: No Fall Damage
 
can you add a cvar to turn it off or on? That way I can enable it on certain maps and disable it on most others.

TnTSCS 05-09-2011 20:45

Re: No Fall Damage
 
any update on if you can add a cvar to enable or disable it? that way, I don't have to have it running on every map... just those that players get damaged by falling.

TnTSCS 05-09-2011 21:28

Re: No Fall Damage
 
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.

//SourceMod Batch Compiler
// by the SourceMod Dev Team


//// nofalldamage.sp
// C:\srcds\orangebox\cstrike\addons\sourcemod\s cripting\nofalldamage.sp(42) : w
arning 209: function "OnTakeDamage" should return a value
// Header size: 2192 bytes
// Code size: 376 bytes
// Data size: 428 bytes
// Stack/heap size: 16384 bytes; Total requirements: 19380 bytes
//
// 1 Warning.
//
// Compilation Time: 0.55 sec
// ----------------------------------------

Press enter to exit ...

I can put the .sp file if you want so you can review and maybe figure out why I'm receiving the warning

Bacardi 05-10-2011 03:32

Re: No Fall Damage
 
Quote:

Originally Posted by TnTSCS (Post 1466555)
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

TnTSCS 05-10-2011 12:51

Re: No Fall Damage
 
Thanks a million :)

Now I can use a properly edited one instead of mine that had that warning :)

alencore 04-02-2013 01:28

Re: No Fall Damage
 
nice still working. tnx!

stickz 07-23-2015 23:42

Re: No Fall Damage
 
-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;
}


SOBgaming 07-18-2016 16:05

Re: No Fall Damage
 
Does this currently work with CS:GO, didn't seem like it?


All times are GMT -4. The time now is 21:42.

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