Wisam Posted December 4, 2014 Posted December 4, 2014 Hello.. i want to make a script that when you kill a zombie your weapon skill that you killed the zombie with will raise +1 and im using zday zombie script.. i need zombie kill event but i dont know what to do because there is no zombie kill event in mta.. please help!
WASSIm. Posted December 5, 2014 Posted December 5, 2014 is there on zday script, and his name: 'onZombieWasted'
Wisam Posted December 5, 2014 Author Posted December 5, 2014 oh okay but would this work? addEventHandler( 'onZombieWasted', root, function ( killer, weapon, bodypart ) if (killer and killer ~= source) then if ( bodypart == 9 and weapon == 22) then setPedStat( killer, 69, getPedStat( killer, 69 ) + 50 ) end end end )
Wisam Posted December 5, 2014 Author Posted December 5, 2014 wow i can't belive it worked.. im still a beginner And if i wanted skill to raise for every weapon and body part because it currently works on the pistol only (22)
WASSIm. Posted December 5, 2014 Posted December 5, 2014 try this local statsFromWeapon = { [22] = 69, [23] = 70, [24] = 71, [25] = 72, [26] = 73, [27] = 74, [28] = 75, [29] = 76, [30] = 77, [31] = 78, [32] = 75, [33] = 79, [34] = 79 } addEventHandler("onZombieWasted", root, function (killer, weapon, bodypart) if (isElement(killer)) and (killer ~= source) and (getElementType(killer) == "player") and (bodypart == 9) then local statWeapon = statsFromWeapon[weapon] if (statWeapon) then local stat = getPedStat(killer, statWeapon) setPedStat(killer, statWeapon, stat + 50) end end end)
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