function refreshgui(element)
local uid=getElementData(element,"player:uid")
if not uid then return end
local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE ownedPlayer=?", uid)
triggerClientEvent(element, "org:refresh", resourceRoot, result)
end
addEvent("org:check", true)
addEventHandler("org:check", resourceRoot, function(id,name)
-- Pobieramy UID gracza
local uid=getElementData(client,"player:uid")
if not uid then return end
-- Sprawdzamy czy jest jeszcze w?‚a?›cicielem
local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ownedPlayer=?", id, uid)
if #result < 0 then
outputChatBox("* Nie jeste?› w?‚a?›cicielem pojazdu.", client, 255, 0, 0)
return
end
local org = getElementData(client,"player:organization")
if not org then outputChatBox("Nie jeste?› w frakcji!",client,255,0,0) return end
local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND parking=0", id, org)
if #result > 0 then
outputChatBox("* Pojazd nie jest w przechowalni!.", client, 255, 0, 0)
return
end
local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ownedPlayer=?", id, uid)
if #result > 0 then
if result[1].ownedGroup ~= "0" then
local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET ownedGroup=0 WHERE id=? AND ownedPlayer=?", id, uid)
outputChatBox("* Zmieni?‚e?› pojazdowi "..name.."("..id..") przypis na siebie", client)
refreshgui(client)
return
end
local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET ownedGroup=? WHERE id=? AND ownedPlayer=?", org, id, uid)
if query then
outputChatBox("* Zmieni?‚e?› pojazdowi "..name.."("..id..") przypis na frakcje", client)
refreshgui(client)
end
end
end)
addEvent("org:download", true)
addEventHandler("org:download", resourceRoot, refreshgui)
Client
local marker=createMarker(358.26,185.35,1008.38-0.9, "cylinder", 1, 255, 255, 255, 155)
setElementInterior(marker, 3)
local screenW, screenH = guiGetScreenSize()
panelorga = false
function PanelUrzad49()
local Alpha, Alpha2 = interpolateBetween(0, 0, 0, 255, 180, 0, ((getTickCount() - tickorga) / 2500), "Linear")
dxDrawImage(screenW * 0.0743, screenH * 0.0804, screenW * 0.9400, screenH * 0.8352, ":ogrpg-core/okn.png", 0, 0, 0, tocolor(0, 0, 0, Alpha2), false)
dxDrawText("PRZEPISYWANIE POJAZDOW NA ORGANIZACJE!", screenW * 0.1038, screenH * 0.2702, screenW * 0.9625, screenH * 0.1500, tocolor(255,0,0), 3.00, "default", "center", "center", false, false, false, false, false)
end
local wmor={}
wmor.window=guiCreateStaticImage(0.12, 0.037, 0.84, 0.9, ":ogrpg-core/okn1.png", true)
guiSetVisible(wmor.window, false)
wmor.label=guiCreateLabel(0.02, 0.19, 0.96, 0.05, "Z ponizszej listy wybierz pojazd ktory chesz przepisac na organizacje a nastepnie kliknij przycisk Przepisz/Wypisz", true, wmor.window)
guiLabelSetHorizontalAlign(wmor.label, "center", false)
guiLabelSetVerticalAlign(wmor.label, "center")
wmor.gridlist=guiCreateGridList(0.25, 0.23, 0.53, 0.5, true, wmor.window)
guiGridListAddColumn(wmor.gridlist, "ID", 0.2)
guiGridListAddColumn(wmor.gridlist, "Nazwa", 0.5)
guiGridListAddColumn(wmor.gridlist, "Organizacja", 0.5)
wmor.submit=guiCreateButton(0.04, 0.74, 0.27, 0.11, "Przepisz / Wypisz", true, wmor.window)
wmor.close=guiCreateButton(0.68, 0.74, 0.28, 0.11, "Zamknij Panel", true, wmor.window)
addEventHandler("onClientGUIClick", root, function(btn,state)
if source == wmor.submit then
local selectedRow=guiGridListGetSelectedItem(wmor.gridlist)
if selectedRow < 0 then return end
local id=tostring(guiGridListGetItemText(wmor.gridlist, selectedRow, 1))
local name=tostring(guiGridListGetItemText(wmor.gridlist, selectedRow, 2))
triggerServerEvent("org:check", resourceRoot, id, name)
end
if source == wmor.close then
if guiGetVisible(wmor.window) == true then
showCursor(false)
removeEventHandler("onClientRender",root,PanelUrzad49)
panelorga = false
guiSetVisible(wmor.window, false)
end
end
end)
addEvent("org:refresh", true)
addEventHandler("org:refresh", resourceRoot, function(result)
guiGridListClear(wmor.gridlist)
for i,v in pairs(result) do
if string.len(v.plateText) < 1 then v.plateText="Brak" end
local row=guiGridListAddRow(wmor.gridlist)
if tostring(v.ownedGroup) == "0" then v.ownedGroup = "Brak" end
guiGridListSetItemText(wmor.gridlist, row, 1, v.id, false, false)
guiGridListSetItemText(wmor.gridlist, row, 2, getVehicleNameFromModel(v.model), false, false)
guiGridListSetItemText(wmor.gridlist, row, 3, v.ownedGroup , false, false)
end
end)
addEventHandler("onClientMarkerHit", marker, function(el,md)
if el~=localPlayer then return end
if not getElementData(el,"player:organization") then outputChatBox("* Nie posiadasz organizacji!") return end
if not guiGetVisible(wmor.gridlist) then
tickorga = getTickCount()
panelorga = true
addEventHandler("onClientRender",root,PanelUrzad49)
guiSetVisible(wmor.window, true)
showCursor(true)
triggerServerEvent("org:download", resourceRoot, el)
end
end)
Wystarczy ?e dodasz pod tworzeniem obrazka:
guiSetVisible(wmor.window, false)
Schowa to okno, a one si? pojawi kiedy gracz wejdzie w marker.
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach