Jump to content

Problema con GPP (Panel para Dar Permisos)


TigreBlanco

Recommended Posts

Este es mi Primer Tema :D Espero que me Apoyen, Tengo un Pequeño Problema, Necesito Poner el Panel para Dar Permisos en el Server Juramento Freeroam, El Problema Consiste en que Hace Poco Tiempo Agregue Nuevos Grupos en ACL, Agregue el Grupo VIP y Fundador, Ahora, Cuando Quiero Ponerlo en GPP, es Decir, Para Dar Permisos de VIP en el Server, para no Molestarse en Cerrarlo (Todavia no Tengo Host) Agregar a la Persona, y Volverlo a Abrir, Quiero Agregar por el GPP Dentro del Server, es Decir, Como Puedo Modificar el Panel para que Funcione sin Errores y Contenga 4 Apartados en Vez de 3, Give Moderator, Supermod, Admin, y VIP. Gracias de Antemano a Todos los Quien me Ayuden a Solucionar Este problema, Aqui Os Paso la Version que Hice Mal:

GppWindow = guiCreateWindow(0.1900,0.3400,0.6400,0.4500,"Panel para Dar Permisos por TigreBlanco",true) 
guiSetVisible(GppWindow,false) 
guiWindowSetSizable(GppWindow,false) 
Gpedit = guiCreateEdit(251,54,203,33,"",false,GppWindow) 
GiveModeratorButton = guiCreateButton(250,91,215,40,"Give Moderator Permissions",false,GppWindow) 
[color=#FF0000]GiveModeratorButton = guiCreateButton(250,91,215,40,"Give VIP Permissions",false,GppWindow[/color]) 
GiveSuperModeratorButton = guiCreateButton(250,143,215,40,"Give SuperModerator Permissions",false,GppWindow) 
GiveAdminsButton = guiCreateButton(251,194,210,40,"Give Admin Permissions",false,GppWindow) 
label = guiCreateLabel(252,31,154,17,"Player :",false,GppWindow) 
CloseButton = guiCreateButton(445,25,18,16,"X",false,GppWindow) 
removebutton = guiCreateButton(369,26,65,21,"remove",false,GppWindow) 

addEvent("[color=#FF0000]VIP[/color]",true) 
function Moderator(target) 
    local account = getPlayerAccount ( target ) 
    local group = aclGetGroup ( "[color=#FF0000]VIP[/color]" ) 
    if ( group ) then 
        aclGroupAddObject ( group, "user."..getAccountName ( account ) ) 
        outputChatBox ( "GPP: '"..getAccountName(getPlayerAccount(target)).."' have been given [color=#FF0000]VIP[/color] permissions", source, 0, 255 ,0 ) 
    else 
        outputChatBox ( "No account name specified", source, 255, 100 ,100 ) 
    end 
end 

Link to comment
Es ese todo el script? si no, entonces postealo todo.

Ok Disculpa Castillo :D, Esque me Emociono Cuando me Habla un Famoso, Orita lo Posteo. Lo Traduci al Español en Menos de 3 Min :) Muy Facil.

gp-c.lua:

-- * Reeditado Por TigreBlanco, Hecho por $ora 
  
GppWindow = guiCreateWindow(0.1900,0.3400,0.6400,0.4500,"Panel para Dar Permisos por TigreBlanco",true) 
guiSetVisible(GppWindow,false) 
guiWindowSetSizable(GppWindow,false) 
Gpedit = guiCreateEdit(251,54,203,33,"",false,GppWindow) 
GiveModeratorButton = guiCreateButton(250,91,215,40,"Dar Permisos de Moderador",false,GppWindow) 
GiveSuperModeratorButton = guiCreateButton(250,143,215,40,"Dar Permisos de SuperModerador",false,GppWindow) 
GiveAdminsButton = guiCreateButton(251,194,210,40,"Dar Permisos de Admin",false,GppWindow) 
label = guiCreateLabel(252,31,154,17,"Jugador :",false,GppWindow) 
CloseButton = guiCreateButton(445,25,18,16,"X",false,GppWindow) 
removebutton = guiCreateButton(369,26,65,21,"eliminar",false,GppWindow) 
  
-------------------------- 
---Lista Grid 
------------------------- 
  
addEventHandler("onClientResourceStart",resourceRoot, 
function() 
grid = guiCreateGridList(9,25,228,214,false,GppWindow) 
guiGridListSetSelectionMode(grid,2) 
local column = guiGridListAddColumn( grid, "Nombre del Jugador", 0.89 ) 
if ( column ) then 
for id, player in ipairs(getElementsByType("player")) do 
    local row = guiGridListAddRow ( grid ) 
        guiGridListSetItemText ( grid, row, column, getPlayerName(player), false, false ) 
        guiGridListSetItemColor ( grid, row, column, 0, 250, 154, 255 ) 
        end 
        addEventHandler ( "onClientGUIClick", grid, click ) 
    end 
end) 
  
function click () 
       local playerName = guiGridListGetItemText ( grid, guiGridListGetSelectedItem ( grid ), 1 ) 
       guiSetText ( Gpedit, playerName ) 
end 
  
---------------------------- 
--Abrir Panel con Comando 
-------------------------- 
  
function showPanel () 
guiSetVisible (GppWindow, true) 
showCursor (true) 
playSound("open.mp3",false) 
end 
addEvent( "showPanel", true ) 
addEventHandler ( "showPanel", getRootElement(), showPanel) 
  
  
------------------------ 
--Event para Bind Key 
------------------------ 
  
function show() 
    if guiGetVisible(GppWindow) == true then 
        guiSetVisible(GppWindow,false) 
        showCursor(false) 
    else 
        guiSetVisible(GppWindow,true) 
        showCursor(true) 
    end 
end 
addEvent("show",true) 
addEventHandler("show",root,show) 
  
--------------------- 
--Cuando le Das Clic 
-------------------- 
  
function onGuiClick (button, state, absoluteX, absoluteY) 
    if (source == CloseButton) then 
    guiSetVisible (GppWindow, false) 
    showCursor (false) 
    elseif (source == removebutton) then 
    local name = guiGetText ( Gpedit ) 
    local target = getPlayerFromName(name) 
    triggerServerEvent ("remove", getLocalPlayer(), target) 
    elseif (source == GiveModeratorButton) then 
    local name = guiGetText ( Gpedit ) 
    local target = getPlayerFromName(name) 
    triggerServerEvent("Moderator", getLocalPlayer(), target) 
    playSound("sec.wav",false) 
    elseif (source == GiveSuperModeratorButton) then 
    local name = guiGetText ( Gpedit ) 
    local target = getPlayerFromName(name) 
    triggerServerEvent("SuperModerator", getLocalPlayer(), target) 
    playSound("sec.wav",false) 
    elseif (source == GiveAdminsButton) then 
    local name = guiGetText ( Gpedit ) 
    local target = getPlayerFromName(name) 
    triggerServerEvent("Admin", getLocalPlayer(), target) 
    playSound("sec.wav",false) 
end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) 
  
----------------------- 
--Obtener Permisos 
--------------------- 
  
function GetPermission() 
triggerServerEvent ("OpenPanel", getLocalPlayer(), OpenPanel) 
end 
  
---------------------- 
--Sonidos 
--------------------- 
  
function nopsound () 
playSound("np.mp3",false) 
end 
addEvent( "nopsound", true ) 
addEventHandler ( "nopsound", getRootElement(), nopsound) 
  
function removedsound () 
playSound("removed.wav",false) 
end 
addEvent( "removedsound", true ) 
addEventHandler ( "removedsound", getRootElement(), removedsound) 
  
-------------------- 
--Refrescar la Lista de Jugadores 
-------------------- 
  
function list() 
    guiGridListClear(grid) 
    for id, players in ipairs (getElementsByType("player")) do 
        local row = guiGridListAddRow(grid) 
        guiGridListSetItemText(grid, row, 1, getPlayerName(players), false, false) 
        guiGridListSetItemColor ( grid, row, 1, 0, 250, 154, 255 ) 
    end 
end 
addEventHandler("onClientPlayerJoin", getRootElement(), list) 
addEventHandler("onClientPlayerQuit", getRootElement(), list) 
addEventHandler("onClientPlayerChangeNick", getRootElement(), list) 
  
-- * Reeditado por TigreBlanco, Hecho por $ora 

gp-s.lua:

