Castillo Posted September 5, 2013 Share Posted September 5, 2013 Yes, you can also use that to disable it. The zombies can still hurt you because the zombies script uses setElementHealth, and "onClientPlayerDamage" doesn't cancel that. Link to comment
Chaos Posted September 5, 2013 Author Share Posted September 5, 2013 So is it possible to get anti damage by zombies? Link to comment
Castillo Posted September 5, 2013 Share Posted September 5, 2013 Well, you can set the player health when he gets damaged. Link to comment
Chaos Posted September 5, 2013 Author Share Posted September 5, 2013 function stopDamage ( ) addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage ) end function stopMinigunDamage() player = getLocalPlayer() setElementHealth (player,getElementHealth (player) +25) end I think you mean that is that correct and if correct is there a shortcut? Link to comment
GamerDeMTA Posted September 5, 2013 Share Posted September 5, 2013 I think that the functions must be created before, try this: (stopDamage function is not eeeded!) --addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage ) function stopMinigunDamage() health = getElementHealth(localPlayer) setElementHealth (localPlayer, health +25) end addEventHandler ( "onClientPlayerDamage", getRootElement(), stopMinigunDamage ) Link to comment
Castillo Posted September 5, 2013 Share Posted September 5, 2013 It is needed, because he wants to add the event when he presses a key, you should read the entire topic before reply, don't take it the wrong way. @Chaos: That should work, yes. Link to comment
Chaos Posted September 6, 2013 Author Share Posted September 6, 2013 all working fine but there is a problem some zombies kill you with just one hit it looks like knife Link to comment
Castillo Posted September 6, 2013 Share Posted September 6, 2013 Try cancelling the event: onClientPlayerStealthKill. Link to comment
Chaos Posted September 6, 2013 Author Share Posted September 6, 2013 function stopDamage ( ) addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage ) addEventHandler("onClientPlayerStealthKill", getLocalPlayer(), stopMinigunDamage ) end function stopMinigunDamage() player = getLocalPlayer() setElementHealth (player,getElementHealth (player) +100) cancelEvent () end correct? Link to comment
Castillo Posted September 6, 2013 Share Posted September 6, 2013 You can try that, not sure if it'll work though. Link to comment
Chaos Posted September 7, 2013 Author Share Posted September 7, 2013 onClientPlayerDamage and setElementHealth works fine but onClientPlayerStealthKill not working Link to comment
Castillo Posted September 7, 2013 Share Posted September 7, 2013 Maybe it's a custom stealth kill made by the zombies script, so, you'll have to edit the zombies script itself. Link to comment
Chaos Posted September 8, 2013 Author Share Posted September 8, 2013 i'm plan to make a marker is that possible? addEvent ( "test", true ) addEventHandler ( "test", getRootElement(), function( ) local x, y, z = getElementPosition ( source ) local theMarker = createMarker ( x , y , z, "cylinder", 2, 0, 0, 0, 0 ) addEventHandler( "onMarkerHit", theMarker, antizombies ) end) function antizombies(h) if not isElement(h) then return end if getElementData(h,"zombie") then killPed(h) end end 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