Gtagasje Posted November 16, 2011 Share Posted November 16, 2011 Hi, I wanna make a script that if you are admin, and for example you press "F1", you cant be damaged, but I dont know how to do this. I think with onClientPlayerDamage, but im not sure. Regards, Gtagasje. Link to comment
^Dev-PoinT^ Posted November 16, 2011 Share Posted November 16, 2011 (edited) use 2 things https://wiki.multitheftauto.com/wiki/IsObjectInACLGroup function StopDamage ( attacker, weapon, bodypart ) cancelEvent() end bindKey ( "F1" , "down" ,StopDamage) addEventHandler ( "onClientPlayerDamage", getLocalPlayer(),StopDamage ) Edited Mojrem that is for body part you noob he want no damage at all Please Read Wiki for few minutes Edited November 16, 2011 by Guest Link to comment
Gtagasje Posted November 16, 2011 Author Share Posted November 16, 2011 Thank you, but how do I need to start it on button hit? Just put bindKey above the eventHandler? Link to comment
IIIIlllllIII Posted November 16, 2011 Share Posted November 16, 2011 Thank you, but how do I need to start it on button hit? Just put bindKey above the eventHandler? try this function StopDamage ( attacker, weapon, bodypart ) if ( bodypart == 3 or 4 or 5 or 6 or 7 or 8 or 9 ) then cancelEvent() end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), StopDamage ) bindKey ( "F1" , "down" ,StopDamage) Link to comment
IIIIlllllIII Posted November 16, 2011 Share Posted November 16, 2011 if this code not working try this with bind key bindKey ( "F1" , "up" ,StopDamage) Link to comment
Aibo Posted November 16, 2011 Share Posted November 16, 2011 it's amazing how some people don't have any idea how to do this, but they still post. Link to comment
Gtagasje Posted November 16, 2011 Author Share Posted November 16, 2011 Doesnt this script work Aibo? Since I dont have time to test it actually. . Link to comment
Aibo Posted November 16, 2011 Share Posted November 16, 2011 no it doesn't. local noDamage = false function toggleStopDamage() noDamage = not noDamage outputChatBox(noDamage and "Damage is off" or "Damage is on") end bindKey("F1", "down", toggleStopDamage) function StopDamage() if noDamage then cancelEvent() end end addEventHandler("onClientPlayerDamage", localPlayer, StopDamage) you'll haev to add "admin check" yourself 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