LiOneLMeSsIShoT Posted November 30, 2013 Share Posted November 30, 2013 I got an error in my table... help please. local stats = { {69,22} {70,23} {71,24} {72,25} {73,26} {74,27} {75,28} {76,29} {77,30} {78,31} {79,34} } function weaponstats (killer, weapon) local stat = getPedStat(killer, stats ) if killer and killer ~= source then if (weapon == stats) then setPedStat( killer, 78, stat+0.1) end end end addEventHandler( "onZombieWasted", getRootElement(),weaponstats) error: '}' expected (to close '{' at line 1) near '{' Link to comment
csiguusz Posted November 30, 2013 Share Posted November 30, 2013 local stats = { {69,22}, {70,23}, {71,24}, {72,25}, {73,26}, {74,27}, {75,28}, {76,29}, {77,30}, {78,31}, {79,34} } Link to comment
-.Paradox.- Posted November 30, 2013 Share Posted November 30, 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 ( "onZombieWasted", root, function ( 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
LiOneLMeSsIShoT Posted November 30, 2013 Author Share Posted November 30, 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 ( "onZombieWasted", root, function ( 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 ) Thanks but when i do the stat + 0.1 it shows in the gui label like 0.1545646541641 .... a lot of numbers so how to make it only 0.1 when i kill..not like 0.1541515616 setPedStat ( killer, Stats[tonumber(weapon)][1], getPedStat ( killer, Stats[tonumber(weapon)][1] ) + 0.1 ) Link to comment
LiOneLMeSsIShoT Posted November 30, 2013 Author Share Posted November 30, 2013 Use math.floor yeah..how? Link to comment
TAPL Posted November 30, 2013 Share Posted November 30, 2013 (math.floor(YOUR-NUMBER-HERE * 10)/10) Example: (math.floor(0.1541515616 * 10)/10) --> 0.1 Link to comment
LiOneLMeSsIShoT Posted November 30, 2013 Author Share Posted November 30, 2013 (math.floor(YOUR-NUMBER-HERE * 10)/10) Example: (math.floor(0.1541515616 * 10)/10) --> 0.1 i want it to be here...so how ? local skill = getPedStat(localPlayer, 69) guiSetText(Colt45_Levels, Level) Link to comment
TAPL Posted November 30, 2013 Share Posted November 30, 2013 (math.floor(YOUR-NUMBER-HERE * 10)/10) Link to comment
LiOneLMeSsIShoT Posted November 30, 2013 Author Share Posted November 30, 2013 (math.floor(YOUR-NUMBER-HERE * 10)/10) function() local skill = getPedStat(localPlayer, 69) (math.floor(0.1 * 10/)10) for i, o in ipairs(Levels) do if skill >= o[2] then Level = o[1] guiSetText(Colt45_Levels, Level) Error: ambiguous syntax (function call x new statement) near '(' Link to comment
TAPL Posted November 30, 2013 Share Posted November 30, 2013 This really really really make no sense you don't even know the basics. Link to comment
LiOneLMeSsIShoT Posted November 30, 2013 Author Share Posted November 30, 2013 (math.floor(YOUR-NUMBER-HERE * 10)/10) function() local skill = getPedStat(localPlayer, 69) (math.floor(0.1 * 10/)10) for i, o in ipairs(Levels) do if skill >= o[2] then Level = o[1] guiSetText(Colt45_Levels, Level) Error: ambiguous syntax (function call x new statement) near '(' Actually did it..but still not shows 0.1 local skill = math.floor(getPedStat(localPlayer, 69) * 10/10) Link to comment
-.Paradox.- Posted November 30, 2013 Share Posted November 30, 2013 Or it can't be 0.1 Link to comment
LiOneLMeSsIShoT Posted December 1, 2013 Author Share Posted December 1, 2013 Or it can't be 0.1 Sure it can be Steavy...try it in your server. Link to comment
LiOneLMeSsIShoT Posted December 1, 2013 Author Share Posted December 1, 2013 (math.floor(YOUR-NUMBER-HERE * 10)/10) Example: (math.floor(0.1541515616 * 10)/10) --> 0.1 Thanks Tapl too Link to comment
LiOneLMeSsIShoT Posted December 2, 2013 Author Share Posted December 2, 2013 (math.floor(YOUR-NUMBER-HERE * 10)/10) Example: (math.floor(0.1541515616 * 10)/10) --> 0.1 Thanks Tapl too Still need help guys. I've made this but still not work. local skill = math.floor(getPedStat(localPlayer, 69) * 10/10) 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