Dumper Posted August 28, 2017 Share Posted August 28, 2017 function adminDutyStart() local result = mysql:query("SELECT id, name FROM factions WHERE type >= 2 ORDER BY id ASC") local max = mysql:query("SELECT id FROM duty_allowed ORDER BY id DESC LIMIT 0, 1") if result and max then dutyAllow = { } dutyAllowChanges = { } i = 0 local maxrow = mysql:fetch_assoc(max) maxIndex = tonumber(maxrow.id) or 0 while true do local row = mysql:fetch_assoc(result) if not row then break end table.insert(dutyAllow, { row.id, row.name, { --[[Duty information]] } }) i = i+1 local result1 = mysql:query("SELECT * FROM duty_allowed WHERE faction="..tonumber(row.id)) if result1 then while true do local row1 = mysql:fetch_assoc(result1) if not row1 then break end table.insert(dutyAllow[i][3], { row1.id, tonumber(row1.itemID), row1.itemValue }) end end end setElementData(resourceRoot, "maxIndex", maxIndex) setElementData(resourceRoot, "dutyAllowTable", dutyAllow) mysql:free_result(result) mysql:free_result(result1) mysql:free_result(max) else outputDebugString("[Factions] ERROR: Duty allow permissions failed.") end end addEventHandler("onResourceStart", resourceRoot, adminDutyStart)--]] Line 9 - 10 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