Facebook
From Whipped Water Vole, 3 Years ago, written in Lua.
Embed
Download Paste or View Raw
Hits: 227
  1. local SKOCZNIA_ID=1
  2.  
  3. local screenWidth, screenHeight = guiGetScreenSize ( )
  4.  
  5. local wyskok=createColSphere(1918.07,-664.78,104.43,2)
  6.  
  7. local skok_start={x=0,y=0,z=0}
  8.  
  9. local player = getLocalPlayer()
  10.  
  11. function obliczDlugoscSkoku()
  12.         local x,y,z=getElementPosition(player)
  13.         local odleglosc= getDistanceBetweenPoints2D(x,y, skok_start.x,skok_start.y)
  14.                 local odlegloscx = string.format("%0.2f", odleglosc)           
  15.         dxDrawText(odlegloscx.." m", 0,0, screenWidth*19/20, screenHeight*12/13, tocolor(15,15,155), 2, "pricedown", "right", "bottom")
  16.         local veh=getPedOccupiedVehicle(player)
  17.         if (not veh or isVehicleOnGround(veh) or isElementInWater(veh) or isElementInWater(player)) then
  18.                 if (isVehicleOnGround(veh) or isElementInWater(veh) or isElementInWater(player)) then
  19.                         triggerServerEvent("wykonanySkok", player, tonumber(odlegloscx), SKOCZNIA_ID)
  20.                 end
  21.                 removeEventHandler ( "onClientRender", root, obliczDlugoscSkoku )
  22.         end
  23. end
  24.  
  25. addEventHandler("onClientColShapeHit",wyskok,function(hitElement,matchingDimension)
  26.         if (hitElement~=player) then return end
  27.         if (not matchingDimension or getElementDimension(hitElement)~=getElementDimension(source)) then return end
  28.         if (not isPedInVehicle(player)) then return end
  29.  
  30.         local veh=getPedOccupiedVehicle(player)
  31.                 if (getVehicleController(veh)~=player) then
  32.                                 outputChatBox("Musisz byc kierowca")
  33.                                 return
  34.                 end
  35.         if (getElementModel(veh)~=468) then
  36.                 outputChatBox("Skakac nalezy tylko sanchezem!")
  37.                 return
  38.         end
  39.  
  40.         skok_start.x,skok_start.y,skok_start.z=getElementPosition(player)
  41.  
  42.         addEventHandler ( "onClientRender", root, obliczDlugoscSkoku )
  43.  
  44. end)