-- * Editado por TigreBlanco, Hecho por $ora 
local rootElement = getRootElement() 
  
addEventHandler("onPlayerJoin",root, 
function () 
    bindKey(source,"i","down",show) 
end) 
  
addEventHandler("onResourceStart",resourceRoot, 
function () 
    for index, player in ipairs(getElementsByType("player")) do 
        bindKey(player,"i","down",show) 
    end 
end) 
  
function show(thePlayer) 
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("Console")) then 
  
        triggerClientEvent(thePlayer,"showPanel",thePlayer) 
    else 
       outputChatBox ("* No Tienes los Suficientes Permisos para Este Comando", thePlayer, 255, 0, 0, true) 
       triggerClientEvent ( thePlayer,"nopsound", thePlayer ) 
    end 
end 
  
------------------------ 
--Dar Adm, Mod, SuperMod 
----------------------- 
  
addEvent("Moderator",true) 
function Moderator(target) 
    local account = getPlayerAccount ( target ) 
    local group = aclGetGroup ( "Moderator" ) 
    if ( group ) then 
        aclGroupAddObject ( group, "user."..getAccountName ( account ) ) 
        outputChatBox ( "A '"..getAccountName(getPlayerAccount(target)).."' Le Han Sido Consedidos Permisos de Moderador", source, 0, 255 ,0 ) 
    else 
        outputChatBox ( "No Has Especificado el Nombre de la Cuenta", source, 255, 100 ,100 ) 
    end 
end 
addEventHandler("Moderator", getRootElement(), Moderator) 
  
addEvent("SuperModerator",true) 
function SuperModerator(target) 
    local account = getPlayerAccount ( target ) 
    local group = aclGetGroup ( "SuperModerator" ) 
    if ( group ) then 
        aclGroupAddObject ( group, "user."..getAccountName ( account ) ) 
        outputChatBox ( "A '"..getAccountName(getPlayerAccount(target)).."' Le Han Sido Consedidos Permisos de SuperModerador", source, 0, 255 ,0 ) 
    else 
        outputChatBox ( "No Has Especificado el Nombre de la Cuenta", source, 255, 100 ,100 ) 
    end 
end 
addEventHandler("SuperModerator", getRootElement(), SuperModerator) 
  
addEvent("Admin",true) 
function Admin(target) 
    local account = getPlayerAccount ( target ) 
    local group = aclGetGroup ( "Admin" ) 
    if ( group ) then 
        aclGroupAddObject ( group, "user."..getAccountName ( account ) ) 
        outputChatBox ( "A '"..getAccountName(getPlayerAccount(target)).."' Le Han Sido Consedidos Permisos de Administrador", source, 0, 255 ,0 ) 
    else 
        outputChatBox ( "No Has Especificado el Nombre de la Cuenta", source, 255, 100 ,100 ) 
    end 
end 
  
addEvent("SuperModerator",true) 
function SuperModerator(target) 
    local account = getPlayerAccount ( target ) 
    local group = aclGetGroup ( "SuperModerator" ) 
    if ( group ) then 
        aclGroupAddObject ( group, "user."..getAccountName ( account ) ) 
        outputChatBox ( "A: '"..getAccountName(getPlayerAccount(target)).."' Le Han Sido Consedidos Permisos de SuperModerador", source, 0, 255 ,0 ) 
    else 
        outputChatBox ( "No Has Especificado el Nombre de la Cuenta", source, 255, 100 ,100 ) 
    end 
end 
addEventHandler("Admin", getRootElement(), Admin) 
  
addEvent("remove",true) 
function removee(target) 
    local account = getPlayerAccount ( target ) 
    if ( account ) then 
        aclGroupRemoveObject (aclGetGroup("Moderator"), "user."..getAccountName ( account ) ) 
        aclGroupRemoveObject (aclGetGroup("SuperModerator"), "user."..getAccountName ( account ) ) 
        aclGroupRemoveObject (aclGetGroup("Admin"), "user."..getAccountName ( account ) ) 
        outputChatBox ( "Todos los Permisos De '"..getAccountName(getPlayerAccount(target)).."' han Sido Eliminados !", source, 255, 0 ,0 ) 
         triggerClientEvent ( source,"removedsound", source ) 
    else 
    outputChatBox ( "No Has Especificado el Nombre de la Cuenta", source, 255, 100 ,100 ) 
    end 
end 
addEventHandler("remove", getRootElement(), removee) 
  
---------------------- 
--Comando 
---------------------- 
function OpenPanel ( player ) 
    local player = player or source 
    local accountname = getAccountName( getPlayerAccount( player ) ) 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Console" ))  then 
       triggerClientEvent ( player,"showPanel", player ) 
    else 
       outputChatBox ("* No Tienes los Suficientes Permisos Parta Este Comando", player, 255, 0, 0, true) 
       triggerClientEvent ( player,"nopsound", player ) 
    end 
end 
addEvent( "OpenPanel", true ) 
addEventHandler ( "OpenPanel", getRootElement(), OpenPanel) 
addCommandHandler ( "pdp", OpenPanel ) 
  
function check() 
local accountname = getAccountName(getPlayerAccount(source)) 
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Console" ))  then 
outputChatBox ("Escribe /pdp o Apreta la Tecla I para Abrir el Panel para dar Permisos", source, 255, 0, 0, true) 
end 
end 
addEventHandler("onPlayerLogin",getRootElement(),check ) 
-- * Editado por TigreBlanco, Hecho por $ora 

Link to comment

Te lo mejore y ademas agrege el boton para dar 'VIP'.

-- client side:

-- * Reeditado Por TigreBlanco, Hecho por $ora 
  
GppWindow = guiCreateWindow(0.1900,0.3400,0.6400,0.4500,"Panel para Dar Permisos por TigreBlanco",true) 
guiSetVisible(GppWindow,false) 
guiWindowSetSizable(GppWindow,false) 
Gpedit = guiCreateEdit(251,54,203,33,"",false,GppWindow) 
GiveModeratorButton = guiCreateButton(250,91,215,40,"Dar Permisos de Moderador",false,GppWindow) 
GiveSuperModeratorButton = guiCreateButton(250,143,215,40,"Dar Permisos de SuperModerador",false,GppWindow) 
GiveAdminsButton = guiCreateButton(251,194,210,40,"Dar Permisos de Admin",false,GppWindow) 
GiveVIPButton = guiCreateButton(251,245,210,40,"Dar Permisos de VIP",false,GppWindow) 
label = guiCreateLabel(252,31,154,17,"Jugador:",false,GppWindow) 
CloseButton = guiCreateButton(445,25,18,16,"X",false,GppWindow) 
removebutton = guiCreateButton(369,26,65,21,"eliminar",false,GppWindow) 
  
-------------------------- 
---Lista Grid 
------------------------- 
  
addEventHandler ( "onClientResourceStart", resourceRoot, 
    function ( ) 
        grid = guiCreateGridList ( 9, 25, 228, 214, false, GppWindow ) 
        local column = guiGridListAddColumn ( grid, "Nombre del Jugador", 0.89 ) 
        if ( column ) then 
            for id, player in ipairs ( getElementsByType ( "player" ) ) do 
                local row = guiGridListAddRow ( grid ) 
                guiGridListSetItemText ( grid, row, column, getPlayerName ( player ), false, false ) 
                guiGridListSetItemColor ( grid, row, column, 0, 250, 154, 255 ) 
            end 
            addEventHandler ( "onClientGUIClick", grid, click, false ) 
        end 
    end 
) 
  
function click ( ) 
    local playerName = guiGridListGetItemText ( grid, guiGridListGetSelectedItem ( grid ), 1 ) 
    guiSetText ( Gpedit, playerName ) 
end 
  
---------------------------- 
--Abrir Panel con Comando 
-------------------------- 
  
function showPanel ( ) 
    guiSetVisible ( GppWindow, not guiGetVisible ( GppWindow ) ) 
    showCursor ( guiGetVisible ( GppWindow ) ) 
    if ( guiGetVisible ( GppWindow ) ) then 
        playSound ( "open.mp3", false ) 
    end 
end 
addEvent ( "showPanel", true ) 
addEventHandler ( "showPanel", getRootElement(), showPanel ) 
  
--------------------- 
--Cuando le Das Clic 
-------------------- 
  
