matheus_vieira23 Posted March 21, 2023 Share Posted March 21, 2023 I have a script made to show the hitmark but it shows in full body. How do I leave it only when I hit HS? Link to comment
FLUSHBICEPS Posted March 23, 2023 Share Posted March 23, 2023 you will need to modify your script to detect when there’s a headshot hit it can be done using onClientPlayerDamage event function hitmark(attacker, weapon, bodypart, loss) if (bodypart == 9) then -- 9 represents the head -- Show headshot hitmark end end addEventHandler("onClientPlayerDamage", localPlayer, hitmark) Link to comment
matheus_vieira23 Posted March 23, 2023 Author Share Posted March 23, 2023 (edited) ---------------------------------------------------------------------- ------- Script: ------------- Visit: --------------- Made in ------- ------- 7rust-Dev ---------7rust.bplaced.de----------- GERMANY ------- ---------------------------------------------------------------------- local screenX, screenY local drawTimer local isDrawing local sound function drawHitMarker() dxDrawImage(screenX-16, screenY-16, 32, 32, "hitmarker.png") end function fireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) if hitElement then if getElementType(hitElement)=="player" or getElementType(hitElement)=="ped" or getElementType(hitElement)=="vehicle" then screenX, screenY = getScreenFromWorldPosition(hitX, hitY, hitZ) if not screenX then return end if isDrawing then return end isDrawing = true local sound = playSound("hitmarker-sound.wav") setSoundVolume( sound , 1) addEventHandler("onClientRender", root, drawHitMarker) if drawTimer and isTimer(drawTimer) then killTimer(drawTimer) end drawTimer = setTimer(function() isDrawing = false removeEventHandler("onClientRender", root, drawHitMarker) end, 500, 1) end end end--func addEventHandler("onClientPlayerWeaponFire", localPlayer, fireFunc) ---------------------------------------------------------------------- ------- Script: ------------- Visit: --------------- Made in ------- ------- 7rust-Dev ---------7rust.bplaced.de----------- GERMANY ------- ---------------------------------------------------------------------- function get_hit() fadeCamera(false,1,255,0,0) local hit_sound=playSound("hitmarker-sound.wav") setSoundVolume(hit_sound,0.5) function cam() fadeCamera(true,1) end setTimer(cam,150,1) end function hitmark(attacker, weapon, bodypart, loss) if (bodypart == 9) then -- 9 represents the head -- Show headshot hitmark end end addEventHandler("onClientPlayerDamage", localPlayer, hitmark) ---------------------------------------------------------------------- ------- Script: ------------- Visit: --------------- Made in ------- ------- 7rust-Dev ---------7rust.bplaced.de----------- GERMANY ------- ---------------------------------------------------------------------- Edited March 23, 2023 by groove7 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now