Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2023-03-22, 22:31


Mateuszkropkaaa







Wiek: 29
Na forum: 3008 dni
Posty: 9
Nick w MP: Mateuszkropkaaa

Piwa: 47

Respekt: 50

Witam mam skrypt od panelu organizacji lecz po jego nacisnieciu wywala mi b??d w debugu...


ERROR: [Organizacje]\dmta_organizacje\c_core.lua:262: attempt to perform arithmetic on local 'b' (a nil value)

Kto? wie o co chodzi? Prosze o pomoc



Kod:

--[[
Zacznijmy wiecej wymagac ~Xyrusek
AUTOR: Xyrusek
--]]


--[[
SKALOWANIE
--]]

local sx, sy = guiGetScreenSize()
local zoom = sx < 1920 and math.min(2, 1920 / sx) or 1

--[[
KOD
--]]

--if getPlayerSerial(localPlayer) ~= "F0937A8AD9CB41D0DD9CC4022B87CCE4" and getPlayerSerial(localPlayer) ~= "3EEDD70B7E7154C360D7D42C3CC4E0F3" and getPlayerSerial(localPlayer) ~= "AD2FED4BA51D3EB42EB320FBC85B8A94" then return end

local cashe = {}
local state = false
local last = {}
local pages = {}

local f = {}
f[1] = dxCreateFont("files/fa.otf", 23)
f[2] = dxCreateFont(":dmta_fonts/regular.ttf", 18)
f[3] = dxCreateFont(":dmta_fonts/sbold.ttf", 15)
f[4] = dxCreateFont("files/fa.otf", 14)
f[5] = dxCreateFont("files/fa.otf", 82)
f[6] = dxCreateFont(":dmta_fonts/sbold.ttf", 18)
f[7] = dxCreateFont(":dmta_fonts/regular.ttf", 16)
f[8] = dxCreateFont(":dmta_fonts/sbold.ttf", 24)
f[9] = dxCreateFont(":dmta_fonts/sbold.ttf", 22)

function click(x, y, w, h)
--dxDrawRectangle(x, y, w, h, tocolor(255, 0, 0, 30))
if isMouseInPosition(x, y, w, h) and getKeyState("mouse1") and not cashe.clickblock then return true end
return false
end

pages["informacje"] = function()
--local r, g, b = unpack((data.color or {210, 210, 210}))
local data = (cashe.data or {})
local r, g, b = unpack((data.color or {210, 210, 210}))
dxDrawRectangle(sx/2+10/zoom, sy/2-190/zoom, 1, 380/zoom, tocolor(220, 220, 220, 40))
dxDrawRectangle(sx/2-180/zoom, sy/2, 190/zoom, 1, tocolor(220, 220, 220, 40))
dxDrawRectangle(sx/2+11.6/zoom, sy/2, 190/zoom, 1, tocolor(220, 220, 220, 40))
local data = (cashe.data or {})
-- zamkniecie okna
dxDrawText("F4, aby zamkn?? okno.", sx/2+420/zoom, sy/2-190/zoom, sx/2+200/zoom, sy/2-275/zoom, tocolor(240, 240, 240), 1.2/zoom, f[6], "left", "bottom")

--czlonkowie organizacji
--roundedRectangle(sx/2-405/zoom, sy/2-230/zoom, 525/zoom, 200/zoom, tocolor(18, 18, 18))
dxDrawText(utfChar(0xf0c0), sx/2-205/zoom, sy/2-230/zoom, sx/2-385/zoom, sy/2-(150-200)/zoom, tocolor(r,g,b, 60), 1/zoom, f[5], "left", "center")
dxDrawText("CZ?ONKOWIE ORGANIZACJI", sx/2-308/zoom, sy/2-190/zoom, sx/2-385/zoom, sy/2-150/zoom, tocolor(255, 255, 255), 1/zoom, f[6], "left", "bottom")
dxDrawText("Do twojej organizacji zosta?o dodanych\n"..(data.members and table.size(data.members) or 0).." cz?onk?w", sx/2-305/zoom, sy/2-150/zoom, sx/2-385/zoom, sy/2-192/zoom, tocolor(180, 180, 180), 1/zoom, f[7], "left", "top")

--reputacja
--roundedRectangle(sx/2+180/zoom, sy/2-230/zoom, 525/zoom, 200/zoom, tocolor(18, 18, 18))
dxDrawText(utfChar(0xf54c), sx/2+50/zoom, sy/2-230/zoom, sx/2+200/zoom, sy/2-(150-200)/zoom, tocolor(r,g,b, 60), 1/zoom, f[5], "left", "center")
dxDrawText("REPUTACJA", sx/2+20/zoom, sy/2-190/zoom, sx/2+200/zoom, sy/2-150/zoom, tocolor(240, 240, 240), 1/zoom, f[6], "left", "bottom")
dxDrawText("Twoja organizacja w aktualnym momencie\nposiada "..formatNumber((data.reputation or 0), ",").." punkt?w reputacji", sx/2+20/zoom, sy/2-150/zoom, sx/2+200/zoom, sy/2-192/zoom, tocolor(180, 180, 180), 1/zoom, f[7], "left", "top")

--saldo
--roundedRectangle(sx/2-405/zoom, sy/2+30/zoom, 525/zoom, 200/zoom, tocolor(18, 18, 18))
dxDrawText(utfChar(0xf155), sx/2-150/zoom, sy/2+30/zoom, sx/2-385/zoom, sy/2+(30+200)/zoom, tocolor(r,g,b, 60), 1/zoom, f[5], "left", "center")
dxDrawText("SALDO", sx/2-325/zoom, sy/2+80/zoom, sx/2-385/zoom, sy/2+80/zoom, tocolor(240, 240, 240), 1/zoom, f[6], "left", "bottom")
dxDrawText("Na koncie twojej organizacji, w aktualnym\nmomencie znajduje si? "..(formatNumber((data.saldo or 0), ",")).."$\nTwoja organizacja posiada "..(cashe.terrainsCount).." tereny/ow", sx/2-325/zoom, sy/2+74/zoom, sx/2-385/zoom, sy/2+74/zoom, tocolor(180, 180, 180), 1/zoom, f[7], "left", "top")

--poziom
--roundedRectangle(sx/2+180/zoom, sy/2+30/zoom, 525/zoom, 200/zoom, tocolor(18, 18, 18))
dxDrawText(utfChar(0xf005), sx/2+50/zoom, sy/2+30/zoom, sx/2+200/zoom, sy/2+(30+200)/zoom, tocolor(r,g,b, 60), 1/zoom, f[5], "left", "center")
dxDrawText("POZIOM", sx/2+20/zoom, sy/2+80/zoom, sx/2+200/zoom, sy/2+80/zoom, tocolor(240, 240, 240), 1/zoom, f[6], "left", "bottom")
dxDrawText("Twoja organizacja w aktualnym momencie\nposiada "..formatNumber((data.reputation/100*2 or 1), ",").." LVL", sx/2+20/zoom, sy/2+74/zoom, sx/2+200/zoom, sy/2+74/zoom, tocolor(180, 180, 180), 1/zoom, f[7], "left", "top")
end

pages["czlonkowie"] = function()
dxDrawRectangle(sx/2-458/zoom, sy/2-282/zoom, 1215/zoom, 48/zoom, tocolor(18, 18, 18))
dxDrawRectangle(sx/2-458/zoom, sy/2-234/zoom, 1215/zoom, 516/zoom, tocolor(25, 25, 25))
dxDrawText("Nickname", sx/2-445/zoom, sy/2-282/zoom, sx/2-445/zoom, sy/2-234/zoom, tocolor(240, 240, 240), 1/zoom, f[8], "left", "center")
dxDrawText("Permisje", sx/2-72/zoom, sy/2-282/zoom, sx/2-72/zoom, sy/2-234/zoom, tocolor(240, 240, 240), 1/zoom, f[8], "left", "center")
dxDrawText("Dodany przez", sx/2+150/zoom, sy/2-282/zoom, sx/2+150/zoom, sy/2-234/zoom, tocolor(240, 240, 240), 1/zoom, f[8], "left", "center")
dxDrawText("Akcje", sx/2+485/zoom, sy/2-282/zoom, sx/2+485/zoom, sy/2-234/zoom, tocolor(240, 240, 240), 1/zoom, f[8], "left", "center")

--content
local data = (cashe.data or {})
if data and data.members then
local sid = (getElementData(localPlayer, "player:sid") or 0)
for i = 1, 10 do
local d = data.members[i]
if d then
dxDrawRectangle(sx/2-458/zoom, sy/2-(222-(i-1)*50)/zoom, 1215/zoom, 40/zoom, tocolor(34, 34, 34, (isMouseInPosition(sx/2-458/zoom, sy/2-(222-(i-1)*50)/zoom, 1215/zoom, 40/zoom) and 255 or 200)))
dxDrawText((d.name or "---"), sx/2-445/zoom, sy/2-(222-(i-1)*50)/zoom, sx/2-445/zoom, sy/2-(182-(i-1)*50)/zoom, tocolor(180, 180, 180), 1/zoom, f[2], "left", "center")
dxDrawText((d.addedBy or "---"), sx/2+150/zoom, sy/2-(222-(i-1)*50)/zoom, sx/2+150/zoom, sy/2-(182-(i-1)*50)/zoom, tocolor(180, 180, 180), 1/zoom, f[2], "left", "center")

local color = (d.add and tocolor(90, 150, 90) or tocolor(160, 65, 65))
dxDrawText("+", sx/2-69/zoom, sy/2-(222-(i-1)*50)/zoom, sx/2-29/zoom, sy/2-(182-(i-1)*50)/zoom, color, 1/zoom, f[2], "center", "center")
if click(sx/2-69/zoom, sy/2-(222-(i-1)*50)/zoom, 40/zoom, 40/zoom) then
if data.owner == sid then
if not last.changePermission or getTickCount()-last.changePermission > 2000 then
last.changePermission = getTickCount()
triggerLatentServerEvent("xyrusek_organizacje:setPlayerPermission", 5000, false, getResourceRootElement(), d.id, "add", not d.add)
else
exports["dmta_notifications"]:sendNotification("Poczekaj chwilk?, przed kolejn? zmian? permisji")
end
else
exports["dmta_notifications"]:sendNotification("Jedynie lider organizacji, jest w stanie zmienia? permisje cz?onk?w")
end
end

local color = (d.kick and tocolor(90, 150, 90) or tocolor(160, 65, 65))
dxDrawText("-", sx/2-20/zoom, sy/2-(222-(i-1)*50)/zoom, sx/2+20/zoom, sy/2-(182-(i-1)*50)/zoom, color, 1/zoom, f[2], "center", "center")
if click(sx/2-20/zoom, sy/2-(222-(i-1)*50)/zoom, 40/zoom, 40/zoom) then
if data.owner == sid then
if not last.changePermission or getTickCount()-last.changePermission > 2000 then
last.changePermission = getTickCount()
triggerLatentServerEvent("xyrusek_organizacje:setPlayerPermission", 5000, false, getResourceRootElement(), d.id, "kick", not d.kick)
else
exports["dmta_notifications"]:sendNotification("Poczekaj chwilk?, przed kolejn? zmian? permisji")
end
else
exports["dmta_notifications"]:sendNotification("Jedynie lider organizacji, jest w stanie zmienia? permisje cz?onk?w")
end
end

local color = (d.payout and tocolor(90, 150, 90) or tocolor(160, 65, 65))
dxDrawText("$", sx/2+25/zoom, sy/2-(222-(i-1)*50)/zoom, sx/2+65/zoom, sy/2-(182-(i-1)*50)/zoom, color, 1/zoom, f[2], "center", "center")
if click(sx/2+25/zoom, sy/2-(222-(i-1)*50)/zoom, 40/zoom, 40/zoom) then
if data.owner == sid then
if not last.changePermission or getTickCount()-last.changePermission > 2000 then
last.changePermission = getTickCount()
triggerLatentServerEvent("xyrusek_organizacje:setPlayerPermission", 5000, false, getResourceRootElement(), d.id, "payout", not d.payout)
else
exports["dmta_notifications"]:sendNotification("Poczekaj chwilk?, przed kolejn? zmian? permisji")
end
else
exports["dmta_notifications"]:sendNotification("Jedynie lider organizacji, jest w stanie zmienia? permisje cz?onk?w")
end
end

local color = ((d.id == sid) and tocolor(90, 150, 90) or (d.id ~= sid and d.id ~= data.owner and data.playerData.kick) and tocolor(90, 150, 90) or tocolor(160, 65, 65))
dxDrawText((d.id ~= sid and "Wyrzu?" or "Opu??"), sx/2+485/zoom, sy/2-(222-(i-1)*50)/zoom, sx/2+485/zoom, sy/2-(182-(i-1)*50)/zoom, color, 1/zoom, f[2], "left", "center")
if click(sx/2+485/zoom, sy/2-(222-(i-1)*50)/zoom, 70/zoom, 40/zoom) then
if d.id ~= data.owner then
if not last.kickPlayer or getTickCount()-last.kickPlayer > 2000 then
last.kickPlayer = getTickCount()
triggerLatentServerEvent("xyrusek_organizacje:removeMember", 5000, false, getResourceRootElement(), d.id)
else
exports["dmta_notifications"]:sendNotification("Poczekaj chwilk?, przed kolejn? zmian? permisji")
end
else
exports["dmta_notifications"]:sendNotification("Nie posiadasz permisji do wyrzucenia tej osoby")
end
end

local color = (data.playerData.payout and tocolor(90, 150, 90) or tocolor(160, 65, 65))
dxDrawText("Wyp?ata", sx/2+585/zoom, sy/2-(222-(i-1)*50)/zoom, sx/2+585/zoom, sy/2-(182-(i-1)*50)/zoom, color, 1/zoom, f[2], "left", "center")
if click(sx/2+585/zoom, sy/2-(222-(i-1)*50)/zoom, 80/zoom, 40/zoom) then
if data.playerData.payout then
local payoutAmount = guiGetText(cashe.editbox2)
if payoutAmount and #payoutAmount > 0 and tonumber(payoutAmount) then
local payoutAmount = math.floor(payoutAmount)
if not last.payoutPlayer or getTickCount()-last.payoutPlayer > 2000 then
if tonumber(payoutAmount) <= 20000000 and tonumber(payoutAmount) > 0 then
last.payoutPlayer = getTickCount()
triggerLatentServerEvent("xyrusek_organizacje:givePayout", 5000, false, getResourceRootElement(), d.id, payoutAmount)
else
exports["dmta_notifications"]:sendNotification("Maksymalna wyp?ata to 20kk na dzie?")
end
else
exports["dmta_notifications"]:sendNotification("Poczekaj chwilk?, przed kolejn? wyp?at?")
end
else
exports["dmta_notifications"]:sendNotification("Pierw podaj kwot? wyp?aty")
end
else
exports["dmta_notifications"]:sendNotification("Nie posiadasz permisji do przyznawania wyp?at")
end
end
end
end
end
if data.playerData.add then
dxDrawRectangle(sx/2+353/zoom, sy/2+285/zoom, 140/zoom, 32/zoom, tocolor(25, 25, 25))
dxDrawText("Dodaj cz?onka", sx/2+353/zoom, sy/2+285/zoom, sx/2+493/zoom, sy/2+317/zoom, tocolor(210, 210, 210), 1/zoom, f[3], "center", "center")
if click(sx/2+353/zoom, sy/2+285/zoom, 140/zoom, 32/zoom) then
local playerID = guiGetText(cashe.editbox)
if playerID and #playerID > 0 and tonumber(playerID) then
local player = findPlayerByID(tonumber(playerID))
if player then
if not last.addMember or getTickCount()-last.addMember > 2000 then
last.addMember = getTickCount()
triggerLatentServerEvent("xyrusek_organizacje:addMember", 5000, false, getResourceRootElement(), player)
else
exports["dmta_notifications"]:sendNotification("Poczekaj chwilk?, przed kolejn? zmian? permisji")
end
else
exports["dmta_notifications"]:sendNotification("Nie odnaleziono gracza o ID: "..playerID)
end
else
exports["dmta_notifications"]:sendNotification("Pierw podaj ID gracza")
end
end
end
end

pages["pojazdy"] = function()
if cashe.vehicles and #cashe.vehicles > 0 then
local index = 0
for i = cashe.vehicles.min, cashe.vehicles.max do
if cashe.vehicles[i] then
local vehicle = cashe.vehicles[i]
index = index+1
local offset = ((index-1)*120)
local a = (isMouseInPosition(sx/2-225/zoom, sy/2-(287-offset)/zoom, 1116/zoom, 110/zoom) and 0.8 or 1)
dxDrawRectangle(sx/2-461/zoom, sy/2-(287-offset)/zoom, 236/zoom, 110/zoom, tocolor(24, 24, 24, 255*a))
dxDrawRectangle(sx/2-225/zoom, sy/2-(287-offset)/zoom, 880/zoom, 110/zoom, tocolor(24, 24, 24, 150*a))
dxDrawImage(sx/2-444/zoom, sy/2-(360-offset)/zoom, 235/zoom, 235/zoom, ':dmta_vehiclesimg/vehiclesimg/vehicles/'..(vehicle.model or 411)..'.png', 0, 0, 0, tocolor(255, 255, 255, 255*a))
dxDrawText((vehicle.model and getVehicleNameFromModel(vehicle.model) or 'Unknown vehicle')..' ['..(vehicle.id or 'error')..']', sx/2-207/zoom, sy/2-(270-offset)/zoom, nil, nil, tocolor(230, 230, 230, 255*a), 1/zoom, f[9])
dxDrawText('Lokalizacja', sx/2+105/zoom, sy/2-(270-offset)/zoom, nil, nil, tocolor(230, 230, 230, 255*a), 1/zoom, f[9])
dxDrawText('#9c9c9cOstatni kierowca: #d9d9d9'..(string.len(vehicle.lastdriver) > 0 and vehicle.lastdriver or 'brak')..'\n#9c9c9cW?a?ciciel pojazdu: #d9d9d9'..(string.len(vehicle.owner) > 0 and vehicle.owner or 'brak'), sx/2-207/zoom, sy/2-(240-offset)/zoom, nil, nil, tocolor(230, 230, 230, 255*a), 1/zoom, f[7], 'left', 'top', false, false, false, true)
dxDrawText('#9c9c9cPojazd znajduje si? w:\n#d9d9d9'..(vehicle.location or 'przechowalnia'), sx/2+105/zoom, sy/2-(240-offset)/zoom, nil, nil, tocolor(230, 230, 230, 255*a), 1/zoom, f[7], 'left', 'top', false, false, false, true)
end
end
end
end

function scroll(key, state)
if key == 'mouse_wheel_down' then
if cashe.vehicles.max < #cashe.vehicles then
cashe.vehicles.min, cashe.vehicles.max = cashe.vehicles.min+1, cashe.vehicles.max+1
end
elseif key == 'mouse_wheel_up' then
if cashe.vehicles.min > 1 then
cashe.vehicles.min, cashe.vehicles.max = cashe.vehicles.min-1, cashe.vehicles.max-1
end
end
end

function renderDefault()
-- exports["rpg_blur"]:dxDrawBluredRectangle(sx/2-800/zoom, sy/2-324/zoom, 300/zoom, 650/zoom, tocolor(120, 120, 120))
dxDrawImage(sx/2-625/zoom, sy/2-324/zoom, 1300/zoom, 650/zoom, "assets/images/bg.png", 0, 0, 0, tocolor(11, 11, 11))

--sidebar
local data = (cashe.data or {})
dxDrawText(utfChar(0xf05b), sx/2-752/zoom, sy/2-308/zoom, sx/2-59/zoom, sy/2-312/zoom, tocolor(220, 220, 220), 0.7/zoom, f[1], "right", "top")
dxDrawText("ORGANIZACJA "..(data.type and string.upper(data.type) or ""), sx/2-105/zoom, sy/2-280/zoom, sx/2-742/zoom, sy/2-310/zoom, tocolor(180, 180, 180), 1.2/zoom, f[3], "left", "top")

dxDrawRectangle(sx/2-625/zoom, sy/2-228/zoom, 1300/zoom, 1, tocolor(220, 220, 220, 60))

local r, g, b = unpack((data.color or {210, 210, 210}))
dxDrawText((data.name or "---"), sx/2-50/zoom, sy/2-283/zoom, sx/2-742/zoom, sy/2-270/zoom, tocolor(r,g,b), 1.4/zoom, f[2], "left", "bottom")
roundedRectangle(sx/2-600/zoom, sy/2+275/zoom, 35/zoom, 35/zoom, tocolor(r, g, b, 200))
dxDrawText("Kolor organizacji", sx/2-550/zoom, sy/2+275/zoom, sx/2-745/zoom, sy/2+310/zoom, tocolor(220, 220, 220), 1/zoom, f[2], "left", "center")
local tabs = {}
tabs[1] = {" pojazdy", "assets/images/car.png"}
tabs[2] = {"cz?onkowie ", "assets/images/users.png"}
tabs[3] = {"informacje", "assets/images/home.png"}
for i, v in ipairs(tabs) do
local tabName, tabIcon = unpack(v)
local color = (cashe.page == tabName and tocolor(r,g,b) or tocolor(r,g,b+20))
dxDrawImage(sx/2-(550-(i-1)*100), sy/2-310/zoom, sx/2-1000/zoom, sy/2-505/zoom, tabIcon, 0, 0, 0, tocolor(255, 255, 255))
dxDrawText(tabName, sx/2-(605-(i-1)*102)/zoom, sy/2-270/zoom, sx/2-740/zoom, sy/2-224/zoom, color, 1/zoom, f[2], "left", "center")
if click(sx/2-(605-(i-1)*102)/zoom, sy/2-270/zoom, sx/2-740/zoom, sy/2-0/zoom) and cashe.page ~= tabName then
cashe.page = tabName
cashe.vehicles.min, cashe.vehicles.max = 1,5
if cashe.page == "czlonkowie" then
if data.playerData.add then
cashe.editbox = guiCreateEdit(sx/2+498/zoom, sy/2+285/zoom, 260/zoom, 32/zoom, "ID GRACZA", false)
guiSetAlpha(cashe.editbox, 0.75)
end
if data.playerData.payout then
cashe.editbox2 = guiCreateEdit(sx/2+80/zoom, sy/2+285/zoom, 260/zoom, 32/zoom, "KWOTA WYPLATY", false)
guiSetAlpha(cashe.editbox2, 0.75)
end
else
if isElement(cashe.editbox) then destroyElement(cashe.editbox) end
if isElement(cashe.editbox2) then destroyElement(cashe.editbox2) end
end
end
end
end

function render()
renderDefault()
if cashe.page and pages[cashe.page] then
pages[cashe.page]()
end

if not cashe.clickblock and getKeyState("mouse1") then
cashe.clickblock = true
elseif cashe.clickblock and not getKeyState("mouse1") then
cashe.clickblock = false
end
end

function showPanel()
cashe = {}
cashe.page = "informacje"
cashe.first = 0
removeEventHandler("onClientRender", getRootElement(), render)
addEventHandler("onClientRender", getRootElement(), render)
showCursor(true, false)
toggleControl("fire", false)
unbindKey('mouse_wheel_up', 'down', scroll)
unbindKey('mouse_wheel_down', 'down', scroll)
bindKey('mouse_wheel_up', 'down', scroll)
bindKey('mouse_wheel_down', 'down', scroll)
end

function hidePanel()
if isElement(cashe.editbox) then destroyElement(cashe.editbox) end
if isElement(cashe.editbox2) then destroyElement(cashe.editbox2) end
cashe = {}
removeEventHandler("onClientRender", getRootElement(), render)
showCursor(false, false)
unbindKey('mouse_wheel_up', 'down', scroll)
unbindKey('mouse_wheel_down', 'down', scroll)
end

