Sergioks Posted January 10, 2014 Posted January 10, 2014 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 Instagram | ¡Sígueme en YouTube! | Facebook Todo se puede con algo de esfuerzo
Castillo Posted January 10, 2014 Posted January 10, 2014 Crea el bind server-side. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sergioks Posted January 10, 2014 Author Posted January 10, 2014 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
Castillo Posted January 10, 2014 Posted January 10, 2014 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. Education is the most powerful weapon which you can use to change the world.
MTA Team 0xCiBeR Posted January 10, 2014 MTA Team Posted January 10, 2014 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
Alexs Posted January 11, 2014 Posted January 11, 2014 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
Sergioks Posted January 12, 2014 Author Posted January 12, 2014 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 0xCiBeR Posted January 12, 2014 MTA Team Posted January 12, 2014 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
Sergioks Posted January 12, 2014 Author Posted January 12, 2014 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:.! Instagram | ¡Sígueme en YouTube! | Facebook Todo se puede con algo de esfuerzo
MTA Team 0xCiBeR Posted January 12, 2014 MTA Team Posted January 12, 2014 De nada. DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp
Alexs Posted January 13, 2014 Posted January 13, 2014 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 0xCiBeR Posted January 13, 2014 MTA Team Posted January 13, 2014 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
Alexs Posted January 13, 2014 Posted January 13, 2014 Siempre pueden existir problemas aparte, sin importar lo que la wiki diga. Developer @ MYVAL
Sergioks Posted January 14, 2014 Author Posted January 14, 2014 Si alexs, me funciono. Gracias. Solo tuve el problema del ")" q ciber ayudo a cerrar. Instagram | ¡Sígueme en YouTube! | Facebook Todo se puede con algo de esfuerzo
MTA Team 0xCiBeR Posted January 14, 2014 MTA Team Posted January 14, 2014 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
Alexs Posted January 14, 2014 Posted January 14, 2014 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
Recommended Posts