boro Posted April 29, 2013 Posted April 29, 2013 Hi all please why this don't work if i use grenade for zombie kill so grenade still take -80% health but i have set it to -1 how is problem ? addEventHandler("onResourceStart",resourceRoot, function ( ) setWeaponProperty(16, "pro", "damage", 1) setWeaponProperty(16, "std", "damage", 1) setWeaponProperty(16, "poor", "damage", 1) end end ) I'll help When I Can.
DNL291 Posted April 29, 2013 Posted April 29, 2013 Try this: addEventHandler("onResourceStart",resourceRoot, function ( ) setWeaponProperty(16, "pro", "damage", 1) setWeaponProperty(16, "std", "damage", 1) setWeaponProperty(16, "poor", "damage", 1) end ) Please do not PM me with scripting related question nor support, use the forums instead.
Moderators IIYAMA Posted April 29, 2013 Moderators Posted April 29, 2013 as far I know an explosion isn't a weapon. 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
boro Posted April 29, 2013 Author Posted April 29, 2013 and how set explosion damage ?? I'll help When I Can.
Moderators IIYAMA Posted April 29, 2013 Moderators Posted April 29, 2013 You can't, you can only make that if you are very good in scripting. That is more like, creating your own damage system. 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
Sasu Posted April 29, 2013 Posted April 29, 2013 You can cancelEvent on clientside. addEventHandler("onClientPlayerDamage", getLocalPlayer(), function (attacker, weapon) if not weapon then return end if weapon == 16 then cancelEvent() local health = getElementHealth(source) setElementHealth(source, health-1) end end ) State: Inactive
Moderators IIYAMA Posted April 29, 2013 Moderators Posted April 29, 2013 Nope, that isn't going to work. First of all when you get damage, there is most of the time a weapon, and gta will see that was weapon 16. "if not weapon then return end" and next to that gta/mta does have a very annoying bug. If you set a player his health at the same time he got damaged, his event won't be cancelled. This works, but I won't say it is the best solution. addEventHandler("onClientPlayerDamage", getLocalPlayer(), function (attacker, weapon) if weapon == 16 then setTimer(setMyHealth,50,1) cancelEvent() end end ) function setMyHealth () local health= getElementHealth(localPlayer) if health-20 > 0 then setElementHealth(localPlayer, health-20) else setElementHealth(localPlayer, 0) end end 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
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