Fist Posted November 16, 2017 Share Posted November 16, 2017 (edited) Is there a way to block a grenade or any other explosion on other side of the wall if it's near to blow/damage anything besides the wall? I saw it a long time ago on 1 server, but never realized how i can make it nor i can find anything on forums about this. Edited November 16, 2017 by Fist Link to comment
Tails Posted November 16, 2017 Share Posted November 16, 2017 (edited) You can put a process line between the player and the explosion and check for collisions https://wiki.multitheftauto.com/wiki/IsLineOfSightClear Edited November 16, 2017 by Tails Link to comment
Fist Posted November 16, 2017 Author Share Posted November 16, 2017 31 minutes ago, Tails said: You can put a process line between the player and the explosion and check for collisions https://wiki.multitheftauto.com/wiki/IsLineOfSightClear ok that makes sense. Link to comment
Moderators IIYAMA Posted November 16, 2017 Moderators Share Posted November 16, 2017 (edited) Possible way to cancel damage and still see the effect. https://wiki.multitheftauto.com/wiki/OnClientExplosion https://wiki.multitheftauto.com/wiki/CreateExplosion Might cause a little temporary desync with other players. (If you cancel the event and other players are near you.) If you saw this at the server from bigbadbutler (chaos.de), then you have to know that he used custom health instead of normal health which is a very different approach. Edited November 16, 2017 by IIYAMA Link to comment
Fist Posted November 17, 2017 Author Share Posted November 17, 2017 27 minutes ago, IIYAMA said: Possible way to cancel damage and still see the effect. https://wiki.multitheftauto.com/wiki/OnClientExplosion https://wiki.multitheftauto.com/wiki/CreateExplosion Might cause a little temporary desync with other players. (If you cancel the event and other players are near you.) If you saw this at the server from bigbadbutler (chaos.de), then you have to know that he used custom health instead of normal health which is a very different approach. addEventHandler("onClientExplosion",root,function(x,y,z,type) if getElementType(source) == "vehicle" or getElementType(source) == "player" or getElementType(source) == "ped" then local tX,tY,tZ = getElementPosition(source); if not isLineOfSightClear(x,y,z,tX,tY,tZ,true,false,false,true) then cancelEvent(); end end end); funny is that when it cancels it, it just deletes grenade or explosion before it explodes but when someone else is near that is in sight it still explodes and even those that are not in sight but are near explosion still explodes. 1 Link to comment
Moderators IIYAMA Posted November 17, 2017 Moderators Share Posted November 17, 2017 (edited) yea, true Explosions are forced to be sync. Last thing: (clientside only) bool createExplosion ( float x, float y, float z, int theType [, bool makeSound = true, float camShake = -1.0, bool damaging = true ] ) Set damaging to false after recreation. P.s. car explosions might look different. Edited November 17, 2017 by IIYAMA 1 Link to comment
Fist Posted November 17, 2017 Author Share Posted November 17, 2017 2 minutes ago, IIYAMA said: yea, true Explosions are forced to be sync. Last thing: (clientside only) bool createExplosion ( float x, float y, float z, int theType [, bool makeSound = true, float camShake = -1.0, bool damaging = true ] ) Set damaging to false after recreation. P.s. car explosions might look different. i actually found better way doing this. addEventHandler("onClientVehicleDamage",root,function(attacker,wep,loss,x,y,z,tyreid) if (wep == 63 or wep == 51 or wep == 19) then cancelEvent(); local aX,aY,aZ = getElementPosition(attacker); local tX,tY,tZ = getElementPosition(source); iprint(isLineOfSightClear(tX,tY,tZ,aX,aY,aZ,true,false,false,true),aX,aY,aZ,tX,tY,tZ) if isLineOfSightClear(tX,tY,tZ,aX,aY,aZ,true,false,false,true) then blowVehicle(source,true); end end end); had to cancel event first though, otherwise it's already too late to cancel it after you checked if line of sight is clear. 1 Link to comment
Moderators IIYAMA Posted November 17, 2017 Moderators Share Posted November 17, 2017 (edited) Quote had to cancel event first though, otherwise it's already too late to cancel it after you checked if line of sight is clear. You sure? Because isLineOfSignClear does not require a callback. addEventHandler("onClientVehicleDamage",root,function(attacker,wep,loss,x,y,z,tyreid) if (wep == 63 or wep == 51 or wep == 19) then local aX,aY,aZ = getElementPosition(attacker); local tX,tY,tZ = getElementPosition(source); iprint(isLineOfSightClear(tX,tY,tZ,aX,aY,aZ,true,false,false,true),aX,aY,aZ,tX,tY,tZ) if not isLineOfSightClear(tX,tY,tZ,aX,aY,aZ,true,false,false,true) then cancelEvent(); end end end); blowVehicle does not support the second argument clientside, only serverside. And I wouldn't recommend it to do it clientside because of desync. Edited November 17, 2017 by IIYAMA Link to comment
Fist Posted November 17, 2017 Author Share Posted November 17, 2017 1 minute ago, IIYAMA said: You sure? Because isLineOfSignClear does not require a callback. addEventHandler("onClientVehicleDamage",root,function(attacker,wep,loss,x,y,z,tyreid) if (wep == 63 or wep == 51 or wep == 19) then local aX,aY,aZ = getElementPosition(attacker); local tX,tY,tZ = getElementPosition(source); iprint(isLineOfSightClear(tX,tY,tZ,aX,aY,aZ,true,false,false,true),aX,aY,aZ,tX,tY,tZ) if not isLineOfSightClear(tX,tY,tZ,aX,aY,aZ,true,false,false,true) then cancelEvent(); end end end); blowVehicle does not support the second argument clientside, only serverside. And I wouldn't recommend it to do it clientside because of desync. i'm sure, it didn't work if you cancel it afer you check line of sight. Syncing seems fine with blowVehicle on client side, i even reconnected and vehicle stayed destroyed. 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