myonlake Posted October 14, 2012 Posted October 14, 2012 You mean invulnerable player. Toggle damage command: /togdamage -- Check if the player is invulnerable addEventHandler("onClientPlayerDamage", localPlayer, function(attacker, weapon, bodypart, loss) if isPlayerInvulnerable(source) then cancelEvent() end end ) -- Command to toggle vulnerability addCommandHandler("togdamage", function(cmd) togglePlayerDamage(localPlayer) end ) -- Checking if the player is invulnerable function isPlayerInvulnerable(player) if player then if getElementData(player, "player.invulnerable") and getElementData(player, "player.invulnerable") == true then return true else return false end end end -- Set the player either invulnerable or vulnerable function togglePlayerDamage(player) if player then if isPlayerInvulnerable(player) then setElementData(player, "player.invulnerable", true, true) else setElementData(player, "player.invulnerable", false, true) end end end Not tested. If I helped you, please click the like button on the right Thanks!
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