Nelsonnn

Untitled

Oct 31st, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.92 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 drawTimer
  10. local isDrawing
  11. local sound
  12.  
  13. function drawHitMarker()
  14.     dxDrawImage(screenX-16, screenY-16, 32, 32, "hitmarker.png")
  15.    
  16. end
  17.  
  18. function fireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement)
  19.     if hitElement then
  20.             if getElementType(hitElement)=="player" or getElementType(hitElement)=="ped" or getElementType(hitElement)=="vehicle" then
  21.         screenX, screenY = getScreenFromWorldPosition(hitX, hitY, hitZ)
  22.         if not screenX then return end
  23.         if isDrawing then return end
  24.         isDrawing = true
  25.        
  26.         local sound = playSound("hitmarker-sound.wav")
  27.         setSoundVolume( sound , 1)
  28.    
  29.    
  30.         addEventHandler("onClientRender", root, drawHitMarker)
  31.         if drawTimer and isTimer(drawTimer) then
  32.             killTimer(drawTimer)
  33.         end
  34.        
  35.        
  36.         drawTimer = setTimer(function()
  37.             isDrawing = false
  38.             removeEventHandler("onClientRender", root, drawHitMarker)
  39.         end, 500, 1)
  40.     end
  41.     end
  42. end--func
  43. addEventHandler("onClientPlayerWeaponFire", localPlayer, fireFunc)
  44.  
  45. ----------------------------------------------------------------------
  46. -------  Script:  ------------- Visit: --------------- Made in -------
  47. ------- 7rust-Dev ---------7rust.bplaced.de----------- GERMANY -------
  48. ----------------------------------------------------------------------
  49.  
  50. function get_hit()
  51.             fadeCamera(false,1,255,0,0)
  52.             local hit_sound=playSound("hitmarker-sound.wav")
  53.             setSoundVolume(hit_sound,0.5)
  54.         function cam()
  55.             fadeCamera(true,1)
  56.         end
  57.         setTimer(cam,150,1)
  58. end
  59.  
  60.  
  61. addEventHandler("onClientPlayerDamage",getLocalPlayer(),get_hit)
Advertisement
Add Comment
Please, Sign In to add comment