Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local screenW, screenH = guiGetScreenSize()
- 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 )
- if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
- return true
- else
- return false
- end
- end
- local marker = createMarker(-1879.73, -1659.73, 21.75-1, "cylinder", 3, 0, 102, 204, 125)
- local blip = createBlip(-1879.73, -1659.73, 21.75,37)
- local t_text = createElement('text')
- setElementPosition(t_text,-1879.73, -1659.73, 21.75)
- setElementData(t_text,'name','Złomowisko')
- local showed = false
- local click = 1
- function KGtoTB(kg)
- if tonumber(kg) > 1000 then
- return (kg/1000).."T"
- end
- return kg.."KG"
- end
- addEventHandler("onClientMarkerHit", marker, function(hit)
- if hit ~= localPlayer then return end
- --if getPlayerSerial(localPlayer) ~= 'E31AEC4C62F98B8C0EA93CFB5A469042' and getPlayerSerial(localPlayer) ~= '48A8847F2FE11ACDCC0B0D3855F56902' then return end
- local veh = hit:getOccupiedVehicle(hit)
- if not veh then return end
- if not veh:getData("vehicle:id") then return end
- local owner = veh:getData("vehicle:ownedPlayer")
- if owner ~= hit:getData("player:sid") then return end
- if veh:getController() ~= hit then return end
- addEventHandler("onClientRender", root, gui)
- showCursor(true)
- showed = true
- click = 0
- end)
- function gui()
- local veh = localPlayer:getOccupiedVehicle()
- if not veh then return end
- local h = veh:getHandling()
- local m = h["mass"]
- local txt = "Za złomowanie pojazdu "..(veh:getName() or "ERROR").." o uid: "..(veh:getData("vehicle:id") or 0).."\n oraz wadze "..KGtoTB(m).." otrzymasz "..math.floor(m*100).."$"
- exports["buttons"]:createCustomWindow("Zlomowisko", screenW * 0.3604, screenH * 0.2787, screenW * 0.2792, screenH * 0.4426, tocolor(255, 255, 255, 255), false)
- exports["buttons"]:createCustomButton("Złomuj", screenW * 0.386, screenH * 0.65, screenW * 0.102, screenH * 0.044, tocolor(255, 255, 255, 255), false)
- exports["buttons"]:createCustomButton("Anuluj", screenW * 0.511, screenH * 0.65, screenW * 0.102, screenH * 0.044, tocolor(255, 255, 255, 255), false)
- exports["buttons"]:createCustomText(txt, screenW * 0.3667, screenH * 0.3454, screenW * 0.6318, screenH * 0.6296, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, true, false, false, false)
- end
- addEventHandler("onClientClick", root, function(b,s)
- if b ~= "left" or s ~= "down" then return end
- if showed ~= true then return end
- if isMouseInPosition(screenW * 0.386, screenH * 0.65, screenW * 0.102, screenH * 0.044) then
- local veh = localPlayer:getOccupiedVehicle()
- if not veh then return end
- if click == 0 then
- click = 1
- outputChatBox("Kliknij ponownie aby potwierdzić zezłomowanie pojazdu "..veh:getName())
- elseif click == 1 then
- click = 0
- showed = false
- triggerServerEvent("zlomuj", localPlayer, veh)
- removeEventHandler("onClientRender", root, gui)
- showCursor(false)
- end
- elseif isMouseInPosition(screenW * 0.511, screenH * 0.65, screenW * 0.102, screenH * 0.044) then
- removeEventHandler("onClientRender", root, gui)
- showCursor(false)
- showed = false
- click = 0
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment