Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function displayAdminM(message)
- for k, arrayPlayer in ipairs(getElementsByType('player')) do
- local logged = getElementData(arrayPlayer, "loggedin")
- if (logged) then
- if getElementData(arrayPlayer, "admin_level") >= 1 then
- outputChatBox("ResWarn: " .. message, arrayPlayer, 255, 194, 14)
- end
- end
- end
- end
- local attempts = { 0, 0 }
- local count = 0
- function checkRes(res)
- for i, res in ipairs(mainRes) do
- local resName = getResourceFromName(res)
- if (resName) then
- local cState = getResourceState(resName)
- if (cState ~= "running") then
- displayAdminM("Resource '" .. res .. "' was not running. Attempting to start missing resource.")
- local startingRes = startResource(resName, true)
- if (attempts[i] < 4) then
- if not (startingRes) then
- displayAdminM("Fail to load Resource '" .. res .. "'.")
- local nreasonRes = getResourceLoadFailureReason(resName)
- --displayAdminM("Reason: " .. nreasonRes)
- attempts[i] = attempts[i] + 1
- else
- displayAdminM("Resource '" .. res .. "' started successfully.")
- end
- end
- end
- count = count + 1
- if count == #mainRes then
- count = 0
- end
- end
- end
- end
- addEventHandler("onResourceStart", getResourceRootElement(),
- function()
- setTimer(checkRes, 60000, 0)
- end
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement