Jump to content

Health


Gtagasje

Recommended Posts

Posted

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.

Posted
Thank you, but how do I need to start it on button hit? Just put bindKey above the eventHandler?

try this :D

  
  
  
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)  
  
  
  
  
  
  
  

Posted

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

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...