Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local cols = {
- [1] = {
- {2046.4508056641,1552.8034667969,10.671875,8}, -- 90km/h
- },
- [2] = {
- {2046.8505859375,1591.9591064453,10.671875,4} -- 120km/h
- },
- [3] = {
- {2047.2889404297,1619.2237548828,10.671875,2} -- 30km/h
- }
- }
- local model = {
- [1] = {2057.4448242188,1523.0300292969,10.940486907959}
- }
- addEventHandler("onResourceStart", resourceRoot,
- function ()
- for id, datas in pairs(cols) do
- for _, values in pairs(datas) do
- local x, y, z, r = unpack(values)
- local col = createColSphere(x, y, z-1, r)
- setElementData(col, "col.id", id)
- end
- end
- for k, v in pairs(model) do
- local x, y, z = unpack(v)
- local model = createObject(1214, x, y, z-1)
- setElementFrozen(model, true)
- end
- end
- )
- addEvent("policeWrite", true)
- addEventHandler("policeWrite", root,
- function()
- local car = getPedOccupiedVehicle(client)
- local name = getVehicleName(car)
- local c1, c2, c3, c4 = getVehicleColor(car, false)
- local teszt = RGBToHex(c1, c2, c3, c4)
- outputChatBox(teszt)
- outputChatBox("#DE8226[Rendőrség]:#FFFFFFKocsi:#ABA7A2"..name.. "#FFFFFF|".."#FFFFFFSzíne: Szín1", getRootElement(), _, _, _, true)
- end
- )
- addEvent("removePay", true)
- addEventHandler("removePay", root,
- function ()
- setPlayerMoney(source, getPlayerMoney(client) - 650)
- end
- )
- function RGBToHex(red, green, blue, alpha)
- -- Make sure RGB values passed to this function are correct
- if( ( red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 ) or ( alpha and ( alpha < 0 or alpha > 255 ) ) ) then
- return nil
- end
- -- Alpha check
- if alpha then
- return string.format("#%.2X%.2X%.2X%.2X", red, green, blue, alpha)
- else
- return string.format("#%.2X%.2X%.2X", red, green, blue)
- end
- end
- Itt a kliens:
- --készítette:nszabol3--
- defendVeh = {
- [1] = {
- {510}, -- Mountan Bike
- {481}, -- BMX
- {508}, -- Bike
- {596}, -- Polcie
- {598}, -- Police
- {599}, -- Police
- {597}, -- Police
- }
- }
- for k, v in pairs(defendVeh) do
- teszt = unpack(v)
- end
- addEventHandler("onClientColShapeHit", root,
- function(element, dimension)
- if element == localPlayer then
- if dimension then
- local veh = getPedOccupiedVehicle(element)
- if veh then
- local car1 = getElementModel(veh)
- triggerServerEvent("policeWrite", root)
- if car1 ~= teszt then
- triggerServerEvent("removePay", root)
- if (getElementData(source, "col.id") == 1) then
- if getElementSpeed(veh) > 2 then
- outputChatBox("#DE8226[Rendőrség]: #FFFFFFGyorsabban mentél mint #ABA7A290km/h. #FFFFFFBüntetésed:#ABA7A2650$", _, _, _, true)
- end
- else
- if (getElementData(source, "col.id") == 2) then
- if getElementSpeed(veh) > 2 then
- outputChatBox("#DE8226[Rendőrség]: #FFFFFFGyorsabban mentél mint #ABA7A2120km/h. #FFFFFFBüntetésed:#ABA7A2650$", _, _, _, true)
- end
- else
- if (getElementData(source, "col.id") == 3) then
- if getElementSpeed(veh) > 2 then
- outputChatBox("#DE8226[Rendőrség]: #FFFFFFGyorsabban mentél mint #ABA7A230km/h. #FFFFFFBüntetésed:#ABA7A2650$", _, _, _, true)
- end
- end
- end
- end
- end
- end
- end
- end
- end
- )
- ----- usefule function -----------
- function getElementSpeed(theElement, unit)
- -- Check arguments for errors
- assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")")
- local elementType = getElementType(theElement)
- assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")")
- assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)")
- -- Default to m/s if no unit specified and 'ignore' argument type if the string contains a number
- unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit))
- -- Setup our multiplier to convert the velocity to the specified unit
- local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456)
- -- Return the speed by calculating the length of the velocity vector, after converting the velocity to the specified unit
- return (Vector3(getElementVelocity(theElement)) * mult).length
- end
- local sx, sy = guiGetScreenSize()
- local relX, relY = sx/1920, sy/1080
- addEventHandler("onClientRender", root,
- function ()
- local veh = getPedOccupiedVehicle(localPlayer)
- if veh then
- local vehS = getElementSpeed(veh)
- dxDrawText(vehS, sx*(0.85), sy*(0.098), sx*0.99, sy*0.19, tocolor(255, 255, 255, 255), relX*2.1, relY*2.2, "sans", "left", "center", false, false, false )
- end
- end
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement