Jump to content

Draw ACL


Lalalu

Recommended Posts

Este ejemplo dibuja cada acl con sus objetos, espero que te sirva:

--
-- server
--
function get(player)
	local result = {};

	for i, acl in pairs(aclGroupList()) do
		result[i] = {name = aclGroupGetName(acl), objects = {}};

		for object, name in pairs(aclGroupListObjects(acl)) do
			table.insert(result[i].objects, name);
		end
	end

	triggerClientEvent(player, "receive", resourceRoot, result);
end
addEvent("get", true);
addEventHandler("get", resourceRoot, get);

--
-- client
--
local data = nil;

function start()
	triggerServerEvent("get", resourceRoot, localPlayer);
end
addEventHandler("onClientResourceStart", resourceRoot, start);

function receive(acls)
	data = acls;
end
addEvent("receive", true);
addEventHandler("receive", resourceRoot, receive);

function render()
	if not data then
		return;
	end

	local offset_y = 0;

	for i, value in pairs(data) do
		dxDrawText(value.name, 200, offset_y);

		offset_y = offset_y + 20;

		for i, object in pairs(value.objects) do
			dxDrawText(object, 220, offset_y);

			offset_y = offset_y + 20;
		end
	end
end
addEventHandler("onClientRender", root, render);

 

  • Thanks 1
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...