local screenW, screenH = guiGetScreenSize()
local marker = createMarker(-1549.86,1064.60,7.19-0.9, "cylinder", 1.2, 255, 170, 0, 60)
--setElementData(marker, "marker:icon", "system")
--local oznaczeniePracy = createBlip(-2355.18,-2866.83,1.97, 46,2, 255, 0, 0,255,0,500)
local jobTarget
jobTarget = 0
local px,py = (screenW/1920),(screenH/1080)
local zoom = 1
local fh = 1920
if screenW < fh then
zoom = math.min(2,fh/screenW)
end
addEventHandler("onClientMarkerHit", marker, function(h)
local _,_,z = getElementPosition(localPlayer)
local _,_,z2 = getElementPosition(source)
if z > z2+1 then return end
if h ~= localPlayer then return end
if isPedInVehicle(localPlayer) then return end
setElementData(localPlayer, "prawko:gui", true)
showCursor(true)
end)
function isMouseIn ( 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 )
if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
return true
else
return false
end
end
strona = "start"
function gui()
if not getElementData(localPlayer, "prawko:gui") == true then return end
if strona == "start" then
dxDrawRectangle(screenW * 0.3927, screenH * 0.2722, screenW * 0.2146, screenH * 0.4565, tocolor(0, 0, 0, 105), false)
-- przejdz dalej
dxDrawRectangle(screenW * 0.4042, screenH * 0.6324, screenW * 0.1891, screenH * 0.0481, tocolor(239, 253, 196, 105), false)
-- zamknij okno
dxDrawRectangle(screenW * 0.6073, screenH * 0.2722, screenW * 0.0203, screenH * 0.0389, tocolor(172, 251, 211, 105), false)
dxDrawText("Rozpocznij egzamin Kat. B", screenW * 0.4047, screenH * 0.6315, screenW * 0.5932, screenH * 0.6806, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
dxDrawText("Witaj w sekcji prawa jazdy", screenW * 0.3927, screenH * 0.2713, screenW * 0.6073, screenH * 0.3519, tocolor(255, 255, 255, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false)
end
end
addEventHandler("onClientRender", root, gui)
bindKey("mouse1", "down", function()
if getElementData(localPlayer, "prawko:gui") == true then
if isMouseIn(screenW * 0.4042, screenH * 0.6324, screenW * 0.1891, screenH * 0.0481) and strona == "start" then
setElementData(localPlayer, "prawko:gui", false)
showCursor(false)
triggerServerEvent("prawko:katb", localPlayer)
end
if isMouseIn(screenW * 0.6073, screenH * 0.2722, screenW * 0.0203, screenH * 0.0389) and strona == "start" then
setElementData(localPlayer, "prawko:gui", false)
showCursor(false)
end
end
end)
function zakonczevent()
if markerCel and isElement(markerCel) then
destroyElement(markerCel)
markerCel = nil
end
if jobTarget and isElement(jobTarget) then
destroyElement(jobTarget)
jobTarget = nil
jobTarget = 0
end
triggerServerEvent("usun:katb", localPlayer)
end
local point = {
{-1560.80,1060.93,7.19},
{-1563.92,1068.95,7.19},
{-1569.64,1087.48,7.19},
{-1572.31,1121.62,7.19},
{-1564.44,1131.00,7.19},
}
addEvent("listonosz:cm", true)
addEventHandler("listonosz:cm", root, function()
stworzMarker()
end)
addEvent("konczymyevent:git", true)
addEventHandler("konczymyevent:git", root, function()
destroyElement(markerCel)
destroyElement(jobTarget)
destroyElement(BlipCel)
end)
function CreateCheckPoint()
if isElement(markerCel) then
destroyElement(markerCel)
destroyElement(BlipCel)
end
if jobTarget == #point then
zakonczevent()
triggerEvent("onClientAddNotification", localPlayer, "end !", "success")
end
jobTarget = jobTarget + 1
markerCel = createMarker(point[jobTarget][1], point[jobTarget][2], point[jobTarget][3], "checkpoint", 2, 255, 160, 0)
BlipCel = createBlipAttachedTo(markerCel, 41)
if point[jobTarget+1] then
ile = point[jobTarget+1]
ile2 = ile[1]
ile3 = ile[2]
ile4 = ile[3]
setMarkerTarget(markerCel, ile[1], ile[2], ile[3])
end
addEventHandler("onClientMarkerHit", markerCel, function()
CreateCheckPoint()
end)
end
addEvent("rozpocznij:prawkob", true)
addEventHandler("rozpocznij:prawkob", root, function()
CreateCheckPoint()
end)