Jump to content

Grid List Not Working


toptional

Recommended Posts

This is my Grid List GUI the GUI Opens but now i added that last script its failing with errors

I need it so when someone double clicks the Baggage it spawns it and warps them into it.

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Grid = {} 
  
addEventHandler ( "onClientResourceStart", resourceRoot, 
    function ( ) 
        GUIEditor_Window[3] = guiCreateWindow(322,193,361,409,"Aviator Free Car Spawner by Robbster",false) 
        guiSetVisible ( GUIEditor_Window[3], false ) 
        GUIEditor_Label[3] = guiCreateLabel(102,115,117,123,"",false,GUIEditor_Window[3]) 
        GUIEditor_Grid[3] = guiCreateGridList(42,54,277,216,false,GUIEditor_Window[3]) 
        guiGridListAddColumn(GUIEditor_Grid[3],"Airport Cars",0.9) 
  
        for i = 1, 3 do 
            guiGridListAddRow(GUIEditor_Grid[3]) 
        end 
  
        guiGridListSetItemText(GUIEditor_Grid[3],0,1,"Baggage",false,false) 
        guiGridListSetItemText(GUIEditor_Grid[3],1,1,"Tug",false,false) 
        guiGridListSetItemText(GUIEditor_Grid[3],2,1,"Utility Van",false,false) 
        GUIEditor_Button[3] = guiCreateButton(40,307,296,80,"Close",false,GUIEditor_Window[3]) 
        addEventHandler ( 'onClientGUIClick', GUIEditor_Button[3], onButtonClick, false ) 
    end 
) 
  
addEventHandler( "onClientGUIDoubleClick", GUIEditor_Grid[3], doubleClicked, false ) 
function doubleClickedName ( ) 
 local row, col = guiGridListGetSelectedItem ( source ) 
    if ( row and col and row ~= -1 and col ~= -1 ) then 
  local name = guiGridListGetItemText ( source, 0, 1 ) 
  triggerServerEvent ( "baggage", root, "test" ) 
  local warpPedIntoVehicle ( baggage ) 
    end  
end 

Thanks

Link to comment

-- client side:

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Grid = {} 
  
addEventHandler ( "onClientResourceStart", resourceRoot, 
    function ( ) 
        GUIEditor_Window[3] = guiCreateWindow(322,193,361,409,"Aviator Free Car Spawner by Robbster",false) 
        guiSetVisible ( GUIEditor_Window[3], false ) 
        GUIEditor_Label[3] = guiCreateLabel(102,115,117,123,"",false,GUIEditor_Window[3]) 
        GUIEditor_Grid[3] = guiCreateGridList(42,54,277,216,false,GUIEditor_Window[3]) 
        guiGridListAddColumn(GUIEditor_Grid[3],"Airport Cars",0.9) 
  
        for i = 1, 3 do 
            guiGridListAddRow(GUIEditor_Grid[3]) 
        end 
  
        guiGridListSetItemText(GUIEditor_Grid[3],0,1,"Baggage",false,false) 
        guiGridListSetItemText(GUIEditor_Grid[3],1,1,"Tug",false,false) 
        guiGridListSetItemText(GUIEditor_Grid[3],2,1,"Utility Van",false,false) 
        GUIEditor_Button[3] = guiCreateButton(40,307,296,80,"Close",false,GUIEditor_Window[3]) 
        addEventHandler ( 'onClientGUIClick', GUIEditor_Button[3], onButtonClick, false ) 
        addEventHandler( "onClientGUIDoubleClick", GUIEditor_Grid[3], doubleClicked, false ) 
    end 
) 
  
function doubleClicked ( ) 
    local row, col = guiGridListGetSelectedItem ( source ) 
    if ( row and col and row ~= -1 and col ~= -1 ) then 
        local vehicleName = guiGridListGetItemText ( source, row, 1 ) 
        triggerServerEvent ( "spawnVehicle", localPlayer, vehicleName ) 
    end 
end 

-- server side:

addEvent ( "spawnVehicle", true ) 
addEventHandler ( "spawnVehicle", root, 
    function ( vehicleName ) 
        local vehicleModel = getVehicleModelFromName ( vehicleName ) 
        if ( vehicleModel ) then 
            local x, y, z = getElementPosition ( source ) 
            local vehicle = createVehicle ( vehicleModel, x, y, z ) 
            warpPedIntoVehicle ( source, vehicle ) 
        end 
    end 
) 

Link to comment
Got this Error

Error: Client Triggered Serverside event spawnVehicle, but event was not added serverside

try this

--Client

    GUIEditor_Button = {} 
    GUIEditor_Label = {} 
    GUIEditor_Grid = {} 
      
    addEventHandler ( "onClientResourceStart", resourceRoot, 
        function ( ) 
            GUIEditor_Window[3] = guiCreateWindow(322,193,361,409,"Aviator Free Car Spawner by Robbster",false) 
            guiSetVisible ( GUIEditor_Window[3], false ) 
            GUIEditor_Label[3] = guiCreateLabel(102,115,117,123,"",false,GUIEditor_Window[3]) 
            GUIEditor_Grid[3] = guiCreateGridList(42,54,277,216,false,GUIEditor_Window[3]) 
            guiGridListAddColumn(GUIEditor_Grid[3],"Airport Cars",0.9) 
      
            for i = 1, 3 do 
                guiGridListAddRow(GUIEditor_Grid[3]) 
            end 
      
            guiGridListSetItemText(GUIEditor_Grid[3],0,1,"Baggage",false,false) 
            guiGridListSetItemText(GUIEditor_Grid[3],1,1,"Tug",false,false) 
            guiGridListSetItemText(GUIEditor_Grid[3],2,1,"Utility Van",false,false) 
            GUIEditor_Button[3] = guiCreateButton(40,307,296,80,"Close",false,GUIEditor_Window[3]) 
            addEventHandler ( 'onClientGUIClick', GUIEditor_Button[3], onButtonClick, false ) 
            addEventHandler( "onClientGUIDoubleClick", GUIEditor_Grid[3], doubleClicked, false ) 
        end 
    ) 
      
    function doubleClicked ( ) 
        local row, col = guiGridListGetSelectedItem ( source ) 
        if ( row and col and row ~= -1 and col ~= -1 ) then 
            local vehicleName = guiGridListGetItemText ( source, row, 1 ) 
            triggerServerEvent ( "spawnVehicle" ) 
        end 
    end 

Link to comment
Guest Guest4401
Got this Error

Error: Client Triggered Serverside event spawnVehicle, but event was not added serverside

There is an error in your meta.xml. A typo or you just forgot to add the serverside script.

Show the meta.xml if you're unable to fix it yourself.

Link to comment
Got this Error

Error: Client Triggered Serverside event spawnVehicle, but event was not added serverside

try this

--Client

    GUIEditor_Button = {} 
    GUIEditor_Label = {} 
    GUIEditor_Grid = {} 
      
    addEventHandler ( "onClientResourceStart", resourceRoot, 
        function ( ) 
            GUIEditor_Window[3] = guiCreateWindow(322,193,361,409,"Aviator Free Car Spawner by Robbster",false) 
            guiSetVisible ( GUIEditor_Window[3], false ) 
            GUIEditor_Label[3] = guiCreateLabel(102,115,117,123,"",false,GUIEditor_Window[3]) 
            GUIEditor_Grid[3] = guiCreateGridList(42,54,277,216,false,GUIEditor_Window[3]) 
            guiGridListAddColumn(GUIEditor_Grid[3],"Airport Cars",0.9) 
      
            for i = 1, 3 do 
                guiGridListAddRow(GUIEditor_Grid[3]) 
            end 
      
            guiGridListSetItemText(GUIEditor_Grid[3],0,1,"Baggage",false,false) 
            guiGridListSetItemText(GUIEditor_Grid[3],1,1,"Tug",false,false) 
            guiGridListSetItemText(GUIEditor_Grid[3],2,1,"Utility Van",false,false) 
            GUIEditor_Button[3] = guiCreateButton(40,307,296,80,"Close",false,GUIEditor_Window[3]) 
            addEventHandler ( 'onClientGUIClick', GUIEditor_Button[3], onButtonClick, false ) 
            addEventHandler( "onClientGUIDoubleClick", GUIEditor_Grid[3], doubleClicked, false ) 
        end 
    ) 
      
    function doubleClicked ( ) 
        local row, col = guiGridListGetSelectedItem ( source ) 
        if ( row and col and row ~= -1 and col ~= -1 ) then 
            local vehicleName = guiGridListGetItemText ( source, row, 1 ) 
            triggerServerEvent ( "spawnVehicle" ) 
        end 
    end 

Complete fail... Script full of errors and wont even work

Link to comment
Got this Error

Error: Client Triggered Serverside event spawnVehicle, but event was not added serverside

There is an error in your meta.xml. A typo or you just forgot to add the serverside script.

Show the meta.xml if you're unable to fix it yourself.

Im a fail

trying now thanks!

Edit - FIXED!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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