-.Paradox.- Posted October 29, 2013 Share Posted October 29, 2013 (edited) Hello, can somebody help me fixing this no errors in debug, this suppose to add +1 point for every weapon stat when you kill a player, like example when i kill somebody with m4 i earn 1 point to m4 etc here is the code and thanks addEventHandler("onZombieWasted", root, function (killer, weapon ,bodypart) if (killer and getElementType(killer) == "player" and killer ~= source) then local Acc = getAccountName ( acc ) for i = 21 , 25 do getPedStat(source,i,getAccountData(Acc, "stat."..i)) end for i = 69 , 79 do getPedStat(source,i,getAccountData(Acc, "stat."..i)) end for i = 21 , 25 do setPedStat(source,i,+1) end for i = 69 , 79 do setPedStat(source,i,+1) end end end) Edited October 30, 2013 by Guest Link to comment
Castillo Posted October 29, 2013 Share Posted October 29, 2013 You must get the current stat, then set it + 1. Link to comment
-.Paradox.- Posted October 29, 2013 Author Share Posted October 29, 2013 Can you fix it to me please? Sorry for annoying Link to comment
Castillo Posted October 29, 2013 Share Posted October 29, 2013 addEventHandler ( "onPlayerWasted", root, function ( killer, weapon ,bodypart ) if ( killer and getElementType ( killer ) == "player" and killer ~= source ) then for i = 21, 25 do setPedStat ( source, i, getPedStat ( source, i ) + 1 ) end for i = 69 , 79 do setPedStat ( source, i, getPedStat ( source, i ) + 1 ) end end end ) Link to comment
-.Paradox.- Posted October 29, 2013 Author Share Posted October 29, 2013 Thank you, i will try it C: Link to comment
Castillo Posted October 30, 2013 Share Posted October 30, 2013 Oh, I forgot about something at getPedStat, copy the code again. Link to comment
-.Paradox.- Posted October 30, 2013 Author Share Posted October 30, 2013 Still not working i tried with onZombieWasted too and nothing happened Link to comment
-.Paradox.- Posted October 30, 2013 Author Share Posted October 30, 2013 Nothing on debug Link to comment
Castillo Posted October 30, 2013 Share Posted October 30, 2013 Try debugging the script, add chat box outputs to help spot the error. Link to comment
-.Paradox.- Posted October 31, 2013 Author Share Posted October 31, 2013 Idk where is the error it should work and it's server side. Link to comment
3NAD Posted November 1, 2013 Share Posted November 1, 2013 addEventHandler ( "onPlayerWasted", root, function ( killer, weapon, bodypart ) if killer then if getElementType ( killer ) == "player" then if killer ~= source then for i = 21, 25 do setPedStat ( killer, i, getPedStat ( killer, i ) + 1 ) end for i = 69 , 79 do setPedStat ( killer, i, getPedStat ( killer, i ) + 1 ) end end end end end ) Link to comment
-.Paradox.- Posted November 3, 2013 Author Share Posted November 3, 2013 This add +1 for all stats, and i want to add only for the weapon i killed with the player/zombie Link to comment
3NAD Posted November 4, 2013 Share Posted November 4, 2013 Stats = { [22] = { 69 }; [23] = { 70 }; [24] = { 71 }; [25] = { 72 }; [26] = { 73 }; [27] = { 74 }; [28] = { 75 }; [29] = { 76 }; [30] = { 77 }; [31] = { 78 }; [34] = { 79 }; }; addEventHandler ( "onPlayerWasted", root, function ( ammo, killer, weapon, bodypart ) if killer then if getElementType ( killer ) == "player" then if killer ~= source then if Stats[tonumber(weapon)] then setPedStat ( killer, Stats[tonumber(weapon)][1], getPedStat ( killer, Stats[tonumber(weapon)][1] ) + 1 ) end end end end end ) Link to comment
-.Paradox.- Posted November 4, 2013 Author Share Posted November 4, 2013 Thanks working perfect 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