lolman Posted August 12, 2015 Share Posted August 12, 2015 Hello, I've been facing a problem with my code. It's ment to prevent weaponhit when a player has an elementData called : antiSpam. That works, I get an elementData but it doesn't prevent the damage... I know that the elementData works because I've tested on outputChatBox ... Here's the code : function getAntiSpam() local getAnti = getElementData(getLocalPlayer(), "antiSpam") if (getAnti == 1) then outputChatBox("works...", 255, 0, 0) cancelEvent() end end addEventHandler("onClientPlayerWeaponFire", root, getAntiSpam) function setAntiSpam() setElementData(getLocalPlayer(), "antiSpam", 1) end addEventHandler("onClientResourceStart", root, setAntiSpam) addEvent("SetANTI", true) addEventHandler("SetANTI", root, setAntiSpam) function setAntiSpamOnExplosive(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) if weapon == 16 then triggerEvent("SetANTI", getLocalPlayer()) end end addEventHandler("onClientPlayerWeaponFire", root, setAntiSpamOnExplosive) 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