BorderLine Posted November 18, 2011 Share Posted November 18, 2011 Buenas a todos la gente que visita el foro necesito una puequeña manito. resulta que estaba editando un script. el script consiste en darle un panel a cada lider de clanes para agregar miembros o removerlos a un grupo acl el script debe estar agregado a la acl de admin claro. pero tengo un problema yo quiero que los lideres abran este panel sin necesidad de ser adm. bueno les mostrare el script clientside function unfuck(text) return string.gsub(text, "(#%x%x%x%x%x%x)", function(colorString) return "" end) end function onModeratorButtonClick() local row, col = guiGridListGetSelectedItem(playerList) if row == -1 or col == -1 then return end local name = guiGridListGetItemText(playerList, row, col) local target = getPlayerFromName(name) if target then triggerServerEvent("switchPlayerToGroup", getLocalPlayer(), target, "USS") end end function onSuperModeratorButtonClick() local row, col = guiGridListGetSelectedItem(playerList) if row == -1 or col == -1 then return end local name = guiGridListGetItemText(playerList, row, col) local target = getPlayerFromName(name) if target then triggerServerEvent("switchPlayerToGroup", getLocalPlayer(), target, "SuperModerator") end end addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Grid = {} Window1 = guiCreateWindow(207,287,400,300,"Sistema de Clanes USS",false) Moderator = guiCreateButton(18,32,83,37,"Add/remove",false,Window1) guiSetFont(Moderator,"default-bold-small") addEventHandler("onClientGUIClick", Moderator, onModeratorButtonClick, true ) --SuperModerator = guiCreateButton(18,94,86,40,"S.Moderador",false,Window1) guiSetFont(SuperModerator,"default-bold-small") addEventHandler("onClientGUIClick", SuperModerator, onSuperModeratorButtonClick, true ) playerList = guiCreateGridList ( 112, 35, 290, 200, false,Window1 ) local column = guiGridListAddColumn( playerList, "Jugadores", 0.9 ) for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, row, column, unfuck(getPlayerName(player)), false, false ) guiGridListSetItemColor ( playerList, row, column, 35, 107, 142, 255 ) end guiCreateStaticImage( 15,175, 100, 100, "data/logo.png", false,Window1 ) fechar = guiCreateButton(300,250,100,35,"Cerrar",false,Window1) guiSetVisible(Window1, false) addEventHandler("onClientGUIClick", fechar, function() guiSetVisible( Window1, false) showCursor( false) end, false ) end) addEvent("openWindow1",true) function openWindow1() guiSetVisible(Window1, true) showCursor(true) end addEventHandler("openWindow1", getRootElement(), openWindow1) function atualizarlista() guiGridListClear(playerList) for id, players in ipairs (getElementsByType("player")) do local row = guiGridListAddRow(playerList) guiGridListSetItemText(playerList, row, 1, unfuck(getPlayerName(players)), false, false) guiGridListSetItemColor ( playerList, row, 1, 0, 250, 154, 255 ) end end addEventHandler("onClientPlayerJoin", getRootElement(), atualizarlista) addEventHandler("onClientPlayerQuit", getRootElement(), atualizarlista) addEventHandler("onClientPlayerChangeNick", getRootElement(), atualizarlista) creo que no tiene tanta importancia. es mas lo grafico o algo --serverside addEvent("switchPlayerToGroup",true) function switchPlayerToGroup(player, groupname) local account = getPlayerAccount(player) if ( not isGuestAccount ( account ) ) then local group = aclGetGroup ( groupname ) if ( group ) then local isInACLGroup = isObjectInACLGroup ( "user." .. getAccountName ( account ), group) if ( not isInACLGroup ) then aclGroupAddObject ( group, "user."..getAccountName ( account ) ) outputChatBox ( "* " .. getPlayerName(player) .. " fue agregado a USS " .. groupname .. ".", source, 0, 255 ,0 ) elseif ( isInACLGroup ) then aclGroupRemoveObject ( group, "user."..getAccountName ( account ) ) outputChatBox ( "* " .. getPlayerName(player) .. " fue removido de USS " .. groupname .. ".", source, 255, 255 ,0 ) end else outputChatBox ( "* " .. groupname .. " no existe.", source, 255, 0 ,0 ) end else outputChatBox ( "Jugador no esta registrado/logeado.", source, 255, 100 ,100 ) end end addEventHandler("switchPlayerToGroup", getRootElement(), switchPlayerToGroup) function showPanel(thePlayer) if ( hasObjectPermissionTo (thePlayer, "command.shutdown", true) ) then triggerClientEvent(thePlayer, "openWindow1", getRootElement()) else outputChatBox ("Acesso Negado", thePlayer, 193, 13, 13) end end addCommandHandler("usspanel", showPanel) en breve resumen al parecer este es el codigo function showPanel(thePlayer) if ( hasObjectPermissionTo (thePlayer, "command.shutdown", true) ) then triggerClientEvent(thePlayer, "openWindow1", getRootElement()) else outputChatBox ("Acesso Negado", thePlayer, 193, 13, 13) end end addCommandHandler("usspanel", showPanel) espero que puedan ayudarme, cree este post aqui porque los buenos scripter que me han ayudado asta ahora hablan español muchas gracias por su atencion Link to comment
Serginix Posted November 18, 2011 Share Posted November 18, 2011 function showPanel(thePlayer) triggerClientEvent(thePlayer, "openWindow1",thePlayer) end addCommandHandler("usspanel", showPanel) Eso aria que cualquier persona q usara tu comando "usspanel" viera el panel del trigeo, como lo tenias, solo las personas (Admines) con acceso al comando "shutdown" podrian verlo. Link to comment
BorderLine Posted November 18, 2011 Author Share Posted November 18, 2011 mira, intente esto solo para que la gente de ese grupo de acl pueda abrir el panel, ahora intento hacerlo pero no abre debugscript no detecta errores, nose si hay algo malo function showPanel(thePlayer) local account = getPlayerAccount(theplayer) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then triggerClientEvent(thePlayer, "openWindow1", getRootElement()) else outputChatBox ("¡Acesso Denegado!", thePlayer, 255, 0, 0) end end addCommandHandler("usspanel", showPanel) Link to comment
Castillo Posted November 18, 2011 Share Posted November 18, 2011 function showPanel(thePlayer) local account = getPlayerAccount(thePlayer) -- Habias puesto theplayer, con la P en minusculas. if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then triggerClientEvent(thePlayer, "openWindow1", getRootElement()) else outputChatBox ("¡Acesso Denegado!", thePlayer, 255, 0, 0) end end addCommandHandler("usspanel", showPanel) Link to comment
BorderLine Posted November 18, 2011 Author Share Posted November 18, 2011 ke tontera .. siempre me pasa, eso me pasa por escribirlo apurado bueno muchas gracias solid se te agradese una vez mas Link to comment
Recommended Posts