function onGuiClick ( button, state, absoluteX, absoluteY ) 
    if ( source == CloseButton ) then 
        guiSetVisible ( GppWindow, false ) 
        showCursor ( false ) 
    elseif ( source == removebutton ) then 
        local name = guiGetText ( Gpedit ) 
        local target = getPlayerFromName ( name ) 
        triggerServerEvent ( "remove", getLocalPlayer(), target ) 
    elseif ( source == GiveModeratorButton ) then 
        local name = guiGetText ( Gpedit ) 
        local target = getPlayerFromName ( name ) 
        triggerServerEvent ( "giveRights", getLocalPlayer(), target, "Moderator" ) 
        playSound ( "sec.wav", false ) 
    elseif ( source == GiveSuperModeratorButton ) then 
        local name = guiGetText ( Gpedit ) 
        local target = getPlayerFromName ( name ) 
        triggerServerEvent ( "giveRights", getLocalPlayer(), target, "SuperModerator" ) 
        playSound ( "sec.wav", false ) 
    elseif ( source == GiveAdminsButton ) then 
        local name = guiGetText ( Gpedit ) 
        local target = getPlayerFromName ( name ) 
        triggerServerEvent ( "giveRights", getLocalPlayer(), target, "Admin" ) 
        playSound ( "sec.wav", false ) 
    elseif ( source == GiveVIPButton ) then 
        local name = guiGetText ( Gpedit ) 
        local target = getPlayerFromName ( name ) 
        triggerServerEvent ( "giveRights", getLocalPlayer(), target, "VIP" ) 
        playSound ( "sec.wav", false ) 
    end 
end 
addEventHandler ( "onClientGUIClick", guiRoot, onGuiClick ) 
  
----------------------- 
--Obtener Permisos 
--------------------- 
  
function GetPermission ( ) 
    triggerServerEvent ( "OpenPanel", getLocalPlayer(), OpenPanel ) 
end 
  
---------------------- 
--Sonidos 
--------------------- 
  
function nopsound ( ) 
    playSound ( "np.mp3", false ) 
end 
addEvent ( "nopsound", true ) 
addEventHandler ( "nopsound", getRootElement(), nopsound ) 
  
function removedsound ( ) 
    playSound ( "removed.wav", false ) 
end 
addEvent ( "removedsound", true ) 
addEventHandler ( "removedsound", getRootElement(), removedsound ) 
  
-------------------- 
--Refrescar la Lista de Jugadores 
-------------------- 
  
function list ( ) 
    guiGridListClear ( grid ) 
    for id, players in ipairs ( getElementsByType ( "player" ) ) do 
        local row = guiGridListAddRow ( grid ) 
        guiGridListSetItemText ( grid, row, 1, getPlayerName ( players ), false, false ) 
        guiGridListSetItemColor ( grid, row, 1, 0, 250, 154, 255 ) 
    end 
end 
addEventHandler ( "onClientPlayerJoin", getRootElement(), list ) 
addEventHandler ( "onClientPlayerQuit", getRootElement(), list ) 
addEventHandler ( "onClientPlayerChangeNick", getRootElement(), list ) 
  
-- * Reeditado por TigreBlanco, Hecho por $ora 

-- server side:

-- * Editado por TigreBlanco, Hecho por $ora 
addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        bindKey ( source, "i", "down", show ) 
    end 
) 
  
addEventHandler ( "onResourceStart",resourceRoot, 
    function ( ) 
        for index, player in ipairs ( getElementsByType ( "player" ) ) do 
            bindKey ( player, "i", "down", show ) 
        end 
    end 
) 
  
function show ( thePlayer ) 
    if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Console" ) ) then 
        triggerClientEvent ( thePlayer, "showPanel", thePlayer ) 
    else 
        outputChatBox ( "* No Tienes los Suficientes Permisos para Este Comando", thePlayer, 255, 0, 0, true ) 
        triggerClientEvent ( thePlayer, "nopsound", thePlayer ) 
    end 
end 
  
------------------------ 
--Dar permisos 
----------------------- 
  
function giveRights ( target, groupName ) 
    local account = getPlayerAccount ( target ) 
    local group = aclGetGroup ( groupName ) 
    if ( group ) then 
        aclGroupAddObject ( group, "user.".. getAccountName ( account ) ) 
        outputChatBox ( "A '".. getAccountName ( getPlayerAccount ( target ) ) .."' Le Han Sido Consedidos Permisos de ".. groupName, source, 0, 255, 0 ) 
    else 
        outputChatBox ( "No Has Especificado el Nombre de la Cuenta", source, 255, 100 ,100 ) 
    end 
