AnnaBelle Posted April 13, 2017 Share Posted April 13, 2017 local screenX, screenY local drawTimer local isDrawing = false local sound function drawHitMarker() dxDrawImage(screenX-16,screenY-16,32,32,"hitmarker.png") end addEventHandler("onClientPlayerWeaponFire",localPlayer, function(weapon,ammo,ammoInClip,hitX,hitY,hitZ,hitElement) if hitElement then if getElementType(hitElement)== "vehicle" or getElementType(hitElement)== "player" 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) addEventHandler("onClientPlayerDamage",getLocalPlayer(),function() 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) I explain ... when I shoot it runs "onClientPlayerWeaponFire" And if that bullet hits a ped, user or auto it generates this image at the point of impact " dxDrawImage(screenX-16, screenY-16, 32, 32, "hitmarker.png")" There is a problem with ping. I can shoot you but you do not get the bullet, the script does not verify that, what I want is that something like an IF asks you if you received damage before Which generates the image ... osea syncronize the 2 parts. This because in users occasions they shoot others and when they see the X they think that they did and it is not true then they complain of hack or abuse. Link to comment
Mr.Loki Posted April 13, 2017 Share Posted April 13, 2017 Latency is the biggest problem for hitmarkers in mta lol onClientPlayerDamage trigger an event towards the attacker to show the hitmarker Link to comment
Einheit-101 Posted April 14, 2017 Share Posted April 14, 2017 Or calculate damage client side because otherwise the shot sync of MTA is so tremendously bad that you better dont even start a server which is about shooting players. 1 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