boro Posted April 29, 2013 Share 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 ) Link to comment
DNL291 Posted April 29, 2013 Share 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 ) Link to comment
Moderators IIYAMA Posted April 29, 2013 Moderators Share Posted April 29, 2013 as far I know an explosion isn't a weapon. Link to comment
boro Posted April 29, 2013 Author Share Posted April 29, 2013 and how set explosion damage ?? Link to comment
Moderators IIYAMA Posted April 29, 2013 Moderators Share 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. Link to comment
Sasu Posted April 29, 2013 Share 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 ) Link to comment
Moderators IIYAMA Posted April 29, 2013 Moderators Share 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 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