Jump to content

Panel Elite


Sasu

Recommended Posts

Client:

 Wnd = guiCreateWindow ( 0.2, 0.2, 0.25, 0.5, "Vehiculos especiales de la Elite", true ) 
    guiSetAlpha( Wnd, 1 ) 
    button = guiCreateButton ( 0.01, 0.8, 0.50, 0.15, "Cerrar", true, Wnd ) 
    button = guiCreateButton ( 0.01, 0.8, 0.50, 0.15, "Crear", true, Wnd ) 
    label = guiCreateLabel ( 0.1, 0.1, 0.9, 0.1, "Bienvenido al panel de vehiculos de la Elite. Para obtener el vehiculo deseado, haz doble click en el.", true, Wnd ) 
    showCursor(false) 
    guiSetVisible( Wnd, false ) 
    guiWindowSetSizable( Wnd, false ) 
    guiWindowSetMovable( Wnd, true ) 
      
             vehicles = 
                { 
                {"Sultan", 560}, 
                {"HPV1000", 523} 
                {"Police LS", 596}, 
                {"Police LV", 598}, 
                {"Police Ranger", 599} 
                {"Hydra", 520} 
                {"Police Maverick", 497} 
                } 
                
      
        grid = guiCreateGridList(0.01, 0.2, 0.99, 0.5, true, Wnd) 
        guiGridListAddColumn(grid, "Vehicles", 0.85) 
          
        for i,veh in ipairs(vehicles) do 
             row = guiGridListAddRow(grid) 
             -- 
             guiGridListSetItemText(grid, row, 1, tostring(veh[1]), false, false) 
             guiGridListSetItemData(grid, row, 1, tostring(veh[2])) 
        end 
          
        function use() 
             local row, col = guiGridListGetSelectedItem(grid)   
             if (row and col and row ~= -1 and col ~= -1) then 
                  local model = tonumber(guiGridListGetItemData(grid, row, 1)) 
                  if model ~= "" then 
                       triggerServerEvent("CreVehicle", localPlayer, model) 
                  end 
             end 
        end 
        addEventHandler("onClientDoubleClick", root, use, true) 
        
        function close() 
        if (source == button) then 
        guiSetVisible(Wnd,false) 
        showCursor(false) 
        end 
        end 
        addEventHandler("onClientGUIClick", button, close) 
        
    function showGUI2p() 
    guiSetVisible(Wnd,true) 
    showCursor(true) 
    end 
    addEvent("showGUI2p",true) 
    addEventHandler("showGUI2p", getRootElement(), showGUI2p) 

Server:

  
  
        local vehicles = {} 
          
        function spawnVehP(id) 
        theTeam = getPlayerTeam( source ) 
        theTeamName = getTeamName( theTeam ) 
        if ( theTeamName == "Elite" ) then 
            local x, y, z = getElementPosition(source) 
            if isElement(vehicles[source]) then destroyElement(vehicles[source]) end 
            vehicles[source] = createVehicle(id, x + 1, y, z) 
            warpPedIntoVehicle(source, vehicles[source]) 
            else 
             outputChatBox("Usted no es una fuerza Elite. Salga de la base inmediatamente antes de que un elite se de cuenta.", source, 0, 200, 0 , true) 
            end 
        end 
        addEvent("CreVehicle",true) 
        addEventHandler("CreVehicle", root, spawnVehP) 
          
        addEventHandler("onPlayerQuit", root, 
        function() 
             if isElement(vehicles[source]) then 
                  destroyElement(vehicles[source]) 
                  vehicles[source] = nil 
             end 
        end) 
        
        function showGUIp(hitPlayer) 
        setElementFrozen(source, true) 
    triggerClientEvent (hitPlayer,"showGUI2p",getRootElement(),hitPlayer) 
    end 
    addEventHandler("onMarkerHit",Marker1,showGUIp) 
    addEventHandler("onMarkerHit",Marker2,showGUIp) 

Mi problema es que me dice:

"WARNING: Loading script failed: base\vehicles_C.lua:13: "}" expected (to close "{" at line 12) near ","

Y tambien:

"ERROR: server triggered clientside event showGUI2p, but event is not added clientside"

Muchas gracias por su atencion. Atte.: Sasuke

Link to comment
     Wnd = guiCreateWindow ( 0.2, 0.2, 0.25, 0.5, "Vehiculos especiales de la Elite", true ) 
        guiSetAlpha( Wnd, 1 ) 
        button = guiCreateButton ( 0.01, 0.8, 0.50, 0.15, "Cerrar", true, Wnd ) 
        button = guiCreateButton ( 0.01, 0.8, 0.50, 0.15, "Crear", true, Wnd ) 
        label = guiCreateLabel ( 0.1, 0.1, 0.9, 0.1, "Bienvenido al panel de vehiculos de la Elite. Para obtener el vehiculo deseado, haz doble click en el.", true, Wnd ) 
        showCursor(false) 
        guiSetVisible( Wnd, false ) 
        guiWindowSetSizable( Wnd, false ) 
        guiWindowSetMovable( Wnd, true ) 
          
                 vehicles = 
                    { 
                    {"Sultan", 560}, 
                    {"HPV1000", 523}, 
                    {"Police LS", 596}, 
                    {"Police LV", 598}, 
                    {"Police Ranger", 599}, 
                    {"Hydra", 520}, 
                    {"Police Maverick", 497} 
                    } 
                    
          
            grid = guiCreateGridList(0.01, 0.2, 0.99, 0.5, true, Wnd) 
            guiGridListAddColumn(grid, "Vehicles", 0.85) 
              
            for i,veh in ipairs(vehicles) do 
                 row = guiGridListAddRow(grid) 
                 -- 
                 guiGridListSetItemText(grid, row, 1, tostring(veh[1]), false, false) 
                 guiGridListSetItemData(grid, row, 1, tostring(veh[2])) 
            end 
              
            function use() 
                 local row, col = guiGridListGetSelectedItem(grid)   
                 if (row and col and row ~= -1 and col ~= -1) then 
                      local model = tonumber(guiGridListGetItemData(grid, row, 1)) 
                      if model ~= "" then 
                           triggerServerEvent("CreVehicle", localPlayer, model) 
                      end 
                 end 
            end 
            addEventHandler("onClientDoubleClick", root, use, true) 
            
            function close() 
            if (source == button) then 
            guiSetVisible(Wnd,false) 
            showCursor(false) 
            end 
            end 
            addEventHandler("onClientGUIClick", button, close) 
            
        function showGUI2p() 
        guiSetVisible(Wnd,true) 
        showCursor(true) 
        end 
        addEvent("showGUI2p",true) 
        addEventHandler("showGUI2p", getRootElement(), showGUI2p) 

Link to comment
  • Recently Browsing   0 members

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