Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local screenW, screenH = guiGetScreenSize()
- -- gui elements coordinates
- local dimensions = {
- window = {
- floatX = (screenW - 474) / 2,
- floatY = (screenH - 296) / 2,
- width = 474,
- height = 296
- },
- gridList = {
- floatX = 13,
- floatY = 28,
- width = 451,
- height = 212
- },
- closeButton = {
- floatX = 14,
- floatY = 250,
- width = 183,
- height = 32
- },
- startButton = {
- floatX = 207,
- floatY = 250,
- width = 257,
- height = 32
- }
- }
- -- the grid list items
- local list = {
- BC = {
- {
- "Bone Country",
- "Andromada",
- "10.000$ - 20.000$"
- },
- {
- "Bone Country",
- "AT-400",
- "8.000$ - 16.000$"
- },
- {
- "Bone Country",
- "Shamal",
- "6.000$ - 12.000$"
- },
- {
- "Bone Country",
- "Dodo",
- "4.000$ - 8.000$"
- }
- },
- LS = {
- {
- "Los Santos",
- "Andromada",
- "10.000$ - 20.000$"
- },
- {
- "Los Santos",
- "AT-400",
- "8.000$ - 16.000$"
- },
- {
- "Los Santos",
- "Shamal",
- "6.000$ - 12.000$"
- },
- {
- "Los Santos",
- "Dodo",
- "4.000$ - 8.000$"
- }
- },
- SF = {
- {
- "San Fierro",
- "Andromada",
- "10.000$ - 20.000$"
- },
- {
- "San Fierro",
- "AT-400",
- "8.000$ - 16.000$"
- },
- {
- "San Fierro",
- "Shamal",
- "6.000$ - 12.000$"
- },
- {
- "San Fierro",
- "Dodo",
- "4.000$ - 8.000$"
- }
- },
- LV = {
- {
- "Las Venturas",
- "Andromada",
- "10.000$ - 20.000$"
- },
- {
- "Las Venturas",
- "AT-400",
- "8.000$ - 16.000$"
- },
- {
- "Las Venturas",
- "Shamal",
- "6.000$ - 12.000$"
- },
- {
- "Las Venturas",
- "Dodo",
- "4.000$ - 8.000$"
- }
- }
- }
- -- something to do later
- local arriveMarkers = {
- BC = {},
- LS = {},
- SF = {},
- LV = {}
- }
- -- main function
- function pilotTab(location)
- showCursor(true)
- local window =
- GuiWindow(
- dimensions.window["floatX"],
- dimensions.window["floatY"],
- dimensions.window["width"],
- dimensions.window["height"],
- "Los Santos Airport - Pilot Tab",
- false
- )
- window:setSizable(false)
- window:setMovable(false)
- local gridList =
- GuiGridList(
- dimensions.gridList["floatX"],
- dimensions.gridList["floatY"],
- dimensions.gridList["width"],
- dimensions.gridList["height"],
- false,
- window
- )
- gridList:addColumn("Arrive Location", 0.3)
- gridList:addColumn("Plane Model", 0.3)
- gridList:addColumn("Income", 0.3)
- local closeButton =
- GuiButton(
- dimensions.closeButton["floatX"],
- dimensions.closeButton["floatY"],
- dimensions.closeButton["width"],
- dimensions.closeButton["height"],
- "Close",
- false,
- window
- )
- local startButton =
- GuiButton(
- dimensions.startButton["floatX"],
- dimensions.startButton["floatY"],
- dimensions.startButton["width"],
- dimensions.startButton["height"],
- "Start",
- false,
- window
- )
- for k, v in pairs(list) do
- if k ~= location then
- for k2, v2 in ipairs(v) do
- gridList:addRow(v2[1], v2[2], v2[3])
- end
- end
- end
- function onCloseButtonClick()
- window:destroy()
- showCursor(false)
- end
- addEventHandler("onClientGUIClick", closeButton, onCloseButtonClick, false)
- function onStartButtonClick()
- local selectedRow, selectedColumn = gridList:getSelectedItem()
- if selectedRow ~= -1 and selectedColumn ~= -1 then
- window:destroy()
- showCursor(false)
- local arrivalLocation = gridList:getItemText(selectedRow, selectedColumn)
- local planeModel = gridList:getItemText( selectedRow, selectedColumn + 1)
- local income = gridList:getItemText( selectedRow, selectedColumn + 2)
- iprint(arrivalLocation, planeModel, income)
- end
- end
- addEventHandler("onClientGUIClick", startButton, onStartButtonClick, false)
- end
- addEvent("openPilotTab", true)
- addEventHandler("openPilotTab", getRootElement(), pilotTab)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement