Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. ---------------
  2. -- Author:  Disinterpreter
  3. -- License: Prorpietary software
  4. -- Copyright:   (c) 2014
  5. -- Script:  TougeTeam Warning Speed
  6. ---------------
  7. bState = true
  8. aCars = {420,560}
  9. function getVehicleSpeed()
  10.     if isPedInVehicle(localPlayer) then
  11.         local vx, vy, vz = getElementVelocity(getPedOccupiedVehicle(localPlayer))
  12.         return math.sqrt(vx^2 + vy^2 + vz^2) * 161
  13.     end
  14.     return 0
  15. end
  16.  
  17. addEventHandler("onClientRender", root,
  18.     function()
  19.         local pVehicle = getPedOccupiedVehicle(localPlayer);
  20.         if pVehicle and isElement( pVehicle ) then
  21.             for _,v in pairs (aCars) do
  22.                 local iModel = getElementModel(pVehicle)
  23.                 if (v == iModel) and (getVehicleSpeed() >= 100)
  24.                 then
  25.                     if bState == true then
  26.                         sound = playSound("sound.mp3", true)
  27.                         bState = false
  28.                     end
  29.                 end
  30.                 if (v == iModel) and (getVehicleSpeed() <= 100)
  31.                 then
  32.                     if bState == false then
  33.                         stopSound(sound)
  34.                         bState = true
  35.                     end
  36.                 end
  37.             end
  38.         end
  39.     end
  40. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement