Xeonmeister Posted February 7, 2016 Share Posted February 7, 2016 I did a little searching but what i found is not working for me. I'm a noob in lua, i started scripting in lua 2 days ago, so can you explain me how to do this? Link to comment
Simple0x47 Posted February 7, 2016 Share Posted February 7, 2016 You could take the source of the damage, and cancel the damage event. Contact me on my skype: killer.68x I sell RP Gamemode with UPC too! Link to comment
Bonus Posted February 7, 2016 Share Posted February 7, 2016 You can use cancelEvent in onClientPlayerDamage. Weapon ID should be 54 I think. Link to comment
Xeonmeister Posted February 7, 2016 Author Share Posted February 7, 2016 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. Link to comment
Dimos7 Posted February 7, 2016 Share Posted February 7, 2016 (edited) addEventHandler("onClientPlayerDamage", root, function(wp) if wp == 54 then cancelEvent() end end ) Edited February 7, 2016 by Guest Link to comment
Bonus Posted February 7, 2016 Share Posted February 7, 2016 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. Link to comment
Xeonmeister Posted February 7, 2016 Author Share Posted February 7, 2016 i made a .lua, put the code in it and added to meta with type "client" but still doesn't work. Link to comment
Dimos7 Posted February 7, 2016 Share Posted February 7, 2016 addEventHandler("onPlayerDamage", root, function(wp) if wp == 54 then cancelEvent() end end) <meta> <script src"server.lua" type="server"/> </meta> Link to comment
Xeonmeister Posted February 7, 2016 Author Share Posted February 7, 2016 Thanks Dimos, but the type is wrong there. I did it as i said, and it didn't work. I did it again and now it's magically working. Thanks for your help! Link to comment
Bonus Posted February 7, 2016 Share Posted February 7, 2016 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. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now