Jump to content

[HELP] Admin Panel Resources Problems


Recommended Posts

8 hours ago, #nofear said:

I deleted the game and reinstalled it and the problem was not solved. I renewed the files with the original files of the game and the problem still did not go away.

https://hizliresim.com/2av5xsc

Maps section also does not work. But I can do whatever I want with the command.

U need give us the lines of error in the lua archive. (92,94,68)

Link to comment
On 01/07/2024 at 03:06, xkr4nxz said:

U need give us the lines of error in the lua archive. (92,94,68)

admin_serverprefs.lua 92-94

 _coroutine_resume = coroutine.resume
 function coroutine.resume(...)
92-	 local state,result = _coroutine_resume(...)
	 if not state then
94-		 outputDebugString( tostring(result), 1 )	-- Output error message
	 end
	 return state,result
 end

admin_settings.lua 25

-- Get a resource's public bool,number,string or table settings
function aGetResourceSettings( resName, bCountOnly )
	allowedAccess = { ['*']=true }
	allowedTypes  = { ['boolean']=true, ['number']=true, ['string']=true, ['table']=true }
	local count = 0

25- 25- 25- 25-	local rawsettings = get(resName..'.')
	if not rawsettings then
		return {}, count
	end
	local settings = {}
	-- Parse raw settings
	for rawname,value in pairs(rawsettings) do
		if allowedTypes[type(value)] then
			if allowedAccess[string.sub(rawname,1,1)] then
				count = count + 1
				-- Remove leading '*','#' or '@'
				local temp = string.gsub(rawname,'[%*%#%@](.*)','%1')
				-- Remove leading 'resName.'
				local name = string.gsub(temp,resName..'%.(.*)','%1')
				-- If name didn't have a leading 'resName.', then it must be the default setting
				local bIsDefault = ( temp == name )
				if settings[name] == nil then
					settings[name] = {}
				end
				if bIsDefault then
					settings[name].default = value
				else
					settings[name].current = value
				end
			end
		end
	end
	-- Don't do anything else if all we want is the settings count
	if bCountOnly then
		return {}, count
	end
	-- Copy to tableOut, setting 'current' from 'default' where appropriate
	local tableOut = {}
	for name,value in pairs(settings) do
		if value.default ~= nil then
			tableOut[name] = {}
			tableOut[name].default = value.default
			tableOut[name].current = value.current
			if value.current == nil then
				tableOut[name].current = value.default
			end
			tableOut[name].friendlyname	= get( resName .. '.' .. name .. '.friendlyname' )
			tableOut[name].group		= get( resName .. '.' .. name .. '.group' )
			tableOut[name].accept		= get( resName .. '.' .. name .. '.accept' )
			tableOut[name].examples		= get( resName .. '.' .. name .. '.examples' )
			tableOut[name].desc			= get( resName .. '.' .. name .. '.desc' )
		end
	end
	return tableOut, count
end

admin_sync.lua 68

