-.Paradox.- Posted July 24, 2013 Posted July 24, 2013 Hello all, i maked this stat system, 1pt for each kill, but sadly it wont work here is the lua addEvent( "onPlayerWasted", true ); addEventHandler( "onPlayerWasted", root, function (ammo, killer, weapon, bodypart ) if killer and killer ~= source then if bodypart == 9 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 2 ); end end end ); addEvent( "onPlayerWasted", true ); addEventHandler( "onPlayerWasted", root, function (ammo, killer, weapon, bodypart ) if killer and killer ~= source then if bodypart == 8 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end end end ); addEvent( "onPlayerWasted", true ); addEventHandler( "onPlayerWasted", root, function (ammo, killer, weapon, bodypart ) if killer and killer ~= source then if bodypart == 7 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end end end ); addEvent( "onPlayerWasted", true ); addEventHandler( "onPlayerWasted", root, function (ammo, killer, weapon, bodypart ) if killer and killer ~= source then if bodypart == 6 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end end end ); addEvent( "onPlayerWasted", true ); addEventHandler( "onPlayerWasted", root, function (ammo, killer, weapon, bodypart ) if killer and killer ~= source then if bodypart == 5 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end end end ); addEvent( "onPlayerWasted", true ); addEventHandler( "onPlayerWasted", root, function (ammo, killer, weapon, bodypart ) if killer and killer ~= source then if bodypart == 4 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end end end ); addEvent( "onPlayerWasted", true ); addEventHandler( "onPlayerWasted", root, function (ammo, killer, weapon, bodypart ) if killer and killer ~= source then if bodypart == 3 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end end end ); If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
iMr.3a[Z]eF Posted July 24, 2013 Posted July 24, 2013 (edited) Why not using elseif? addEventHandler( "onPlayerWasted", root, function (ammo, killer, weapon, bodypart ) if killer and killer ~= source then if bodypart == 9 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 2 ); end elseif killer and killer ~= source then if bodypart == 8 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 7 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 6 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 5 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 4 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 3 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end end end ); Edited July 24, 2013 by Guest To Visit Us Press Here: mtasa://5.9.206.180:22002
DNL291 Posted July 24, 2013 Posted July 24, 2013 Remove addEvent( "onPlayerWasted", true ); local bodyparts = { [9] = 2, [8] = 1, [7] = 1, [6] = 1, [5] = 1, [4] = 1, [3] = 1 } addEventHandler( "onPlayerWasted", root, function (ammo, killer, weapon, bodypart ) if killer and killer ~= source then if weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + bodyparts[bodypart] ); end end end ); Please do not PM me with scripting related question nor support, use the forums instead.
-.Paradox.- Posted July 26, 2013 Author Posted July 26, 2013 I'm trying to add Points for every weapon not only for Pistol, like using a table. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
iMr.3a[Z]eF Posted July 26, 2013 Posted July 26, 2013 Try this: addEventHandler( "onPlayerWasted", root, function (ammo, killer, weapon, bodypart ) local weapon = getPedWeapon( source ) if killer and killer ~= source then if bodypart == 9 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 2 ); end elseif killer and killer ~= source then if bodypart == 8 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 7 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 6 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 5 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 4 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 3 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end end end ); To Visit Us Press Here: mtasa://5.9.206.180:22002
-.Paradox.- Posted July 26, 2013 Author Posted July 26, 2013 Same code...you didn't changed the id of weapons its still 22 and this id for pistol. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
iMr.3a[Z]eF Posted July 26, 2013 Posted July 26, 2013 Check carefully -.-, i added getPedWeapon to check about the weapon. To Visit Us Press Here: mtasa://5.9.206.180:22002
-.Paradox.- Posted July 26, 2013 Author Posted July 26, 2013 I did but it add only for pistol not for other weapons. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
iMr.3a[Z]eF Posted July 26, 2013 Posted July 26, 2013 You want for all weapons? And that because you Specified the weapon you did like this if bodypart == 9 and weapon == 22 then 22 = the pistol ID. To Visit Us Press Here: mtasa://5.9.206.180:22002
-.Paradox.- Posted July 26, 2013 Author Posted July 26, 2013 Yes i want it for all weapons. and thanks for helping me. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
iMr.3a[Z]eF Posted July 26, 2013 Posted July 26, 2013 (edited) I'm not sure this will works addEventHandler( "onPlayerWasted", root, function (ammo, killer, weapon, bodypart ) local weapon = getElementType ( "weapon" ) if killer and killer ~= source then if bodypart == 9 and weapon then setPedStat( killer, 69, getPedStat( killer, 69 ) + 2 ); end elseif killer and killer ~= source then if bodypart == 8 and weapon then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 7 and weapon then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 6 and weapon then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 5 and weapon then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 4 and weapon then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 3 and weapon then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end end end ); EDITED Edited July 26, 2013 by Guest To Visit Us Press Here: mtasa://5.9.206.180:22002
-.Paradox.- Posted July 26, 2013 Author Posted July 26, 2013 Not working, i guess because removed weapon type, anyway thanks for help i will try to do my self just give me some functions i could use like creating a table. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
iMr.3a[Z]eF Posted July 26, 2013 Posted July 26, 2013 Try now ~ To Visit Us Press Here: mtasa://5.9.206.180:22002
iMr.3a[Z]eF Posted July 26, 2013 Posted July 26, 2013 I wrote it fast now the last edit To Visit Us Press Here: mtasa://5.9.206.180:22002
-.Paradox.- Posted July 26, 2013 Author Posted July 26, 2013 still 0 i tried with all weapons If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
-.Paradox.- Posted July 26, 2013 Author Posted July 26, 2013 i tried reconnect neither If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
iMr.3a[Z]eF Posted July 26, 2013 Posted July 26, 2013 try this then addEventHandler( "onPlayerWasted", root, function (ammo, killer, weapon, bodypart ) local weapon = getElementType ( "weapon" ) if killer and killer ~= source then if bodypart == 9 and weapon then setPedStat( killer, 69, getPedStat( killer, 69 ) + 2 ); end elseif killer and killer ~= source then if bodypart == 8 and weapon then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 7 and weapon then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 6 and weapon then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 5 and weapon then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 4 and weapon then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end elseif killer and killer ~= source then if bodypart == 3 and weapon then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end end end ); To Visit Us Press Here: mtasa://5.9.206.180:22002
-.Paradox.- Posted July 26, 2013 Author Posted July 26, 2013 Not working too , ill try to make it by myself. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
iMr.3a[Z]eF Posted July 26, 2013 Posted July 26, 2013 Ok, good luck. To Visit Us Press Here: mtasa://5.9.206.180:22002
DNL291 Posted July 27, 2013 Posted July 27, 2013 @StevyDK: Will only work with the pistol because it will check if weapon ID is 22, if you want to it for all weapons then remove it. Please do not PM me with scripting related question nor support, use the forums instead.
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