function getOrganizationTerrainsCount(r, g, b)
local r, g, b = tonumber(r), tonumber(g), tonumber(b)
local count = 0
local terenyResource = getResourceFromName("rpg_terrains")
for i, v in ipairs(getElementsByType("radararea", getResourceRootElement(terenyResource))) do
local _r, _g, _b = getRadarAreaColor(v)
local _r, _g, _b = tonumber(_r), tonumber(_g), tonumber(_b)
if r == _r and g == _g and b == _b then
count = count+1
end
end
return count
end

function findVehicle(id)
if not id then return false end
for i,v in ipairs(getElementsByType('vehicle')) do
if getElementData(v, 'vehicle:data') and getElementData(v, 'vehicle:data').id == id then
return v
end
end
end

function createVehiclesLocation()
if not cashe.vehicles or #cashe.vehicles <= 0 then return false end
for i,v in ipairs(cashe.vehicles) do
if v.parking == 1 then
v.location = 'przechowalnia'
else
if findVehicle(v.id) then
local vehicle = findVehicle(v.id)
local x, y, z = getElementPosition(vehicle)
v.location = getZoneName(x, y, z, true)..', '..getZoneName(x, y, z)
end
end
end
end

function importPanelData(data, vehicles)
if data then
if not state then
state = true
showPanel()
end
cashe.data = data
cashe.vehicles = vehicles
if cashe.vehicles then
createVehiclesLocation()
end
cashe.terrainsCount = getOrganizationTerrainsCount(unpack(cashe.data.color))
local sid = (getElementData(localPlayer, "player:sid") or 0)
for i, v in ipairs(data.members) do
if v.id == sid then
cashe.data.playerData = v
return
end
end
else
exports["dmta_notifications"]:sendNotification("Nie nale?ysz do ?adnej z organizacji")
end
end
addEvent("xyrusek_organizacje:importPanelData", true)
addEventHandler("xyrusek_organizacje:importPanelData", getResourceRootElement(), importPanelData)

function togglePanel()
if state then
state = not state
hidePanel()
else
if not last.show or getTickCount()-last.show > 5000 then
last.show = getTickCount()
triggerLatentServerEvent("xyrusek_organizacje:getPanelData", 5000, false, getResourceRootElement())
else
exports["dmta_notifications"]:sendNotification("Poczekaj chwilk?")
end
end
end
addCommandHandler("Poka? panel organizacji", togglePanel)
bindKey("F4", "down", "Poka? panel organizacji")

function isMouseInPosition ( x, y, width, height )
if ( not isCursorShowing( ) ) then
return false
end
local sx, sy = guiGetScreenSize ( )
local cx, cy = getCursorPosition ( )
local cx, cy = ( cx * sx ), ( cy * sy )

return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) )
end

function roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI)
if (x and y and w and h) then
if (not borderColor) then
borderColor = tocolor(0, 0, 0, 200);
end
if (not bgColor) then
bgColor = borderColor;
end
dxDrawRectangle(x, y, w, h, bgColor, postGUI);
dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, postGUI);
dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, postGUI);
dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, postGUI);
dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, postGUI);
end
end

function table.size(tab)
local length = 0
for _ in pairs(tab) do length = length + 1 end
return length
end

function formatNumber(number, sep)
assert(type(tonumber(number))=="number", "Bad argument @'formatNumber' [Expected number at argument 1 got "..type(number).."]")
assert(not sep or type(sep)=="string", "Bad argument @'formatNumber' [Expected string at argument 2 got "..type(sep).."]")
local money = number
for i = 1, tostring(money):len()/3 do
money = string.gsub(money, "^(-?%d+)(%d%d%d)", "%1"..sep.."%2")
end
return money
end

function findPlayerByID(id)
for i, v in ipairs(getElementsByType("player")) do
local _id = getElementData(v, "id")
if _id == id then return v end
end
return false
end


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2023-03-23, 00:06


Pawelek







Wiek: 22
Na forum: 3627 dni
Posty: 18

Piwa: 28

Respekt: 60

Problem zosta? ju? rozwi?zany.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Tagi: panel :: organizacyjny
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Panel organizacyjny Odpowiedz do tematu

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
Dodaj temat do Ulubionych
Wersja do druku