-.Paradox.- Posted July 24, 2013 Share 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 ); Link to comment
iMr.3a[Z]eF Posted July 24, 2013 Share 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 Link to comment
DNL291 Posted July 24, 2013 Share 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 ); Link to comment
-.Paradox.- Posted July 26, 2013 Author Share Posted July 26, 2013 I'm trying to add Points for every weapon not only for Pistol, like using a table. Link to comment
iMr.3a[Z]eF Posted July 26, 2013 Share 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 ); Link to comment
-.Paradox.- Posted July 26, 2013 Author Share Posted July 26, 2013 Same code...you didn't changed the id of weapons its still 22 and this id for pistol. Link to comment
iMr.3a[Z]eF Posted July 26, 2013 Share Posted July 26, 2013 Check carefully -.-, i added getPedWeapon to check about the weapon. Link to comment
-.Paradox.- Posted July 26, 2013 Author Share Posted July 26, 2013 I did but it add only for pistol not for other weapons. Link to comment
iMr.3a[Z]eF Posted July 26, 2013 Share 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. Link to comment
-.Paradox.- Posted July 26, 2013 Author Share Posted July 26, 2013 Yes i want it for all weapons. and thanks for helping me. Link to comment
iMr.3a[Z]eF Posted July 26, 2013 Share 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 Link to comment
-.Paradox.- Posted July 26, 2013 Author Share 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. Link to comment
iMr.3a[Z]eF Posted July 26, 2013 Share Posted July 26, 2013 I wrote it fast now the last edit Link to comment
-.Paradox.- Posted July 26, 2013 Author Share Posted July 26, 2013 still 0 i tried with all weapons Link to comment
-.Paradox.- Posted July 26, 2013 Author Share Posted July 26, 2013 i tried reconnect neither Link to comment
iMr.3a[Z]eF Posted July 26, 2013 Share 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 ); Link to comment
-.Paradox.- Posted July 26, 2013 Author Share Posted July 26, 2013 Not working too , ill try to make it by myself. Link to comment
DNL291 Posted July 27, 2013 Share 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. 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