Jump to content

I need help please.


Recommended Posts

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
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
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 o.O 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
(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
(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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...