end 
addEvent ( "giveRights", true ) 
addEventHandler ( "giveRights", getRootElement(), giveRights ) 
  
function removee ( target ) 
    local account = getPlayerAccount ( target ) 
    if ( account ) then 
        aclGroupRemoveObject ( aclGetGroup ( "Moderator" ), "user.".. getAccountName ( account ) ) 
        aclGroupRemoveObject ( aclGetGroup ( "SuperModerator" ), "user.".. getAccountName ( account ) ) 
        aclGroupRemoveObject ( aclGetGroup ( "Admin" ), "user.".. getAccountName ( account ) ) 
        aclGroupRemoveObject ( aclGetGroup ( "VIP" ), "user.".. getAccountName ( account ) ) 
        outputChatBox ( "Todos los Permisos De '".. getAccountName ( getPlayerAccount ( target ) ) .."' han Sido Eliminados !", source, 255, 0, 0 ) 
        triggerClientEvent ( source, "removedsound", source ) 
    else 
        outputChatBox ( "No Has Especificado el Nombre de la Cuenta", source, 255, 100, 100 ) 
    end 
end 
addEvent ( "remove", true ) 
addEventHandler ( "remove", getRootElement(), removee ) 
  
---------------------- 
--Comando 
---------------------- 
function OpenPanel ( player ) 
    local player = ( player or source ) 
    local accountname = getAccountName ( getPlayerAccount ( player ) ) 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Console" ) )  then 
        triggerClientEvent ( player, "showPanel", player ) 
    else 
        outputChatBox ( "* No Tienes los Suficientes Permisos Parta Este Comando", player, 255, 0, 0, true ) 
        triggerClientEvent ( player, "nopsound", player ) 
    end 
end 
addEvent ( "OpenPanel", true ) 
addEventHandler ( "OpenPanel", getRootElement(), OpenPanel ) 
addCommandHandler ( "pdp", OpenPanel ) 
  
function check ( ) 
    local accountname = getAccountName ( getPlayerAccount ( source ) ) 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Console" ) )  then 
        outputChatBox ( "Escribe /pdp o Apreta la Tecla I para Abrir el Panel para dar Permisos", source, 255, 0, 0, true ) 
    end 
end 
addEventHandler ( "onPlayerLogin", getRootElement(), check ) 
-- * Editado por TigreBlanco, Hecho por $ora 

Link to comment
Te lo mejore y ademas agrege el boton para dar 'VIP'.

-- client side:

-- * Reeditado Por TigreBlanco, Hecho por $ora 
  
GppWindow = guiCreateWindow(0.1900,0.3400,0.6400,0.4500,"Panel para Dar Permisos por TigreBlanco",true) 
guiSetVisible(GppWindow,false) 
guiWindowSetSizable(GppWindow,false) 
Gpedit = guiCreateEdit(251,54,203,33,"",false,GppWindow) 
GiveModeratorButton = guiCreateButton(250,91,215,40,"Dar Permisos de Moderador",false,GppWindow) 
GiveSuperModeratorButton = guiCreateButton(250,143,215,40,"Dar Permisos de SuperModerador",false,GppWindow) 
GiveAdminsButton = guiCreateButton(251,194,210,40,"Dar Permisos de Admin",false,GppWindow) 
GiveVIPButton = guiCreateButton(251,245,210,40,"Dar Permisos de VIP",false,GppWindow) 
label = guiCreateLabel(252,31,154,17,"Jugador:",false,GppWindow) 
CloseButton = guiCreateButton(445,25,18,16,"X",false,GppWindow) 
removebutton = guiCreateButton(369,26,65,21,"eliminar",false,GppWindow) 
  
-------------------------- 
---Lista Grid 
------------------------- 
  
