OFF_Gunner Posted November 14, 2019 Share Posted November 14, 2019 (edited) Hello guys, I would like some help with this script below. My idea is to make two arenas (PvP), one of them is to kill any player with just one shot. The other arena is just killing with headshots! I was indicted to put elementData, but I don't know how to do that. Can someone help me? Sorry for bad English. Script Arena Oneshot function playerDamage_text ( attacker, weapon, bodypart, loss ) if ( bodypart == 3 and attacker and attacker ~= source ) then killPed ( source, attacker, weapon, bodypart ) end end addEventHandler ( "onPlayerDamage", root, playerDamage_text ) --------------------------_---------------------------------- Script Headshot function playerDamage_text ( attacker, weapon, bodypart, loss ) if ( bodypart == 9 and attacker and attacker ~= source ) then killPed ( source, attacker, weapon, bodypart ) end end addEventHandler ( "onPlayerDamage", root, playerDamage_text ) Edited November 14, 2019 by GunnerMapper Link to comment
Overkillz Posted November 16, 2019 Share Posted November 16, 2019 (edited) First of all, instead working at serverside, I recommend you to work at serverside with practically the same function. onClientPedDamage() setElementHealth() Respecting you main question, might the best option is to deal with dimensions to prevent a high amount of players in the same dimension. This also might brings you a better performance (Might not visible) About the code, I didn't test it. IT IS CLIENTSIDE -- FOR HEAD SHOT ARENA function cancelPedDamage (attacker,weapon,bodypart) cancelEvent() -- cancel any damage done to peds if source == local player then if ( bodypart == 9 and attacker and attacker ~= source ) then setElementHealth(source,0) end end end addEventHandler ( "onClientPedDamage", getRootElement(), cancelPedDamage ) -- FOR ONE SHOT ARENA function cancelPedDamage (attacker,weapon,bodypart) cancelEvent() -- cancel any damage done to peds if source == local player then setElementHealth(source,0) end end addEventHandler ( "onClientPedDamage", getRootElement(), cancelPedDamage ) Also, try to deal with player state with elementData. This is to prevent an already dead ped of being shot again. Edited November 16, 2019 by Overkillz 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