majster9000
Wiek: 28 Na forum: 1328 dni Posty: 7
Nick w MP: sergio
Piwa : 7
Masz prosty kodzik
Kod: -- funkcje i inne
local default = "default"
local default2 = "default"
local sx, sy = guiGetScreenSize()
local px, py = (sx/1920),(sy/1080)
local sx, sy = guiGetScreenSize()
function p1(x)
return (x/1280)*sx
end
function p2(y)
return (y/1024)*sy
end
local screenW, screenH = guiGetScreenSize()
local sw,sh = guiGetScreenSize()
local elements = {}
mojeW,mojeH = 1280, 1024
sW,sH = guiGetScreenSize()
w, h = (sW/mojeW), (sH/mojeH)
local sx,sy = guiGetScreenSize()
local baseX = 1920
local zoom = 1
local minZoom = 2
if sx < baseX then
zoom = math.min(minZoom, baseX/sx)
end
function roundedRectangle(x, y, width, height, radius, color, postGUI, subPixelPositioning)
dxDrawRectangle(x+radius, y+radius, width-(radius*2), height-(radius*2), color, postGUI, subPixelPositioning)
dxDrawCircle(x+radius, y+radius, radius, 180, 270, color, color, 16, 1, postGUI)
dxDrawCircle(x+radius, (y+height)-radius, radius, 90, 180, color, color, 16, 1, postGUI)
dxDrawCircle((x+width)-radius, (y+height)-radius, radius, 0, 90, color, color, 16, 1, postGUI)
dxDrawCircle((x+width)-radius, y+radius, radius, 270, 360, color, color, 16, 1, postGUI)
dxDrawRectangle(x, y+radius, radius, height-(radius*2), color, postGUI, subPixelPositioning)
dxDrawRectangle(x+radius, y+height-radius, width-(radius*2), radius, color, postGUI, subPixelPositioning)
dxDrawRectangle(x+width-radius, y+radius, radius, height-(radius*2), color, postGUI, subPixelPositioning)
dxDrawRectangle(x+radius, y, width-(radius*2), radius, color, postGUI, subPixelPositioning)
end
okno = false
menu = false
tick = getTickCount()
local sx, sy = guiGetScreenSize()
function isMouseIn(psx,psy,pssx,pssy,abx,aby)
if not isCursorShowing() then return end
cx,cy=getCursorPosition()
cx,cy=cx*sx,cy*sy
if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
return true,cx,cy
else
return false
end
end
-- kod menu
local marker=createMarker(1379.99,666.82,10.83-1, 'cylinder', 1.2, 0,122, 255)
setElementDimension(marker, 0)
setElementInterior(marker, 0)
nazwa_pracy = 'LSPD'
addEventHandler("onClientMarkerHit", marker, function(player)
local veh = getPedOccupiedVehicle(localPlayer)
if veh then return end
if player ~= localPlayer then return end
tick = getTickCount()
addEventHandler("onClientRender", root, gui)
menu = true
showCursor(true)
end)
function gui()
local alph = interpolateBetween(0, 0, 0, 255, 0, 0, (getTickCount() - tick)/1000, "OutQuad")
roundedRectangle(510*px, 245*py, 900*px, 550*py, 15, tocolor(15, 15, 15, 233), false)
dxDrawText("PANEL SŁUŻBY", 530*px, 80*py, 758*px, 477*py, tocolor(235, 235, 235, 255), 2*px, default, "left", "center", false, false, false, true)
dxDrawText(nazwa_pracy, 530*px, 150*py, 798*px, 477*py, tocolor(155, 155, 155, 255), 1.5*px, default, "left", "center", false, false, false, true)
if isMouseIn(518*px, 430*py, 150*px, 200*py) then
roundedRectangle(518*px, 430*py, 150*px, 200*py, 10, tocolor(50,50,50,255), false)
else
roundedRectangle(518*px, 430*py, 150*px, 200*py, 10, tocolor(50,50,50,200), false)
end
if getElementData(localPlayer, 'service:lspd') then
dxDrawText("Zakończ służbe", 890*px, 470*py, 295*px, 590*py, tocolor(155, 155, 155, 255), 1.2*px, default, "center", "center", false, false, false, true)
else
dxDrawText("Rozpocznij służbe", 890*px, 470*py, 295*px, 590*py, tocolor(155, 155, 155, 255), 1.2*px, default, "center", "center", false, false, false, true)
end
if isMouseIn(1370*px, 250*py, 28*px, 28*py) then -- exit gui
dxDrawText("X", 890*px, 250*py, 1390*px, 590*py, tocolor(255, 50, 50, 255), 2*px, default, "right", "top", false, false, false, true)
else
dxDrawText("X", 890*px, 250*py, 1390*px, 590*py, tocolor(150, 0, 0, 255), 2*px, default, "right", "top", false, false, false, true)
end
end
addEventHandler("onClientClick", root, function(btn, state)
if btn == "left" and state == "down" then
if isMouseIn(518*px, 430*py, 150*px, 200*py) and menu == true then
if getElementData(localPlayer, 'service:lspd') then
setElementData(localPlayer, 'service:lspd', false)
else
setElementData(localPlayer, 'service:lspd', true)
end
outputConsole(getElementData(localPlayer, 'service:lspd'))
removeEventHandler("onClientRender", root, gui)
tick = getTickCount()
menu = false
okno = true
showCursor(false)
elseif isMouseIn(1370*px, 250*py, 28*px, 28*py) and menu == true then
removeEventHandler("onClientRender", root, gui)
showCursor(false)
tick = getTickCount()
menu = false
end
end
end)