Scripting Moderators ds1-e Posted March 5, 2019 Scripting Moderators Share Posted March 5, 2019 Hey. I need to disable hit animation whenever player get shooted by sniper. How can i do it? Link to comment
Moderators IIYAMA Posted March 5, 2019 Moderators Share Posted March 5, 2019 You could try to cancel the damage + set the health manually. (Only if the remaining health is not 0) https://wiki.multitheftauto.com/wiki/OnClientPlayerDamage Not sure if it will work, but good luck. 1 Link to comment
Scripting Moderators ds1-e Posted March 5, 2019 Author Scripting Moderators Share Posted March 5, 2019 22 minutes ago, IIYAMA said: You could try to cancel the damage + set the health manually. (Only if the remaining health is not 0) https://wiki.multitheftauto.com/wiki/OnClientPlayerDamage Not sure if it will work, but good luck. It's already canceled. 1 Link to comment
Moderators IIYAMA Posted March 5, 2019 Moderators Share Posted March 5, 2019 8 minutes ago, majqq said: It's already canceled. Ah that is a petty I do not think there are much options left. Except if the player is `standing still` and `doing nothing`. local x, y, z = getElementPosition(localPlayer) setElementPosition(localPlayer, x, y, z, true) -- warp argument is by default `true` but just so you know that it is doing something ... Optional Arguments warp: teleports players, resetting any animations they were doing. Setting this to false preserves the current animation. https://wiki.multitheftauto.com/wiki/SetElementPosition Link to comment
Scripting Moderators ds1-e Posted March 31, 2019 Author Scripting Moderators Share Posted March 31, 2019 On 05/03/2019 at 18:36, IIYAMA said: Ah that is a petty I do not think there are much options left. Except if the player is `standing still` and `doing nothing`. local x, y, z = getElementPosition(localPlayer) setElementPosition(localPlayer, x, y, z, true) -- warp argument is by default `true` but just so you know that it is doing something ... Optional Arguments warp: teleports players, resetting any animations they were doing. Setting this to false preserves the current animation. https://wiki.multitheftauto.com/wiki/SetElementPosition Hmm what do u think about finding block and name of this animation, and then make a check onClientPlayerDamage if player got this animation resets it? Shouldn't it work? 1 Link to comment
Moderators IIYAMA Posted March 31, 2019 Moderators Share Posted March 31, 2019 (edited) 1 hour ago, majqq said: Hmm what do u think about finding block and name of this animation, and then make a check onClientPlayerDamage if player got this animation resets it? Shouldn't it work? Might be possible, as long as it is detected by MTA. Not all animations are for some unknown reason detected. Just test it! Edited March 31, 2019 by IIYAMA 1 Link to comment
Scripting Moderators ds1-e Posted May 29, 2020 Author Scripting Moderators Share Posted May 29, 2020 On 31/03/2019 at 13:59, IIYAMA said: Might be possible, as long as it is detected by MTA. Not all animations are for some unknown reason detected. Just test it! Hi. I've just found out that it's a task. Is there any way to disable it? It cause some hits to not confirm. Link to comment
Moderators IIYAMA Posted May 29, 2020 Moderators Share Posted May 29, 2020 (edited) 36 minutes ago, majqq said: Hi. I've just found out that it's a task. Is there any way to disable it? It cause some hits to not confirm. You mean that there is no damage given? If that is the case: You could maybe use: https://wiki.multitheftauto.com/wiki/OnClientPlayerWeaponFire to save the latest player shot and set that as attacker. (with some tricks) Edited May 29, 2020 by IIYAMA Link to comment
Scripting Moderators ds1-e Posted May 29, 2020 Author Scripting Moderators Share Posted May 29, 2020 (edited) 13 minutes ago, IIYAMA said: You mean that there is no damage given? Either there is no damage, body part is invalid (unknown) or hit counts but damage doesn't. Test code: local vHits = 0 local tMuzzle = {} local vParts = { [3] = "Torso", [4] = "Ass", [5] = "Left arm", [6] = "Right arm", [7] = "Left leg", [8] = "Right leg", [9] = "Head", } function onClientPlayerWeaponFire(pWeapon, pAmmo, pAmmoInClip, pHitX, pHitY, pHitZ, pHitElement, pStartX, pStartY, pStartZ) if not pHitElement then return end local vStartX, vStartY, vStartZ = getPedWeaponMuzzlePosition(source) local vCol = {processLineOfSight(pStartX, pStartY, pStartZ, pHitX, pHitY, pHitZ, true, true, true, true, false, true, true, false, nil, false, false)} local vHitPart = vParts[vCol[11]] or "UNKNOWN" tMuzzle = {pStartX, pStartY, pStartZ, pHitX, pHitY, pHitZ} vHits = vHits + 1 outputChatBox("[HIT #"..vHits.."]: X, Y, Z: "..pHitX..", "..pHitY..", "..pHitZ.." | Hit element: "..tostring(pHitElement).." | Hit bodypart: "..vHitPart) end addEventHandler("onClientPlayerWeaponFire", root, onClientPlayerWeaponFire) -- function onClientPlayerDamage() outputChatBox("Damage confirmed at hit: "..vHits) end addEventHandler("onClientPlayerDamage", root, onClientPlayerDamage) -- function onClientRender() if #tMuzzle == 6 then dxDrawLine3D(tMuzzle[1], tMuzzle[2], tMuzzle[3], tMuzzle[4], tMuzzle[5], tMuzzle[6], tocolor(200, 0, 0, 255), 3) end end addEventHandler("onClientRender", root, onClientRender) On screen below, there was no collision check. But hits #6, #7 confirmed that element got hit, but no damage was given. (don't mind bodypart, there was no collision check on it) Edited May 29, 2020 by majqq Link to comment
Moderators IIYAMA Posted May 29, 2020 Moderators Share Posted May 29, 2020 11 minutes ago, majqq said: Either there is no damage, body part is invalid (unknown) or hit counts but damage doesn't. Also without mods? There are some mods that do have some collision issues. Link to comment
Scripting Moderators ds1-e Posted May 29, 2020 Author Scripting Moderators Share Posted May 29, 2020 9 minutes ago, IIYAMA said: Also without mods? There are some mods that do have some collision issues. I don't think it's a mods issue, i remember that i had similiar case on tactics gamemode. Tested it without replaced models and seems like it's the same. Link to comment
Moderators IIYAMA Posted May 30, 2020 Moderators Share Posted May 30, 2020 18 hours ago, majqq said: On screen below, there was no collision check. But hits #6, #7 confirmed that element got hit, but no damage was given. (don't mind bodypart, there was no collision check on it) When that occurs, what was the loss value? Link to comment
Scripting Moderators ds1-e Posted May 31, 2020 Author Scripting Moderators Share Posted May 31, 2020 18 hours ago, IIYAMA said: When that occurs, what was the loss value? 41. It's same w/out stun animation. Link to comment
Moderators IIYAMA Posted May 31, 2020 Moderators Share Posted May 31, 2020 (edited) 2 hours ago, majqq said: 41. It's same w/out stun animation. If the health loss isn't subtracted, you will be able to detect the issue with the pre-event: https://wiki.multitheftauto.com/wiki/OnClientPlayerWeaponFire Since the health didn't change. + getTickCount to check if the damage is done within the same frame. And maybe include the ped task as well for validation. Edited May 31, 2020 by IIYAMA 1 Link to comment
Scripting Moderators ds1-e Posted October 17, 2020 Author Scripting Moderators Share Posted October 17, 2020 (edited) @IIYAMA I've looked into it again probably realised why there's a lot of non-confirmed hits. Apparently, there's some delay before bullet will hit player. Do you think scripting dealing damage via onClientPlayerWeaponFire + processLineOfSight will work out? Damage would be handled by victim. I'm curious, because i do not have opportunity to test it, and would like to know what you think about it. Edited October 17, 2020 by majqq Link to comment
Moderators IIYAMA Posted October 18, 2020 Moderators Share Posted October 18, 2020 (edited) 12 hours ago, majqq said: @IIYAMA I've looked into it again probably realised why there's a lot of non-confirmed hits. Apparently, there's some delay before bullet will hit player. Do you think scripting dealing damage via onClientPlayerWeaponFire + processLineOfSight will work out? Damage would be handled by victim. I'm curious, because i do not have opportunity to test it, and would like to know what you think about it. Well, yes it worked in the past for me. There were a few issues with transparent/shoot through element components. Like the watch towers in area69. Those banister were blocking the line, while the arguments were set correctly. Not sure if they fixed that by now. @majqq I can send you another script, which was an experimental serverside bullet detection. It does use processLineOfSight, but not for player hit detection. Just mapping the end point of the bullet. Instead it compares the bone position of the ped VS the line. Which means you can also hit feed and hands (which normally does not have collision). Do you want to take a look at that for inspiration or use it like it is? (the code is a monstrosity by the way... sorry ) Edited October 18, 2020 by IIYAMA 1 Link to comment
Scripting Moderators ds1-e Posted October 18, 2020 Author Scripting Moderators Share Posted October 18, 2020 2 hours ago, IIYAMA said: Well, yes it worked in the past for me. There were a few issues with transparent/shoot through element components. Like the watch towers in area69. Those banister were blocking the line, while the arguments were set correctly. Not sure if they fixed that by now. @majqq I can send you another script, which was an experimental serverside bullet detection. It does use processLineOfSight, but not for player hit detection. Just mapping the end point of the bullet. Instead it compares the bone position of the ped VS the line. Which means you can also hit feed and hands (which normally does not have collision). Do you want to take a look at that for inspiration or use it like it is? (the code is a monstrosity by the way... sorry ) Why not, probably won't use it, but would be nice to look at it. 1 Link to comment
Scripting Moderators ds1-e Posted October 26, 2020 Author Scripting Moderators Share Posted October 26, 2020 On topic: Just for anyone wondering, i solved that by using cancelEvent() in onClientPlayerDamage attached to root (had already existing handler, but just for localPlayer). 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