Nelsonnn

Untitled

Oct 30th, 2018
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.85 KB | None | 0 0
  1. function addAddonInfo ( name, description )
  2.     return call ( getResourceFromName( "DayZ" ), "addAddonInfo", name, description )
  3. end
  4.  
  5. addAddonInfo ( "HITMARK", "" )
  6. ---------
  7.  
  8. local screenX, screenY
  9. local screenZ, screenB
  10. local drawTimer
  11. local isDrawing
  12. local sound
  13.  
  14. function drawHitMarker()
  15.     dxDrawImage(screenX-16, screenY-16, 32, 32, "hitmarker.png")
  16.     dxDrawImage(screenZ-16, screenB-16, 32, 32, "hitmarker2.png")
  17.     end
  18.    
  19. end
  20.  
  21. function fireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement)
  22.     if hitElement then
  23.             if getElementType(hitElement)=="player" or getElementType(hitElement)=="ped" then
  24.         screenX, screenY = getScreenFromWorldPosition(hitX, hitY, hitZ)
  25.         end
  26.         if getElementType(hitElement)=="vehicle" then
  27.         screenZ, screenB = getScreenFromWorldPosition(hitX, hitY, hitZ)
  28.         if not screenX then return end
  29.         if not screenZ then return end
  30.         if isDrawing then return end
  31.         isDrawing = true
  32.        
  33.         local sound = playSound("hitmarker-sound.wav")
  34.         setSoundVolume( sound , 1)
  35.    
  36.    
  37.         addEventHandler("onClientRender", root, drawHitMarker)
  38.         if drawTimer and isTimer(drawTimer) then
  39.             killTimer(drawTimer)
  40.         end
  41.        
  42.        
  43.         drawTimer = setTimer(function()
  44.             isDrawing = false
  45.             removeEventHandler("onClientRender", root, drawHitMarker)
  46.         end, 500, 1)
  47.     end
  48.     end
  49. end--func
  50. addEventHandler("onClientPlayerWeaponFire", localPlayer, fireFunc)
  51.  
  52.  
  53.  
  54. function get_hit()
  55.             fadeCamera(false,1,255,0,0)
  56.             local hit_sound=playSound("hitmarker-sound.wav")
  57.             setSoundVolume(hit_sound,0.5)
  58.         function cam()
  59.             fadeCamera(true,1)
  60.         end
  61.         setTimer(cam,150,1)
  62. end
  63.  
  64.  
  65. addEventHandler("onClientPlayerDamage",getLocalPlayer(),get_hit)
Advertisement
Add Comment
Please, Sign In to add comment