Jump to content

permisão acl


Recommended Posts

tem algum  erro e não estou conseguindo resolver 

function area ( setArea )
	createColRectangle ( 95, 1700, 325,450)
	createRadarArea ( 95, 1700, 325,450, 0, 0, 0, 175 )
	outputChatBox("Zone Created", source, 255, 0, 0)
	if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Owner")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Moderator")) then

	end
end
addCommandHandler ( "setEventArea", area)

Quero que essa função seja permitida apenas para "Lead Admin,Owner, moderator "

Porem não sei como criar comando para desativar a "area", porfavor alem pode ajudar ?

Corrigi varios erros porem ainda sim continua dando erros :(

Edited by kevincouto6
Link to comment
  • Other Languages Moderators

Para verificar erros no código, deixe o /debugscript 3 ativado.

E seu código as vezes usa source e as vezes usa thePlayer, mas em nenhum momento thePlayer foi declarado.

O que seria o parâmetro setArea? O comando em si? Pois de acordo com a Wiki, os parâmetros da função de addCommandHandler na parte server-side são: O jogador, o comando e os argumentos do comando.

function area (thePlayer) -- setArea não existe, o primeiro parâmetro aqui é quem está usando o comando, no caso o jogador.
	createColRectangle (95, 1700, 325, 450)
	createRadarArea (95, 1700, 325, 450, 0, 0, 0, 175)
	outputChatBox ("Zone Created", thePlayer, 255, 0, 0) -- Só usa-se source se nenhum parâmetro for declarado na função, como informamos thePlayer, use-o.
	if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Owner")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Moderator")) then
		-- Vc pode deixar uma mensagem de teste só para verificar se o código está lendo aqui.
		print ("Funcionando.")
	end
end
addCommandHandler ("setEventArea", area)

Ou se preferir usar o source em vez de thePlayer, da pra fazer assim:

function area ()
	createColRectangle (95, 1700, 325, 450)
	createRadarArea (95, 1700, 325, 450, 0, 0, 0, 175)
	outputChatBox ("Zone Created", source, 255, 0, 0)
	if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Owner")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then
		print ("Funcionando.")
	end
end
addCommandHandler ("setEventArea", area)

 

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

Para destruir a zona, é necessário que ela esteja dentro de uma variável para vc conseguir chamá-la depois. Para isso, faça assim:

function area (thePlayer)
	radarCol = createColRectangle (95, 1700, 325, 450)
	radarArea = createRadarArea (95, 1700, 325, 450, 0, 0, 0, 175)
	outputChatBox ("Zone Created", thePlayer, 255, 0, 0)
	if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Owner")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Moderator")) then
		-- Vc pode deixar uma mensagem de teste só para verificar se o código está lendo aqui.
		print ("Funcionando.")
	end
end
addCommandHandler ("setEventArea", area)

function delArea (thePlayer)
	if isElement (radarCol) and isElement (radarArea) then
		if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Owner")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Moderator")) then
			destroyElement (radarCol)
			destroyElement (radarArea)
			radarCol = nil -- Sempre que destruir um elemento, vc deve anular a variável que estava sendo usada por ele.
			radarArea = nil
			outputChatBox ("Zone destroyed", thePlayer, 255, 0, 0)
		end
	end
end
addCommandHandler ("delEventArea", delArea)

 

Edited by Lord Henry
Link to comment
11 hours ago, Lord Henry said:

Para verificar erros no código, deixe o /debugscript 3 ativado.

E seu código as vezes usa source e as vezes usa thePlayer, mas em nenhum momento thePlayer foi declarado.

O que seria o parâmetro setArea? O comando em si? Pois de acordo com a Wiki, os parâmetros da função de addCommandHandler na parte server-side são: O jogador, o comando e os argumentos do comando.


function area (thePlayer) -- setArea não existe, o primeiro parâmetro aqui é quem está usando o comando, no caso o jogador.
	createColRectangle (95, 1700, 325, 450)
	createRadarArea (95, 1700, 325, 450, 0, 0, 0, 175)
	outputChatBox ("Zone Created", thePlayer, 255, 0, 0) -- Só usa-se source se nenhum parâmetro for declarado na função, como informamos thePlayer, use-o.
	if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Owner")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Moderator")) then
		-- Vc pode deixar uma mensagem de teste só para verificar se o código está lendo aqui.
		print ("Funcionando.")
	end
end
addCommandHandler ("setEventArea", area)

Ou se preferir usar o source em vez de thePlayer, da pra fazer assim:


function area ()
	createColRectangle (95, 1700, 325, 450)
	createRadarArea (95, 1700, 325, 450, 0, 0, 0, 175)
	outputChatBox ("Zone Created", source, 255, 0, 0)
	if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Owner")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then
		print ("Funcionando.")
	end
end
addCommandHandler ("setEventArea", area)

 

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

Para destruir a zona, é necessário que ela esteja dentro de uma variável para vc conseguir chamá-la depois. Para isso, faça assim:


function area (thePlayer)
	radarCol = createColRectangle (95, 1700, 325, 450)
	radarArea = createRadarArea (95, 1700, 325, 450, 0, 0, 0, 175)
	outputChatBox ("Zone Created", thePlayer, 255, 0, 0)
	if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Owner")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Moderator")) then
		-- Vc pode deixar uma mensagem de teste só para verificar se o código está lendo aqui.
		print ("Funcionando.")
	end
end
addCommandHandler ("setEventArea", area)

function delArea (thePlayer)
	if isElement (radarCol) and isElement (radarArea) then
		if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Owner")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) or isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Moderator")) then
			destroyElement (radarCol)
			destroyElement (radarArea)
			radarCol = nil -- Sempre que destruir um elemento, vc deve anular a variável que estava sendo usada por ele.
			radarArea = nil
			outputChatBox ("Zone destroyed", thePlayer, 255, 0, 0)
		end
	end
end
addCommandHandler ("delEventArea", delArea)

 

Muito obrigado pela ajuga,love xD

 

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