botshara Posted March 7, 2014 Posted March 7, 2014 -- client side function antiCarDM() if weapon == 0 and getElementType(hitElement)=="vehicle" then outputChatBox("(( CAR DM IS NOT ALLOWED ))", thePlayer, 255,0,0 ) cancelEvent() end end addEventHandler("onClientPlayerWeaponFire", getRootElement(), antiCarDM) script doesnt work.. And someone can please answer me what need write between function brackets. I cant understand it
DNL291 Posted March 7, 2014 Posted March 7, 2014 Try this: function antiCarDM(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) if getElementType(hitElement)=="vehicle" then outputChatBox("(( CAR DM IS NOT ALLOWED ))", 255, 0, 0) cancelEvent() end end addEventHandler("onClientPlayerWeaponFire", localPlayer, antiCarDM) Please do not PM me with scripting related question nor support, use the forums instead.
Moderators IIYAMA Posted March 7, 2014 Moderators Posted March 7, 2014 addEventHandler("onClientVehicleDamage", root, function (attacker,weapon) if attacker == localPlayer then outputChatBox("(( CAR DM IS NOT ALLOWED ))", 255,0,0 ) end if attacker then cancelEvent() end end) It is clientside and that("onClientPlayerWeaponFire") event can't be cancelled. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
botshara Posted March 7, 2014 Author Posted March 7, 2014 addEventHandler("onClientVehicleDamage", root, function (attacker,weapon) if attacker == localPlayer then outputChatBox("(( CAR DM IS NOT ALLOWED ))", 255,0,0 ) end if attacker then cancelEvent() end end) It is clientside and that("onClientPlayerWeaponFire") event can't be cancelled. It works, but how set it only work to fist ?
Castillo Posted March 7, 2014 Posted March 7, 2014 Check if weapon is equal to 0. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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