Jump to content

[AYUDA] - Restriccion de Usuarios Para GUI


Sergioks

Recommended Posts

Posted

Hola!. Quisiera Saber Como Hacer que Un Usuario Pueda Abrir Un Panel Con Un Bind, pero solo para un grupo de ACL En Especifico. Yo Lo Hice Asi, Pero No Funciona.

Client-Side:

function gui () --- Bind De Abierto/Cerrado ( GUI ) 
    local state = ( not guiGetVisible ( StaffPanel ) ) 
    guiSetVisible ( StaffPanel, state ) 
    showCursor ( state ) 
    triggerServerEvent("OpenPanel", localPlayer) 
end 
bindKey ( "f5", "down", gui ) 

Server-Side:

addEvent("OpenPanel", true) 
addEventHandler("OpenPanel", root, 
function() 
local accName = getAccountName ( getPlayerAccount ( source ) ) 
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then  
end 
end 
) 

Ayuda :(

*Edit: Para Ser Honesto Solo Improvise Con Eso del

isObjectInACLGroup 

, Asi que Si Pudieran Explicarme Que Hacer, Les Agradeceria Mucho xD

Instagram | ¡Sígueme en YouTube! | Facebook
Todo se puede con algo de esfuerzo

Posted

Crea el bind server-side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Crea el bind server-side.

Me Dice:

Bad Argument's @ 'BindKey' 

:| ¿ahora que paso?

Server-Side:

function GUI() 
local accName = getAccountName ( getPlayerAccount ( source ) ) 
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
triggerClientEvent ("OpenPanel", getRootElement()) 
end 
end 
bindKey ( "f5", "down", GUI ) 

Instagram | ¡Sígueme en YouTube! | Facebook
Todo se puede con algo de esfuerzo

Posted

Eso es porque bindKey server-side tiene un argumento de jugador antes de la tecla ( el primer argumento es el jugador al que se le asignara el bind ).

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • MTA Team
Posted
function GUI() 
local accName = getAccountName ( getPlayerAccount ( source ) ) 
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
triggerClientEvent ("OpenPanel", getRootElement()) 
end 
end 
function bind() 
for i,v in ipairs(getElementsByType ( "player" )) do  
bindKey ( v,"f5", "down", GUI ) 
end 
end 
addEventHandler("onResourceStart",root,bind) 

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

 
Posted
function GUI( thePlayer ) 
  if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Admin" ) ) then 
    triggerClientEvent (thePlayer, "OpenPanel", thePlayer) 
  end 
end 
  
addEventHandler( 'onPlayerJoin', root, --Se les asigna el bind al conectarse 
  function() 
    bindKey ( source, "F5", "down", GUI ) 
  end 
) 
  
for k, i in ipairs( getElementsByType( 'player' ) do --y a los que ya están conectados. 
  bindKey ( i, "F5", "down", GUI ) 
end 

Cualquier problema me avisas, no estoy muy seguro respecto a los parámetros en una función manejada por un bind.

Developer @ MYVAL

Posted
function GUI() 
local accName = getAccountName ( getPlayerAccount ( source ) ) 
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
triggerClientEvent ("OpenPanel", getRootElement()) 
end 
end 
function bind() 
for i,v in ipairs(getElementsByType ( "player" )) do  
bindKey ( v,"f5", "down", GUI ) 
end 
end 
addEventHandler("onResourceStart",root,bind) 

Me Dice:

WARNING: StaffSystem/Server.lua:11: Bad Argument @ 'getPlayerAccount' [ Expected account at argument 1, got boolean ] 
WARNING: StaffSystem/Server.lua:11: Bad Argument @ 'getAccountName' [Expected account at argument 1, got boolean] 
ERROR: StaffSystem\Server.lua:12: arrempt to concatenate local 'accName' ( a Boolean Value ) 

function GUI( thePlayer ) 
  if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Admin" ) ) then 
    triggerClientEvent (thePlayer, "OpenPanel", thePlayer) 
  end 
end 
  
addEventHandler( 'onPlayerJoin', root, --Se les asigna el bind al conectarse 
  function() 
    bindKey ( source, "F5", "down", GUI ) 
  end 
) 
  
for k, i in ipairs( getElementsByType( 'player' ) do --y a los que ya están conectados. 
  bindKey ( i, "F5", "down", GUI ) 
end 

Cualquier problema me avisas, no estoy muy seguro respecto a los parámetros en una función manejada por un bind.

Me Dice:

StaffSystem/Server.lua:22: ')' expected near 'do' 

ayuda :|

Instagram | ¡Sígueme en YouTube! | Facebook
Todo se puede con algo de esfuerzo

  • MTA Team
Posted

Le falto cerrar un ) a @Alexs

function GUI( thePlayer ) 
local cuenta = getAccountName ( getPlayerAccount ( thePlayer ) ) 
if not cuenta or isGuestAccount(acc) then 
outputChatBox("ERROR!:",thePlayer,255,0,0,true) 
break  
end 
  if isObjectInACLGroup ("user."..cuenta, aclGetGroup ( "Admin" ) ) then 
    triggerClientEvent (thePlayer, "OpenPanel", thePlayer) 
  end 
end 
  
addEventHandler( 'onPlayerJoin', root, --Se les asigna el bind al conectarse 
  function() 
    bindKey ( source, "F5", "down", GUI ) 
  end 
) 
  
for k, i in ipairs( getElementsByType( 'player' )) do --y a los que ya están conectados. 
  bindKey ( i, "F5", "down", GUI ) 
end 
  

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

 
Posted
Le falto cerrar un ) a @Alexs
function GUI( thePlayer ) 
local cuenta = getAccountName ( getPlayerAccount ( thePlayer ) ) 
if not cuenta or isGuestAccount(acc) then 
outputChatBox("ERROR!:",thePlayer,255,0,0,true) 
break  
end 
  if isObjectInACLGroup ("user."..cuenta, aclGetGroup ( "Admin" ) ) then 
    triggerClientEvent (thePlayer, "OpenPanel", thePlayer) 
  end 
end 
  
addEventHandler( 'onPlayerJoin', root, --Se les asigna el bind al conectarse 
  function() 
    bindKey ( source, "F5", "down", GUI ) 
  end 
) 
  
for k, i in ipairs( getElementsByType( 'player' )) do --y a los que ya están conectados. 
  bindKey ( i, "F5", "down", GUI ) 
end 
  

Muchas Gracias .:CiBeR:.! :D

Instagram | ¡Sígueme en YouTube! | Facebook
Todo se puede con algo de esfuerzo

Posted

Me Dice:

StaffSystem/Server.lua:22: ')' expected near 'do' 

ayuda :|

Me falto cerrar un paréntesis en la linea 13, de todas formas me preocupa mas otro tema del que no estoy seguro.

Por favor, asegúrate de que el panel se muestre solo para quien utiliza el comando, insisto en que estoy dudoso respecto a los parámetros de la función.

Developer @ MYVAL

  • MTA Team
Posted

Por favor, asegúrate de que el panel se muestre solo para quien utiliza el comando, insisto en que estoy dudoso respecto a los parámetros de la función.

Handler Function Server-Side:

function functionName ( player keyPresser, string key, string keyState, [ var arguments, ... ] ) 

The values passed to this function are:

keyPresser: The player who pressed the key

key: The key that was pressed

keyState: The state of the key that was pressed, down if it was pressed, up if it was released.

arguments The optional arguments you specified when calling bindKey (see below).

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

 
  • MTA Team
Posted
Si alexs, me funciono. Gracias. Solo tuve el problema del ")" q ciber ayudo a cerrar.

También agregue:

isGuestAccount 

Ya que siempre es mejor comprobar si no esta logueado para evitar errores y además ahorrar recursos.

PD:Siempre recuerda Optimizar Tus scripts.

Saludos.

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

 
Posted
Si alexs, me funciono. Gracias. Solo tuve el problema del ")" q ciber ayudo a cerrar.

No hay problema, aunque déjalo así:

function GUI( thePlayer ) 
local acc = getPlayerAccount ( thePlayer ) 
 if not isGuestAccount( acc ) then 
  if isObjectInACLGroup ("user."..getAccountName ( acc ), aclGetGroup ( "Admin" ) ) then 
    triggerClientEvent (thePlayer, "OpenPanel", thePlayer) 
  end 
 end 
end 
  
addEventHandler( 'onPlayerJoin', root, --Se les asigna el bind al conectarse 
  function() 
    bindKey ( source, "F5", "down", GUI ) 
  end 
) 
  
for k, i in ipairs( getElementsByType( 'player' )) do --y a los que ya están conectados. 
  bindKey ( i, "F5", "down", GUI ) 
end 

La "corrección" que te dieron tenia algunas partes inútiles.

Developer @ MYVAL

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...