-.Paradox.- Posted October 29, 2013 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
Castillo Posted October 29, 2013 Posted October 29, 2013 You must get the current stat, then set it + 1.
-.Paradox.- Posted October 29, 2013 Author Posted October 29, 2013 Can you fix it to me please? Sorry for annoying
Castillo Posted October 29, 2013 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 )
Castillo Posted October 30, 2013 Posted October 30, 2013 Oh, I forgot about something at getPedStat, copy the code again.
-.Paradox.- Posted October 30, 2013 Author Posted October 30, 2013 Still not working i tried with onZombieWasted too and nothing happened
Castillo Posted October 30, 2013 Posted October 30, 2013 Try debugging the script, add chat box outputs to help spot the error.
-.Paradox.- Posted October 31, 2013 Author Posted October 31, 2013 Idk where is the error it should work and it's server side.
3NAD Posted November 1, 2013 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 )
-.Paradox.- Posted November 3, 2013 Author 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
3NAD Posted November 4, 2013 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 )
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