Jump to content

BINDKEY VERIFICATION


Recommended Posts

Olá pessoal, bom estava dando uma olhadinha na wiki pra ver se tem algo relacionado a ocultar a bindkey de uma tecla se o jogador não estiver na ACL x, exemplo:

ACL1 - Teria acesso a bindkey m pra enviar mensagens com tag no chat.

-----------------

Agora se o jogador não estiver na ACL1 e se ele pressionar a tecla 'M' nada acontece, não iria abrir o chat nem nada, tipo um 'cancelevent' 

 

OBS: A bindkey esta no lado client.

Edited by OverKILL
Link to comment
-- client side
function teste()
	outputChatBox("estou na acl")
end

addEvent( "addBind", true )
addEventHandler( "addBind", localPlayer,
	function()
		bindKey ( "M", "up", teste ) 
	end
)

addEventHandler( "onClientResourceStart", resourceRoot,
	function()
		if getKeyBoundToFunction( teste ) ~= "M" then
			triggerServerEvent ( "upRequest", localPlayer )
		end
	end
)
-- server side
addEventHandler ( "onResourceStart", resourceRoot,
	function()
		for _, thePlayer in ipairs(getElementsByType("player")) do
			if estaAcl(thePlayer,"BOPE") then
				triggerClientEvent ( thePlayer, "addBind", thePlayer )
			end
		end
	end
)

addEventHandler("onPlayerLogin", root,
	function()
		local thePlayer = source
		if estaAcl(thePlayer,"BOPE") then
			triggerClientEvent ( thePlayer, "addBind", thePlayer )
		end
	end
)

function estaAcl(thePlayer, acl)
	local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
	if isObjectInACLGroup ("user."..accName, aclGetGroup ( acl ) ) then
		return true
	end
	return false
end

addEvent( "upRequest", true )
addEventHandler( "upRequest", root,
	function()
		local thePlayer = client
		if estaAcl(thePlayer,"BOPE") then
			triggerClientEvent ( thePlayer, "addBind", thePlayer )
		end
	end
)

 

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