addEventHandler ( "onClientResourceStart", resourceRoot, 
    function ( ) 
        grid = guiCreateGridList ( 9, 25, 228, 214, false, GppWindow ) 
        local column = guiGridListAddColumn ( grid, "Nombre del Jugador", 0.89 ) 
        if ( column ) then 
            for id, player in ipairs ( getElementsByType ( "player" ) ) do 
                local row = guiGridListAddRow ( grid ) 
                guiGridListSetItemText ( grid, row, column, getPlayerName ( player ), false, false ) 
                guiGridListSetItemColor ( grid, row, column, 0, 250, 154, 255 ) 
            end 
            addEventHandler ( "onClientGUIClick", grid, click, false ) 
        end 
    end 
) 
  
function click ( ) 
    local playerName = guiGridListGetItemText ( grid, guiGridListGetSelectedItem ( grid ), 1 ) 
    guiSetText ( Gpedit, playerName ) 
end 
  
---------------------------- 
--Abrir Panel con Comando 
-------------------------- 
  
function showPanel ( ) 
    guiSetVisible ( GppWindow, not guiGetVisible ( GppWindow ) ) 
    showCursor ( guiGetVisible ( GppWindow ) ) 
    if ( guiGetVisible ( GppWindow ) ) then 
        playSound ( "open.mp3", false ) 
    end 
end 
addEvent ( "showPanel", true ) 
addEventHandler ( "showPanel", getRootElement(), showPanel ) 
  
--------------------- 
--Cuando le Das Clic 
-------------------- 
  
function onGuiClick ( button, state, absoluteX, absoluteY ) 
    if ( source == CloseButton ) then 
        guiSetVisible ( GppWindow, false ) 
        showCursor ( false ) 
    elseif ( source == removebutton ) then 
        local name = guiGetText ( Gpedit ) 
        local target = getPlayerFromName ( name ) 
        triggerServerEvent ( "remove", getLocalPlayer(), target ) 
    elseif ( source == GiveModeratorButton ) then 
        local name = guiGetText ( Gpedit ) 
        local target = getPlayerFromName ( name ) 
        triggerServerEvent ( "giveRights", getLocalPlayer(), target, "Moderator" ) 
        playSound ( "sec.wav", false ) 
    elseif ( source == GiveSuperModeratorButton ) then 
        local name = guiGetText ( Gpedit ) 
        local target = getPlayerFromName ( name ) 
        triggerServerEvent ( "giveRights", getLocalPlayer(), target, "SuperModerator" ) 
        playSound ( "sec.wav", false ) 
    elseif ( source == GiveAdminsButton ) then 
        local name = guiGetText ( Gpedit ) 
        local target = getPlayerFromName ( name ) 
        triggerServerEvent ( "giveRights", getLocalPlayer(), target, "Admin" ) 
        playSound ( "sec.wav", false ) 
    elseif ( source == GiveVIPButton ) then 
        local name = guiGetText ( Gpedit ) 
        local target = getPlayerFromName ( name ) 
        triggerServerEvent ( "giveRights", getLocalPlayer(), target, "VIP" ) 
        playSound ( "sec.wav", false ) 
    end 
end 
addEventHandler ( "onClientGUIClick", guiRoot, onGuiClick ) 
  
----------------------- 
--Obtener Permisos 
--------------------- 
  
function GetPermission ( ) 
    triggerServerEvent ( "OpenPanel", getLocalPlayer(), OpenPanel ) 
end 
  
---------------------- 
--Sonidos 
--------------------- 
  
function nopsound ( ) 
    playSound ( "np.mp3", false ) 
end 
addEvent ( "nopsound", true ) 
addEventHandler ( "nopsound", getRootElement(), nopsound ) 
  
function removedsound ( ) 
    playSound ( "removed.wav", false ) 
end 
addEvent ( "removedsound", true ) 
addEventHandler ( "removedsound", getRootElement(), removedsound ) 
  
-------------------- 
--Refrescar la Lista de Jugadores 
-------------------- 
  
function list ( ) 
    guiGridListClear ( grid ) 
    for id, players in ipairs ( getElementsByType ( "player" ) ) do 
        local row = guiGridListAddRow ( grid ) 
        guiGridListSetItemText ( grid, row, 1, getPlayerName ( players ), false, false ) 
        guiGridListSetItemColor ( grid, row, 1, 0, 250, 154, 255 ) 
    end 
end 
addEventHandler ( "onClientPlayerJoin", getRootElement(), list ) 
addEventHandler ( "onClientPlayerQuit", getRootElement(), list ) 
addEventHandler ( "onClientPlayerChangeNick", getRootElement(), list ) 
  
