Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- teams = {"Liberation Army", "Imperial Forces"}
- function getPos()
- local x, y ,z = getElementPosition(localPlayer)
- local pos = tostring(x..", "..y..", "..z)
- outputChatBox(pos, 255, 100, 100, false)
- setClipboard(pos)
- end
- addCommandHandler("pos", getPos)
- ---- GUI Creation
- addEventHandler("onClientResourceStart", resourceRoot,
- function()
- window = guiCreateWindow(0.57, 0.25, 0.19, 0.37, "Spawn Menu", true)
- guiWindowSetMovable(window, false)
- guiWindowSetSizable(window, false)
- guiSetAlpha(window, 1.00)
- team_gridlist = guiCreateGridList(10, 32, 284, 98, false, window)
- column = guiGridListAddColumn(team_gridlist, "Team", 0.9)
- for i, teamtext in pairs(teams) do
- local row = guiGridListAddRow(team_gridlist, teamtext)
- end
- skin_label = guiCreateLabel(58, 248, 71, 15, "Select a skin", false, window)
- skin_btn_next = guiCreateButton(96, 273, 33, 16, ">", false, window)
- skin_btn_previous = guiCreateButton(58, 273, 33, 16, "<", false, window)
- location_gridlist = guiCreateGridList(10, 140, 284, 98, false, window)
- location_col = guiGridListAddColumn(location_gridlist, "Location", 0.9)
- weapon_label = guiCreateLabel(155, 248, 96, 15, "Select a weapon", false, window)
- weapon_btn_next = guiCreateButton(165, 273, 33, 16, ">", false, window)
- weapon_btn_previous = guiCreateButton(204, 273, 33, 16, "<", false, window)
- spawn_btn = guiCreateButton(114, 299, 67, 24, "Spawn", false, window)
- guiSetVisible(window, false)
- end
- )
- ---- GUI functions
- function isGUIVisible(gui)
- return (guiGetVisible(gui) == true)
- end
- function getSelectedTeam()
- local row, col = guiGridListGetSelectedItem(team_gridlist)
- if row and col and row ~= -1 and col ~= -1 then
- return guiGridListGetItemText(team_gridlist, row, col)
- else
- return false
- end
- end
- function isSkinValid(skinid)
- local allSkins = getValidPedModels()
- for _, skin in ipairs(allSkins) do
- if skin == tonumber(skinid) then
- return true
- else
- return false
- end
- end
- end
- -- Make the GUI appear on login.
- addEvent("onClientPlayerLoginn", true)
- addEventHandler("onClientPlayerLoginn", root, function()
- if isGUIVisible(window) then
- return
- end
- guiSetVisible(window, true)
- -- Set the camera to the desired location.
- setCameraMatrix(-2610.9792480469, 1445.4840087891, 7.1875, -2610.9792480469, 1445.4840087891, 7.1875)
- -- Make a ped with default skin (0).
- ped = createPed(0, -2614.0212402344, 1451.1651611328, 7.1875, 180)
- end)
- -- Set team
- addEventHandler("onClientGUIClick", resourceRoot, function()
- if (source == spawn_btn) then
- local team = getSelectedTeam()
- if team then
- triggerServerEvent("setTeam", localPlayer, team)
- end
- end
- end)
- local LALocations = {"LA Test 1", "LA Test 2", "LA Test 3"}
- local IFLocations = {"IF Test 1", "IF Test 2", "IF Test 3"}
- -- Location (according to the team)
- addEventHandler("onClientGUIClick", resourceRoot, function()
- if source == team_gridlist then
- local team = getSelectedTeam()
- if team then
- guiGridListClear(location_gridlist)
- if team == "Liberation Army" then
- for _, locations_LA in ipairs(LALocations) do
- local location_row_LA = guiGridListAddRow(location_gridlist, locations_LA)
- end
- elseif team == "Imperial Forces" then
- for _, locations_IF in ipairs(IFLocations) do
- local location_row_IF = guiGridListAddRow(location_gridlist, locations_IF)
- end
- end
- end
- end
- -- Skin
- local skin = getElementModel(ped)
- local new_skin = skin + 1
- local previous_skin = new_skin - 1
- if source == skin_btn_next then
- if isSkinValid(new_skin) then
- setElementModel(ped, new_skin)
- else
- setElementModel(ped, new_skin + 1)
- end
- end
- if source == skin_btn_previous then
- setElementModel(ped, previous_skin)
- end
- end)
- -- Skin
- -- Weapon
Add Comment
Please, Sign In to add comment