Jump to content

[HELP] Bad arguments ipairs


DSUSP

Recommended Posts

Hello everyone!

Today I experienced some problems (bad arguments). Because of that problem my resource automatically stopping when redo a map.

Follow the code below;

ERROR: newresource/server/server.lua:663: bad argument #1 to 'ipairs' (table expected, got no value)
Stopping new resource

 

Lua code here;

function meF5(source)
local map = getResourceName ( exports['mapmanager']:getRunningGamemodeMap ( ) )
local account = getPlayerAccount( source )
local mmapwins = getAccountData( account, map ) or 0
local mname = getAccountData ( account, "nick" ) or getPlayerName (source)
local mkills = getAccountData ( account, ""..map.."-kills" ) or 0
setElementData( source,"mwins", mmapwins)
setElementData( source,"mname", mname )
setElementData( source,"mkills", mkills )
setElementData(source,"whokilledme", "#ffffff")
end
function topmap( player, command )
tablo = {}
	for _, v in pairs(tablo) do
		if (_==10)then break end
    table.insert (
        tablo,
        {
            name = v.name,
            data = v.data,
			kills = v.kills,
            ulkeyazi = v.ulkeyazi
        }
            )
	end
    triggerClientEvent ( "returnTable", getRootElement(), tablo )
end
addEventHandler ( 'onMapStarting', root, topmap)
--
function alalalal()
local map = getResourceName ( exports['mapmanager']:getRunningGamemodeMap ( ) )
setElementData(source,"mapne", map)
local tableOrder = { }
    for i, v in ipairs ( getAccounts ( ) ) do
    table.insert (
        tableOrder,
        {
            name = getAccountData ( v, "nick" ) or getAccountName ( v ),
            data = getAccountData ( v, map ) or 0,
			kills = getAccountData ( v, ""..map.."-kills" ) or 0,
            ulkeyazi = getAccountData ( v, "CT" ) or "ZZ"
        }
            )
    end
    table.sort (
        tableOrder,
        function ( a, b )
            return ( tonumber ( a.data ) or 0 ) > ( tonumber ( b.data ) or 0 )
        end
                )
	--return tableOrder
    triggerClientEvent ( "returnTable", getRootElement(), tableOrder )
end

 

Please help me fixing this, thanks in advance!

Edited by DSUSP
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...