-- * Reeditado por TigreBlanco, Hecho por $ora 

-- server side:

-- * Editado por TigreBlanco, Hecho por $ora 
addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        bindKey ( source, "i", "down", show ) 
    end 
) 
  
addEventHandler ( "onResourceStart",resourceRoot, 
    function ( ) 
        for index, player in ipairs ( getElementsByType ( "player" ) ) do 
            bindKey ( player, "i", "down", show ) 
        end 
    end 
) 
  
function show ( thePlayer ) 
    if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Console" ) ) then 
        triggerClientEvent ( thePlayer, "showPanel", thePlayer ) 
    else 
        outputChatBox ( "* No Tienes los Suficientes Permisos para Este Comando", thePlayer, 255, 0, 0, true ) 
        triggerClientEvent ( thePlayer, "nopsound", thePlayer ) 
    end 
end 
  
------------------------ 
--Dar permisos 
----------------------- 
  
function giveRights ( target, groupName ) 
    local account = getPlayerAccount ( target ) 
    local group = aclGetGroup ( groupName ) 
    if ( group ) then 
        aclGroupAddObject ( group, "user.".. getAccountName ( account ) ) 
        outputChatBox ( "A '".. getAccountName ( getPlayerAccount ( target ) ) .."' Le Han Sido Consedidos Permisos de ".. groupName, source, 0, 255, 0 ) 
    else 
        outputChatBox ( "No Has Especificado el Nombre de la Cuenta", source, 255, 100 ,100 ) 
    end 
end 
addEvent ( "giveRights", true ) 
addEventHandler ( "giveRights", getRootElement(), giveRights ) 
  
function removee ( target ) 
    local account = getPlayerAccount ( target ) 
    if ( account ) then 
        aclGroupRemoveObject ( aclGetGroup ( "Moderator" ), "user.".. getAccountName ( account ) ) 
        aclGroupRemoveObject ( aclGetGroup ( "SuperModerator" ), "user.".. getAccountName ( account ) ) 
        aclGroupRemoveObject ( aclGetGroup ( "Admin" ), "user.".. getAccountName ( account ) ) 
        aclGroupRemoveObject ( aclGetGroup ( "VIP" ), "user.".. getAccountName ( account ) ) 
        outputChatBox ( "Todos los Permisos De '".. getAccountName ( getPlayerAccount ( target ) ) .."' han Sido Eliminados !", source, 255, 0, 0 ) 
        triggerClientEvent ( source, "removedsound", source ) 
    else 
        outputChatBox ( "No Has Especificado el Nombre de la Cuenta", source, 255, 100, 100 ) 
    end 
end 
addEvent ( "remove", true ) 
addEventHandler ( "remove", getRootElement(), removee ) 
  
---------------------- 
--Comando 
---------------------- 
function OpenPanel ( player ) 
    local player = ( player or source ) 
    local accountname = getAccountName ( getPlayerAccount ( player ) ) 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Console" ) )  then 
        triggerClientEvent ( player, "showPanel", player ) 
    else 
        outputChatBox ( "* No Tienes los Suficientes Permisos Parta Este Comando", player, 255, 0, 0, true ) 
        triggerClientEvent ( player, "nopsound", player ) 
    end 
end 
addEvent ( "OpenPanel", true ) 
addEventHandler ( "OpenPanel", getRootElement(), OpenPanel ) 
addCommandHandler ( "pdp", OpenPanel ) 
  
function check ( ) 
    local accountname = getAccountName ( getPlayerAccount ( source ) ) 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Console" ) )  then 
        outputChatBox ( "Escribe /pdp o Apreta la Tecla I para Abrir el Panel para dar Permisos", source, 255, 0, 0, true ) 
    end 
end 
addEventHandler ( "onPlayerLogin", getRootElement(), check ) 
-- * Editado por TigreBlanco, Hecho por $ora 

Muchas Gracias SolidSnake, Ahora lo Pruebo, no Necesito ni Probarlo Porque Estoy 100% Seguro que Funciona :), Yo Soy solo Nada Mas que Un Scripter/Mapper, Pero tu Eres mi Idolo Tio ;), de Verdad que Gracias

Link to comment
  • Recently Browsing   0 members

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