local SKOCZNIA_ID=1 local screenWidth, screenHeight = guiGetScreenSize ( ) local wyskok=createColSphere(1918.07,-664.78,104.43,2) local skok_start={x=0,y=0,z=0} local player = getLocalPlayer() function obliczDlugoscSkoku() local x,y,z=getElementPosition(player) local odleglosc= getDistanceBetweenPoints2D(x,y, skok_start.x,skok_start.y) local odlegloscx = string.format("%0.2f", odleglosc) dxDrawText(odlegloscx.." m", 0,0, screenWidth*19/20, screenHeight*12/13, tocolor(15,15,155), 2, "pricedown", "right", "bottom") local veh=getPedOccupiedVehicle(player) if (not veh or isVehicleOnGround(veh) or isElementInWater(veh) or isElementInWater(player)) then if (isVehicleOnGround(veh) or isElementInWater(veh) or isElementInWater(player)) then triggerServerEvent("wykonanySkok", player, tonumber(odlegloscx), SKOCZNIA_ID) end removeEventHandler ( "onClientRender", root, obliczDlugoscSkoku ) end end addEventHandler("onClientColShapeHit",wyskok,function(hitElement,matchingDimension) if (hitElement~=player) then return end if (not matchingDimension or getElementDimension(hitElement)~=getElementDimension(source)) then return end if (not isPedInVehicle(player)) then return end local veh=getPedOccupiedVehicle(player) if (getVehicleController(veh)~=player) then outputChatBox("Musisz byc kierowca") return end if (getElementModel(veh)~=468) then outputChatBox("Skakac nalezy tylko sanchezem!") return end skok_start.x,skok_start.y,skok_start.z=getElementPosition(player) addEventHandler ( "onClientRender", root, obliczDlugoscSkoku ) end)