Rouzbeh Posted January 4, 2016 Share Posted January 4, 2016 (edited) hi i have this problem when shutting down server: ERROR: work\server.lua:27: exports: Call to non-running server resource (sql) [string "?"] ERROR: afk\Server.lua:49: exports: Call to non-running server resource (sql) [string "?"] i am using mysql saving system and in sql resource connect to mysql... so how i can prevent this error? Edited January 4, 2016 by Guest Link to comment
Enargy, Posted January 4, 2016 Share Posted January 4, 2016 You must start sql resource. Link to comment
Rouzbeh Posted January 4, 2016 Author Share Posted January 4, 2016 You must start sql resource. sql is running on server, i need when i shut down server, sql resource close at last and after all resources [This was Happend because sql resource closed before those resources] Link to comment
Addlibs Posted January 4, 2016 Share Posted January 4, 2016 Are you sure it's named 'sql' and it is running for sure? The error message clearly states it isn't running. Link to comment
Rouzbeh Posted January 5, 2016 Author Share Posted January 5, 2016 Are you sure it's named 'sql' and it is running for sure? The error message clearly states it isn't running. come on!!!... i Said when i shutting Down Server so all resources stop ... i add "onResourceStop" event to save data to database, im not noob at all, but i just looking for a way can set a resource stop at last as others when i shut down mta server! Server stopped! [2016-01-03 03:06:15] Stopping resources................................................. [2016-01-03 03:06:19] ERROR: work\server.lua:27: exports: Call to non-running server resource (sql) [string "?"] [2016-01-03 03:06:19] ERROR: afk\Server.lua:49: exports: Call to non-running server resource (sql) [string "?"] [2016-01-03 03:06:27] Closing SQLite3 database here sql resource stoped before 'work' and 'afk' resources so "onResourceStop" could'nt do export.sql:something()... i want set 'sql' Resource close after all resources Link to comment
killeryoyo Posted January 5, 2016 Share Posted January 5, 2016 Call to non-running server resource (sql) [string "?"] this means that there is a resource not running. try to find the Sql that the script wants. Or you can read the scripts that makes that error and change their export to your current sql. Link to comment
Bonsai Posted January 5, 2016 Share Posted January 5, 2016 Seems nobody who replies here bothers to read about the actual problem. Maybe the order in the mtaconfig file or include in meta makes a difference? But that doesn't seem to be a good way of doing it. Link to comment
arezu Posted January 5, 2016 Share Posted January 5, 2016 The best way to do it is probably to create a command that saves data (maybe stopping work and afk resource first?) and then closes the server. Something like this: local resourcesToWaitFor = { "work", "afk" } local waitingForResources = {} local doShutdown = false addCommandHandler("safeshutdown", function(player) outputChatBox("Safely shutting down the server...") for k, resourceName in ipairs(resourcesToWaitFor) do local resource = getResourceFromName(resourceName) if(resource)then waitingForResources[resource] = true end end doShutdown = true for resource, resourceWaitState in pairs(waitingForResources) do stopResource(resource) end end, true, false) addEventHandler("onResourceStop", root, function(stoppedResource) if(doShutdown and waitingForResources[stoppedResource])then waitingForResources[stoppedResource] = false for resource, resourceState in pairs(waitingForResources) do if(resourceWaitState)then return false end end shutdown("The server has safely been shutdown.") end end) Make sure the resource has the rights to use the shutdown function, etc. Link to comment
Rouzbeh Posted January 12, 2016 Author Share Posted January 12, 2016 The best way to do it is probably to create a command that saves data (maybe stopping work and afk resource first?) and then closes the server.Something like this: local resourcesToWaitFor = { "work", "afk" } local waitingForResources = {} local doShutdown = false addCommandHandler("safeshutdown", function(player) outputChatBox("Safely shutting down the server...") for k, resourceName in ipairs(resourcesToWaitFor) do local resource = getResourceFromName(resourceName) if(resource)then waitingForResources[resource] = true end end doShutdown = true for resource, resourceWaitState in pairs(waitingForResources) do stopResource(resource) end end, true, false) addEventHandler("onResourceStop", root, function(stoppedResource) if(doShutdown and waitingForResources[stoppedResource])then waitingForResources[stoppedResource] = false for resource, resourceState in pairs(waitingForResources) do if(resourceWaitState)then return false end end shutdown("The server has safely been shutdown.") end end) Make sure the resource has the rights to use the shutdown function, etc. ow very thanks, finally... u got my means 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