function aSynchCoroutineFunc( type, data, typeOfTag, banSearchTag )
	local source = source -- Needed
	local maxBanCount = 100
	if checkClient( false, source, 'aSync', type ) then return end
	local cor = aSyncCoroutine
	local tableOut = {}
	local theSource = root
	if client and not hasObjectPermissionTo ( client, "general.adminpanel" ) then
		type = "loggedout"
	elseif ( type == "player" ) then
		if not isElement( data ) then return end
		aPlayers[source]["sync"] = data
		tableOut["mute"] = isPlayerMuted ( data )
		tableOut["freeze"] = isPlayerFrozen ( data )
		tableOut["money"] = getPlayerMoney ( data )
		tableOut["version"] = aPlayers[data]["version"]
		tableOut["accountname"] = getPlayerAccountName ( data ) or "N/A"
		tableOut["groups"] = "None"
		tableOut["acdetected"] = getPlayerACDetectedList( data )
		tableOut["d3d9dll"] = getPlayerD3D9DLLHash( data )
		tableOut["imgmodsnum"] = getPlayerModCount( data )
		local account = getPlayerAccount ( data )
		if ( isGuestAccount ( account ) ) then
			tableOut["groups"] = "Not logged in"
		else
			local groups = aclGetAccountGroups ( account )
			if ( #groups <= 0 ) then
				tableOut["groups"] = "None"
			else
				tableOut["groups"] = table.concat(table.reverse(groups), ", ")
			end
		end
		theSource = data
	elseif ( type == "players" ) then
		for id, player in ipairs(getElementsByType("player")) do
			if isElement(player) and aPlayers[player] then
				tableOut[player] = {}
				tableOut[player]["name"] = getPlayerName ( player )
				tableOut[player]["IP"] = getPlayerIP ( player )
				tableOut[player]["version"] = aPlayers[player]["version"]
				tableOut[player]["accountname"] = getPlayerAccountName ( player ) or "N/A"
				tableOut[player]["serial"] = getPlayerSerial ( player )
				tableOut[player]["country"] = aPlayers[player]["country"]
				tableOut[player]["admin"] = hasObjectPermissionTo ( player, "general.adminpanel" )
				tableOut[player]["acdetected"] = getPlayerACDetectedList( player )
				tableOut[player]["d3d9dll"] = getPlayerD3D9DLLHash( player )
				tableOut[player]["imgmodsnum"] = getPlayerModCount( player )
			end
		end
	elseif ( type == "resources" ) then
		if not hasObjectPermissionTo( source, "general.tab_resources" ) then
			return
		end
		local resourceTable = getResources()
		local tick = getTickCount()
		local antiCorMessageSpam = 0
		for id, resource in ipairs(resourceTable) do
68- 68- 68- 68-			local name = getResourceName ( resource )
			local state = getResourceState ( resource )
			local type2 = getResourceInfo ( resource, "type" )
			local _,numsettings = aGetResourceSettings(name,true)
			tableOut[id] = {}
			tableOut[id]["name"] = name
			tableOut[id]["numsettings"] = numsettings
			tableOut[id]["state"] = state
			tableOut[id]["type"] = type2
			tableOut[id]["fullName"] = getResourceInfo(resource, "name") or "Unknown"
			tableOut[id]["author"] = getResourceInfo(resource, "author") or "Unknown"
			tableOut[id]["version"] = getResourceInfo(resource, "version") or "Unknown"

			if ( getTickCount() > tick + 100 ) then
				-- Execution exceeded 100ms so pause and resume in 100ms
				setTimer(function()
					local status = coroutine.status(cor)
					if (status == "suspended") then
						coroutine.resume(cor)
					elseif (status == "dead") then
						cor = nil
					end
				end, 100, 1)
				if (antiCorMessageSpam == 0) then
					outputChatBox("Please wait, resource list still loading... Don't try refresh.", source, 255, 255, 0)
				end
				antiCorMessageSpam = antiCorMessageSpam + 1
				coroutine.yield()
				tick = getTickCount()
			end
		end
	elseif ( type == "admins" ) then
		for id, player in ipairs(getElementsByType("player")) do
			if isElement(player) and aPlayers[player] then
				tableOut[player] = {}
				tableOut[player]["admin"] = hasObjectPermissionTo ( player, "general.adminpanel" )
				if ( tableOut[player]["admin"] ) then
					tableOut[player]["chat"] = aPlayers[player]["chat"]
				end
				tableOut[player]["groups"] = "None"
				local account = getPlayerAccount ( player )
				if ( isGuestAccount ( account ) ) then
					tableOut[player]["groups"] = "Not logged in"
				else
					local groups = aclGetAccountGroups ( account )
					if ( #groups <= 0 ) then
						tableOut[player]["groups"] = "None"
					else
						tableOut[player]["groups"] = table.concat(table.reverse(groups), ", ")
					end
				end
			end
		end
	elseif ( type == "server" ) then
		tableOut["name"] = getServerName()
		tableOut["players"] = getMaxPlayers()
		tableOut["game"] = getGameType()
		tableOut["map"] = getMapName()
		tableOut["password"] = getServerPassword()
		tableOut["fps"] = getFPSLimit()
	elseif ( type == "bansdirty" ) then
		tableOut = nil
		g_Bans = nil
	elseif ( type == "bans" or type == "bansmore" ) then
		if not g_Bans then
			local bans = getBans()
			g_Bans = {}
			-- Reverse
			for i = #bans,1,-1 do
				table.insert( g_Bans, bans[i] )
			end
		end
		local from = ( tonumber( data ) or 0 ) + 1
		local to = math.min( from+24, #g_Bans )
		tableOut.total = #g_Bans
		for b=from,to do
			i = b - from + 1
			ban = g_Bans[b]
			local seconds = getBanTime(ban)
			tableOut[i] = {}
			tableOut[i].nick = getBanUsername(ban) or getBanNick(ban)
			tableOut[i].seconds = seconds
			tableOut[i].banner = getBanAdmin(ban)
			tableOut[i].ip = getBanIP(ban)
			tableOut[i].serial = getBanSerial(ban)
			tableOut[i].reason = getBanReason(ban)
			tableOut[i].unban = getUnbanTime(ban)
		end
	elseif ( type == "messages" ) then
		local unread, total = 0, 0
		for id, msg in ipairs ( aReports ) do
			if ( not msg.read ) then
				unread = unread + 1
			end
			total = total + 1
		end
		tableOut["unread"] = unread
		tableOut["total"] = total
	elseif ( type == "bansearch" ) then

			if not g_Bans then
			local bans = getBans()
			g_Bans = {}
			-- Reverse
			for i = #bans,1,-1 do
				table.insert( g_Bans, bans[i] )
			end
		end
		local from = ( tonumber( data ) or 0 ) + 1
		local to = math.min( from+24, #g_Bans )
		tableOut.total = #g_Bans
		local cnt = 1
		for b=1,#g_Bans do

				i = b - from + 1
				ban = g_Bans[b]
				local seconds = getBanTime(ban)
				tableOut[i] = {}
				tableOut[i].nick = getBanUsername(ban) or getBanNick(ban)
				tableOut[i].seconds = seconds
				tableOut[i].banner = getBanAdmin(ban)
				tableOut[i].ip = getBanIP(ban)
				tableOut[i].serial = getBanSerial(ban)
				tableOut[i].reason = getBanReason(ban)
				tableOut[i].unban = getUnbanTime(ban)
				local tType = getNeededTagType (data[1],ban)
				if getNeededTagType (data[1],ban) and string.match (string.lower(tType),string.lower(data[2])) then
					if (isElement(source)) then -- In case the source has quit during coroutine loading
						if cnt <= maxBanCount then
							cnt = cnt + 1
							triggerClientEvent ( source, "aClientSync", theSource, type, tableOut,data )
						else
							triggerClientEvent ( source, "aClientSync", theSource, "message", false,{"error","Be more specific in your search query! (keyword returns more than 100 matches) search not completed due to server load, it's limited to displaying the first 100 results now."} )
							return
						end
					end
				end
		end
		triggerClientEvent ( source, "aClientSync", theSource, "banlistend", false ) --Tell the player the loop has ended
		return

	end
	if (isElement(source)) then -- Incase the source has quit during coroutine loading
		triggerClientEvent ( source, "aClientSync", theSource, type, tableOut )
	end
end


 

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