Jump to content

How to cancel falling damage?


Xeonmeister

Recommended Posts

Posted

wow, you guys are really helpful. Okay, the problem is that i've already found this solution, but i get errors when i use it.

For example this one:

addEventHandler("onClientPlayerDamage", localPlayer, 
function(_, wp) 
    if wp == 54 then -- 54 is the fall id. 
        cancelEvent() 
    end 
end) 

It says that localPlayer is a nil value and since i'm a noob i don't know what to do with it.

Posted (edited)
addEventHandler("onClientPlayerDamage", root, 
   function(wp) 
       if wp == 54 then 
          cancelEvent() 
       end 
    end 
) 

Edited by Guest
Posted
wow, you guys are really helpful. Okay, the problem is that i've already found this solution, but i get errors when i use it.

For example this one:

addEventHandler("onClientPlayerDamage", localPlayer, 
function(_, wp) 
    if wp == 54 then -- 54 is the fall id. 
        cancelEvent() 
    end 
end) 

It says that localPlayer is a nil value and since i'm a noob i don't know what to do with it.

What?

Does it really say localPlayer is a nil value?

Then you put it serversided - put it clientsided with type="client"

But the code is correct, the code from Dimos7 is wrong.

Posted
addEventHandler("onPlayerDamage", root, 
     function(wp) 
         if wp == 54 then 
            cancelEvent() 
         end 
     end) 

<meta> 
     <script src"server.lua" type="server"/> 
</meta> 

Posted
no problem mate

Sorry, but both of your posts were wrong.

In the 1. post you put root in - thats stupid.

Then you put wp as 1. argument - but 1. argument in onClientPlayerDamage is attacker, not weapon.

In your 2. post you use onPlayerDamage.

You can't cancel onPlayerDamage, only onClientPlayerDamage.

Then you do the same mistake with wp and 1. argument again.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...