so on my darkrp dedicated server I am trying to create a class that recieves no fall damage. The class jumps extremely high so I need the player to come down with no fall damage, but I cant set the overall game to no fall damage. I’m not sure if or how to create a function for this, where to put it, or what to do with it. Can someone please help me with finding out how to make a class receive no fall damage
Just make a severside lua file, hook into the FallDamage hook and check if the player is on a specific team, after return false/nil.
also, this is developer discussiob, jobs arnt clasified as ‘developig’
Well, since this was never properly answered, here’s 2 different ways to do this.
//In EntityTakeDamage hook
//Make sure the entity is a player first.
if( ply_job == JOB ) then //Alternatively just use a table for neatness if you’re doing this to multiple jobs.
dmginfo:SetDamage( 0 ); //Set the damage to 0. dmginfo is the second argument in the hook.
if( ply_job == JOB ) then
return 0; //GetFallDamage returns a number for what the damage should be.
Thank you so much greetings!
So i put this into my player.lua under the GetFallDamage section but it didn’t work. Two things, one: is that the correct folder, if not can you tell me the directory for the correct folder. Two: when it says “JOB” is it the command which I have set to “assassinm” or the job team thing which is “TEAM_ASSASSINM”?
Post the code you have currently in
function GM:GetFallDamage( ply, flFallSpeed ) if( GetConVarNumber( "mp_falldamage" ) > 0 ) then -- realistic fall damage is on return ( flFallSpeed - 526.5 ) * ( 100 / 396 ) -- the Source SDK value end if( ply_job == TEAM_ASSASSINM ) then return 0; //GetFallDamage returns a number for what the damage should be. end return 10 end
Change ply_job to ply:Team(). And put that check before the mp_falldamage one
It didn’t work, I attempted to try all varieties of that too, and I put it first.
if( ply:Team() == TEAM_ASSASSINM)
if ply:Team() == (TEAM_ASSASSINM)
none of them worked :C
Are you sure it’s not TEAM_ASSASSIN rather than TEAM_ASSASSINM?
its TEAM_ASSASSINM, for Master Assassin… im just not sure it is calling the class in total
local function nofalldamage(ply, speed) if (ply:Team() == TEAM_ASSASSINM) then return 0 end end hook.Add("GetFallDamage", "nofallassassin", nofalldamage)
Don’t use GM unless you’re making a gamemode. Make sure the file you’re putting this in is ran server side.
I have no idea where to put that, even in a server side file…
Create a file named nofall.lua in the lua/autorun/server folder.
Lolcats your a life saver! It worked, I wish you could see the smile on my face. For future reference, when I wanted to add this to another team, would it generally be the same function but replaced a few tags with this?
local function nofalldamage(ply, speed) if (ply:Team() == TEAM_JUMPER) then return 0 end end hook.Add("GetFallDamage", "nofalljumper", nofalldamage)
You could use tables or be less efficient and use a bunch of elseif statements