Jump to content

Got problem with money appears


tysanio

Recommended Posts

Posted

Got this error ERROR: "systemforfaction line 800": attempt to compare number with nil

        local mostRecentWeek = 0 
        local currentWeek = 0 
        if query then 
            while true do 
                row = mysql:fetch_assoc(query) 
                if not row then break end 
                 
                local id = tonumber(row["id"]) 
                local amount = tonumber(row["amount"]) 
                local time = row["newtime"] 
                local week = tonumber(row["week"]) 
                currentWeek = tonumber(row["currentWeek"]) 
                [i]this line[/i][b]if (week) > mostRecentWeek then mostRecentWeek = week end 
[/b]                if not transactions[week] then transactions[week] = {} end 
                local type = tonumber(row["type"]) 
                local reason = row["reason"] 
                if reason == mysql_null() then 
                    reason = "" 
                end 
                 
                local from, to = "-", "-" 
                if row["characterfrom"] ~= mysql_null() then 
                    from = row["characterfrom"]:gsub("_", " ") 
                elseif tonumber(row["from"]) then 
                    num = tonumber(row["from"])  
                    if num < 0 then 
                        from = getTeamName(exports.pool:getElement("team", -num)) or "-" 
                    elseif num == 0 and ( type == 6 or type == 7 ) then 
                        from = "Government" 
                    end 
                end 
                if row["characterto"] ~= mysql_null() then 
                    to = row["characterto"]:gsub("_", " ") 
                elseif tonumber(row["to"]) and tonumber(row["to"]) < 0 then 
                    to = getTeamName(exports.pool:getElement("team", -tonumber(row["to"]))) 
                end 
                 
                if tostring(row["from"]) == tostring(-factionID) and amount > 0 then 
                    amount = amount - amount - amount 
                end 
  
                table.insert(transactions[week], { id = id, amount = amount, time = time, type = type, from = from, to = to, reason = reason, week = week }) 
                --outputDebugString("transactions["..tostring(week).."]="..tostring(#transactions[week])) 
            end 

I dont know what wrong i'm new to Scripting lua i just pickup ressource and look how its work.

Posted
I dont know what wrong i'm new to Scripting lua i just pickup ressource and look how its work.

start with something easier than this, not what difficult as MySQL, SQL, tables xD

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...