Jump to content

Why doesn't this acl script work?


Wananazo

Recommended Posts

This script is not working it has an assigned acl group Police and the script should only give permissions to those of that group, but the truth is that everyone can open the panel who can guide me

 

Grupo = { "Policial" } -- Grupos do Painel P, que terá acesso ao DX !

function isPlayerOnGroup2 ( thePlayer )
    local account = getPlayerAccount ( thePlayer )
    local inGroup = false
    for _, group in ipairs ( Grupo ) do
        if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) ) then
            inGroup = true
            break
        end
    end
    return inGroup
end
 
 
function ClickJogdor ( Player )
  if isPlayerOnGroup2 ( source ) then
  	local account = getPlayerAccount (Player)
    if isGuestAccount (account) then msgFeniX(source, "Esse Jogador está deslogado !", "error") return end
   local cx, cy, cz = getElementPosition ( Player )
    local px, py, pz = getElementPosition ( source )
     local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
     if ( distance <= 1.7 ) then
  -- if Player == source then return end
      triggerClientEvent (source , "FeniX_AbrirDX" , source)
	  setElementData(source, "FeniXMTA_Suspeito" , Player)
	 
	  end
    end
end
addEvent ( "FeniX_ClickJogdor", true )
addEventHandler ( "FeniX_ClickJogdor", root, ClickJogdor)  

 

Link to comment
39 minutes ago, Wananazo said:

This script is not working it has an assigned acl group Police and the script should only give permissions to those of that group, but the truth is that everyone can open the panel who can guide me

 


Grupo = { "Policial" } -- Grupos do Painel P, que terá acesso ao DX !

function isPlayerOnGroup2 ( thePlayer )
    local account = getPlayerAccount ( thePlayer )
    local inGroup = false
    for _, group in ipairs ( Grupo ) do
        if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) ) then
            inGroup = true
            break
        end
    end
    return inGroup
end
 
 
function ClickJogdor ( Player )
  if isPlayerOnGroup2 ( source ) then
  	local account = getPlayerAccount (Player)
    if isGuestAccount (account) then msgFeniX(source, "Esse Jogador está deslogado !", "error") return end
   local cx, cy, cz = getElementPosition ( Player )
    local px, py, pz = getElementPosition ( source )
     local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
     if ( distance <= 1.7 ) then
  -- if Player == source then return end
      triggerClientEvent (source , "FeniX_AbrirDX" , source)
	  setElementData(source, "FeniXMTA_Suspeito" , Player)
	 
	  end
    end
end
addEvent ( "FeniX_ClickJogdor", true )
addEventHandler ( "FeniX_ClickJogdor", root, ClickJogdor)  

 

No idea what you're trying to do with function 2 but i fixed the check. if the check's your only problem then this should fix it.

local Grupo = {
	["Policial"] = true
	-- You can add more groups here if you want.
}

function isPlayerOnGroup2 ( thePlayer )
    local account = getPlayerAccount ( thePlayer )
	for group, bool in pairs(Grupo) do
		if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup(group)) then
			return true
        end
		return false 
    end
end
 
function ClickJogdor ( Player )
	if isPlayerOnGroup2 ( source ) then
		local account = getPlayerAccount (Player)
		if isGuestAccount (account) then msgFeniX(source, "Esse Jogador está deslogado !", "error") return end
		local cx, cy, cz = getElementPosition ( Player )
		local px, py, pz = getElementPosition ( source )
		local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
		if ( distance <= 1.7 ) then
		-- if Player == source then return end
			triggerClientEvent (source , "FeniX_AbrirDX" , source)
			setElementData(source, "FeniXMTA_Suspeito" , Player)
		end
    end
end
addEvent ( "FeniX_ClickJogdor", true )
addEventHandler ( "FeniX_ClickJogdor", root, ClickJogdor)  

 

  • Thanks 1
Link to comment
13 hours ago, Bean666 said:

No tengo idea de lo que estás tratando de hacer con la función 2, pero arreglé el cheque. si el cheque es su único problema, entonces esto debe solucionarlo.



local Grupo = {
	["Policial"] = true
	-- You can add more groups here if you want.
}

function isPlayerOnGroup2 ( thePlayer )
    local account = getPlayerAccount ( thePlayer )
	for group, bool in pairs(Grupo) do
		if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup(group)) then
			return true
        end
		return false 
    end
end
 
function ClickJogdor ( Player )
	if isPlayerOnGroup2 ( source ) then
		local account = getPlayerAccount (Player)
		if isGuestAccount (account) then msgFeniX(source, "Esse Jogador está deslogado !", "error") return end
		local cx, cy, cz = getElementPosition ( Player )
		local px, py, pz = getElementPosition ( source )
		local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
		if ( distance <= 1.7 ) then
		-- if Player == source then return end
			triggerClientEvent (source , "FeniX_AbrirDX" , source)
			setElementData(source, "FeniXMTA_Suspeito" , Player)
		end
    end
end
addEvent ( "FeniX_ClickJogdor", true )
addEventHandler ( "FeniX_ClickJogdor", root, ClickJogdor)  

Ok I have already noticed the change, that is the acl that I have in the server file and in the client I have the Dx function, as you will see, I am learning thanks to the people who help in the forum. I would like to know in that script what helps the work of the client files panel is the triggerClientEvent (source, "FeniX_AbrirDX", source) I would like to understand why it keeps leaving without acl permission in the game if you need more part of the code let me know that I am willing to learn (I don't speak English)

 

Edited by Wananazo
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...