Jump to content

GUI Grid List


Recommended Posts

Would anybody know how to turn a GUI Button spawn menu into a GUI Grid List spawn menu?

Below is the current code for a GUI Button Spawn Menu (some parts have been removed)

addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ),
    function ( )
        myWindow = guiCreateWindow ( 0.12, 0.1, 0.8, 0.8, "Twiva Spawn menu", true )
        button = guiCreateButton( 0, 0.1, 0.2, 0.1, "Pilot", true, myWindow )
        addEventHandler( "onClientGUIClick", button, spawner, false, myWindow )
    end
)
 
 
function spawner ( )
    triggerServerEvent ( "onGreeting", getLocalPlayer() )
end
 
function spawned ( )
guiSetVisible ( myWindow, false )
guiSetVisible ( myWindow2, false )
showCursor(false)
end
addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), spawned )
 
function died ( )
guiSetVisible ( myWindow, true )
guiSetVisible ( pic1, true )
guiSetVisible ( pic2, true )
fadeCamera ( source, false )
end
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), died )
 
 
function changeVisibility ( )
 
        -- we check if the gui element is visible
        if guiGetVisible ( myWindow )  then
                -- if it is, we hide it
                showCursor(true)
        else
                showCursor(false)
        end
end
 
setTimer ( changeVisibility, 1000, 0 )
 
 

Link to post

Because working with GridList is annoying, I recommend you the GUI Classes I made the other day. There are some examples there how to use it. I'm sure you'll understand it. Then, you can just get the text of selected item in the grid list and spawn player somewhere where he wanted.

Link to post

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...