Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local window, gridlist, btn_close, btn_accept
- local sw, sh = guiGetScreenSize()
- local mw, mh = 800,600
- local tp = {}
- tp.window = guiCreateWindow(269/mw*sw, 115/mh*sh, 263/mw*sw, 371/mh*sh, "Panel teleportów", false)
- guiWindowSetSizable(tp.window, false)
- tp.gridlist = guiCreateGridList(9/mw*sw, 22/mh*sh, 244/mw*sw, 305/mh*sh, false, tp.window)
- tp.gridlist_c_cmd = guiGridListAddColumn(tp.gridlist, "Komenda", 0.3)
- tp.gridlist_c_opis = guiGridListAddColumn(tp.gridlist, "Opis", 0.5)
- tp.btn_close = guiCreateButton(10/mw*sw, 333/mh*sh, 101/mw*sw, 28/mh*sh, "Anuluj", false, tp.window)
- tp.btn_accept = guiCreateButton(142/mw*sw, 333/mh*sh, 101/mw*sw, 28/mh*sh, "Teleportuj", false, tp.window)
- guiSetVisible(tp.window, false)
- function drawWindow()
- if getElementData(localPlayer, "auth:level") < 1 then return end
- guiGridListClear(tp.gridlist)
- guiSetVisible(tp.window, true)
- guiSetEnabled(tp.btn_close, false)
- guiSetEnabled(tp.btn_accept, false)
- showCursor(true)
- triggerServerEvent("pobierzTeleporty",localPlayer)
- end
- addCommandHandler("teleporty", drawWindow, false)
- addEventHandler( "onClientGUIClick", tp.btn_close, function()
- guiSetVisible(tp.window, false)
- showCursor(false)
- end,false)
- local teleportsy
- addEventHandler( "onClientGUIClick", tp.btn_accept, function()
- if guiGridListGetSelectedItem(tp.gridlist) then
- local item = guiGridListGetSelectedItem(tp.gridlist) + 1
- for i,v in ipairs(teleportsy) do
- local pos = split(v.position,",")
- if i == item then
- setElementPosition(localPlayer,pos[1],pos[2],pos[3])
- setElementDimension(localPlayer,v.dim or 0)
- setElementInterior(localPlayer,v.i or 0)
- local loc_name = string.format("TP_%s> ",string.upper(v.command))
- outputChatBox("Przeteleportowano do: "..v.description)
- guiSetVisible(tp.window, false)
- showCursor(false)
- triggerServerEvent("showAdmin", root, loc_name, getPlayerName(localPlayer))
- end
- end
- else
- outputChatBox("Nie wybrano teleportu.", 255, 0, 0)
- return
- end
- end,false)
- addEvent("odbierzTeleporty",true)
- addEventHandler("odbierzTeleporty",root,function(success, tps)
- if success == false then
- outputChatBox("Nie udało się pobrać teleportów.")
- return
- end
- for i,v in ipairs(tps) do
- local row = guiGridListAddRow(tp.gridlist)
- guiGridListSetItemText(tp.gridlist, row, tp.gridlist_c_cmd, "/"..v.command,false,false) --element gridList, int rowIndex, int columnIndex, string text, bool section, bool number )
- guiGridListSetItemText(tp.gridlist, row, tp.gridlist_c_opis, v.description,false,false)
- end
- teleportsy = tps
- guiSetEnabled(tp.btn_close, true)
- guiSetEnabled(tp.btn_accept, true)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement