Jump to content

[AYUDA] - Restriccion de Usuarios Para GUI


Sergioks

Recommended Posts

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

Link to comment
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 ) 

Link to comment
  • MTA Team
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) 

Link to comment
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.

Link to comment
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 :|

Link to comment
  • MTA Team

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 
  

Link to comment
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

Link to comment

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.

Link to comment
  • MTA Team

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

Link to comment
  • MTA Team
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.

Link to comment
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.

Link to comment
  • Recently Browsing   0 members

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