Jump to content

Muchos problemas :/


iFoReX

Recommended Posts

Bueno, Hola otra vez, andaba creando un sistema para agregar / remover personas de un clan todavia no lo termino, pero hice el primer test y tenia muchos errores de boolean y nose como solucionarlos :/

cl-side

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Grid = {} 
  
GUIEditor_Window[1] = guiCreateWindow(209,161,559,460,"GetClan..\"Reclutamiento\"",false) 
GUIEditor_Grid[1] = guiCreateGridList(16,26,207,418,false,GUIEditor_Window[1]) 
  
col1 = guiGridListAddColumn(GUIEditor_Grid[1],"Jugadores",0.7) 
GUIEditor_Button[1] = guiCreateButton(227,25,131,50,"Reclutar",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(227,85,131,50,"Removerlo",false,GUIEditor_Window[1]) 
GUIEditor_Grid[2] = guiCreateGridList(364,21,186,427,false,GUIEditor_Window[1]) 
  
col2 = guiGridListAddColumn(GUIEditor_Grid[2],"Jugadores del Clan",0.7) 
  
guiSetVisible(GUIEditor_Window[1],false) 
showCursor(false) 
  
bindKey("R","down",function() 
if getKeyState"lctrl" then 
guiSetVisible(GUIEditor_Window[1],not guiGetVisible(GUIEditor_Window[1])) 
showCursor(guiGetVisible(GUIEditor_Window[1])) 
end 
end 
) 
  
function grid() 
local limpiar = guiGridListClear(GUIEditor_Grid[1]) 
if limpiar then 
local row = guiGridListAddRow(GUIEditor_Grid[1]) 
for i,v in ipairs(getElementsByType"player") do 
guiGridListSetItemText(GUIEditor_Grid[1],row,col1,getPlayerName(v),false,false) 
end 
end 
end 
addEventHandler("onClientResourceStart",resourceRoot,grid) 
addEventHandler("onClientPlayerQuit",root,grid) 
addEventHandler("onClientPlayerChangeNick",root,grid) 
addEventHandler("onClientPlayerJoin",root,grid) 
  
addEventHandler( 'onClientGUIClick', root, 
    function( ) 
    if source == GUIEditor_Button[1] then 
    local nRow, nColumn = guiGridListGetSelectedItem( source ) 
    local elPlayer = getPlayerFromName(nRow) 
    triggerServerEvent("agregarPlayer",getLocalPlayer(),elPlayer) 
    end 
    end 
    ) 
     

srv-side

addEvent("agregarPlayer",true) 
addEventHandler("agregarPlayer",root,function(elPlayer) 
local account = getAccountName(elPlayer) 
if not isObjectInACLGroup ( "user." .. account, aclGetGroup ( "STARS" ) ) then 
local adicion = aclGroupAddObject (aclGetGroup("STARS"), "user."..account) 
if adicion then 
outputChatBox(getPlayerName(elPlayer).." Agregado Correctamente !!",source,0,255,0,true) 
end 
elseif isObjectInACLGroup ( "user." .. account, aclGetGroup ( "STARS" ) ) then 
outputChatBox(getPlayerName(elPlayer).." Ya esta en este Clan !!",source,255,255,0,true) 
end 
end 
) 
  

mtascreen20120922143113.png

Link to comment

Tenes muchos errores basicos la verdad...

-- client side:

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Grid = {} 
  
GUIEditor_Window[1] = guiCreateWindow(209,161,559,460,"GetClan..\"Reclutamiento\"",false) 
GUIEditor_Grid[1] = guiCreateGridList(16,26,207,418,false,GUIEditor_Window[1]) 
  
col1 = guiGridListAddColumn(GUIEditor_Grid[1],"Jugadores",0.7) 
GUIEditor_Button[1] = guiCreateButton(227,25,131,50,"Reclutar",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(227,85,131,50,"Removerlo",false,GUIEditor_Window[1]) 
GUIEditor_Grid[2] = guiCreateGridList(364,21,186,427,false,GUIEditor_Window[1]) 
  
col2 = guiGridListAddColumn(GUIEditor_Grid[2],"Jugadores del Clan",0.7) 
  
guiSetVisible ( GUIEditor_Window[1], false ) 
showCursor ( false ) 
  
bindKey ( "R", "down", 
    function ( ) 
    if ( getKeyState ( "lctrl" ) ) then 
        guiSetVisible ( GUIEditor_Window[1], not guiGetVisible ( GUIEditor_Window[1] ) ) 
        showCursor ( guiGetVisible ( GUIEditor_Window[1] ) ) 
    end 
end 
) 
  
function grid ( ) 
    local limpiar = guiGridListClear ( GUIEditor_Grid[1] ) 
    if ( limpiar ) then 
        local row = guiGridListAddRow ( GUIEditor_Grid[1] ) 
        for _, v in ipairs ( getElementsByType"player" ) do 
            guiGridListSetItemText ( GUIEditor_Grid[1], row, col1, getPlayerName ( v ), false, false ) 
        end 
    end 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, grid ) 
addEventHandler ( "onClientPlayerQuit", root, grid ) 
addEventHandler ( "onClientPlayerChangeNick", root, grid ) 
addEventHandler ( "onClientPlayerJoin", root, grid ) 
  
addEventHandler ( 'onClientGUIClick', root, 
    function ( ) 
        if ( source == GUIEditor_Button[1] ) then 
            local row, col = guiGridListGetSelectedItem ( GUIEditor_Grid[1] ) 
            if ( row and col and row ~= -1 and col ~= -1 ) then 
                local playerName = guiGridListGetItemText ( GUIEditor_Grid[1], row, 1 ) 
                local elPlayer = getPlayerFromName ( playerName ) 
                triggerServerEvent ( "agregarPlayer", localPlayer, elPlayer ) 
            end 
        end 
    end 
) 

-- server side:

addEvent ( "agregarPlayer", true ) 
addEventHandler ( "agregarPlayer", root, 
    function ( elPlayer ) 
        local account = getAccountName ( getPlayerAccount ( elPlayer ) ) 
        if ( not isObjectInACLGroup ( "user." .. account, aclGetGroup ( "STARS" ) ) ) then 
            local adicion = aclGroupAddObject ( aclGetGroup ( "STARS" ), "user.".. account ) 
            if ( adicion ) then 
                outputChatBox ( getPlayerName ( elPlayer ) .." Agregado Correctamente !!", source, 0, 255, 0, true ) 
            end 
        else 
            outputChatBox ( getPlayerName ( elPlayer ) .." Ya esta en este Clan !!", source, 255, 255, 0, true ) 
        end 
    end 
) 

Link to comment
  • Recently Browsing   0 members

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