Jump to content

[HELP] - Problem - Bad argument @ 'triggerClientEvent'


ProWD

Recommended Posts

Ok every time i enter MTA Map Editor it says this in the console:

WARNING: [editor]\editor_main\server\saveloadtest_server.lua:206: Bad argument @ 'triggerClientEvent' [Expected string at argument 1, got nil] 

Here is the script where this problem is at:

g_in_test = false 
local g_restoreEDF, dumpTimer 
local g_default_spawnmaponstart,g_default_spawnmapondeath,g_defaultwelcometextonstart 
local restoreGUIOnMapStop, restoreGUIOnGamemodeMapStop, startGamemodeOnStop 
local freeroamRes = getResourceFromName "freeroam" 
local TEST_RESOURCE = "editor_test" 
local DUMP_RESOURCE = "editor_dump" 
local dumpInterval = get("dumpSaveInterval") and tonumber(get("dumpSaveInterval"))*1000 or 60000 
local fileTypes = { "script","map","file","config","html" }  
local specialFileTypes = { "script","file","config","html" } 
local DESTROYED_ELEMENT_DIMENSION = getWorkingDimension() + 1 
  
--- 
local openResourceCoroutine 
local openingResource 
local openingResourceName 
local openingOnStart 
local openingSource 
local openingStartTick 
local openingMapElement 
local openingMapName 
--- 
local quickSaveCoroutine 
local saveResourceCoroutine 
--- 
local lastTestGamemodeName 
  
loadedMap = false 
addEvent ( "onNewMap" ) 
addEvent ( "onMapOpened" ) 
addEvent ( "openResource", true ) 
addEvent ( "saveResource", true ) 
addEvent ( "testResource", true ) 
addEvent ( "newResource", true ) 
addEvent ( "quickSaveResource", true ) 
  
addEventHandler ( "onResourceStart", thisResourceRoot, 
    function() 
        refreshResources(false) 
        destroyElement( rootElement ) 
        mapContainer = createElement("mapContainer") 
        setTimer(startUp, 1000, 1) 
    end 
) 
  
function startUp() 
    enabled = getBool("enableDumpSave", true) 
    if ( enabled ) then 
        if ( not openResource(DUMP_RESOURCE, true) ) then 
            outputConsole("Could not open dump. Creating new dump.") 
            saveResource(DUMP_RESOURCE, true) 
        else 
            if #getElementsByType("player") > 0 then 
                editor_gui.outputMessage("On-Exit-Save has loaded the most recent backup of the previously loaded map. Use 'new' to start a new map.", root, 255, 255, 0, 20000) 
            else 
                addEventHandler("onPlayerJoin", rootElement, onJoin) 
            end 
        end 
        dumpTimer = setTimer(dumpSave, dumpInterval, 0) 
    end 
    for i,player in ipairs(getElementsByType("player")) do 
        local account = getPlayerAccount(player) 
        if account then 
            local accountName = getAccountName(account) 
            local adminGroups = split(get("admingroup") or "Admin",string.byte(',')) 
            for _,name in ipairs(adminGroups) do 
                local group = aclGetGroup(name) 
                if group then 
                    for i,obj in ipairs(aclGroupListObjects(group)) do 
                        if obj == 'user.' .. accountName or obj == 'user.*' then 
                            triggerClientEvent(player, "enableServerSettings", player, enabled, dumpInterval/1000) 
                        end 
                    end 
                end 
            end 
        end 
    end 
end 

Oh and i have the latest MTA 1.3.1

Can somebody help me with this problem. !THANKS IN ADVANCE!

Link to comment

Don't start a script with Map Editor, it's basically suicide to test a script lol. Start a local server: MTA San Andreas 1.3 > Server > MTA Server run the .exe then go to MTA, click "Local" open your server and start the resource from console, test it there.

About this:

WARNING: [editor]\editor_main\server\saveloadtest_server.lua:206: Bad argument @ 'triggerClientEvent' [Expected string at argument 1, got nil]

With the script you gave, and said the problem is there, there happens to be no line 206, bolted text in the quote shows where the problem is at. Reply once you've tested it or if you got any problems.

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