patriot Posted December 22, 2012 Share Posted December 22, 2012 Hi, I'd like to know if there is any way to detect whether the vehicle is getting shot at it's front or rear side, or anything that can help me. (Generally, I want to detect if the vehicle's engine is getting shot at) Thanks. Link to comment
DiSaMe Posted December 22, 2012 Share Posted December 22, 2012 You can detect the shots using onClientPlayerWeaponFire and onClientPedWeaponFire and cheking the hitElement argument. Link to comment
50p Posted December 22, 2012 Share Posted December 22, 2012 https://wiki.multitheftauto.com/wiki/OnC ... eCollision Link to comment
patriot Posted December 22, 2012 Author Share Posted December 22, 2012 https://wiki.multitheftauto.com/wiki/OnClientVehicleCollision Alright, though I am not sure how to check if it hits the engine (mainly the front) area of the vehicle. I'd really appriciate your help! Link to comment
50p Posted December 22, 2012 Share Posted December 22, 2012 You can debug the event and check the "bodypart". I'm not sure if this will be part of the ped's or vehicle's body. If it works with vehicles too then you don't need anything else but if it works with peds only then you'll need to calculate angle of where you got hit with the collisionX/Y/Z and current vehicle's position. You can use findRotation to help you a little. https://wiki.multitheftauto.com/wiki/FindRotation Link to comment
patriot Posted December 22, 2012 Author Share Posted December 22, 2012 I've got to another idea: Attatching a hidden object to the front side of each vehicle model, then checking if it gets hit (or nearly hit, by distance) Is this possible? If yes, what functions and events would help in this case? Thanks! To make this clear, I want to check when player shoots at any vehicles' bonnet (hood) Link to comment
50p Posted December 22, 2012 Share Posted December 22, 2012 As far as I know there is no event for objects attached to other elements since they don't have collision when attached. I might be wrong. You can try: https://wiki.multitheftauto.com/wiki/OnC ... WeaponFire and check if the hitElement is the attached object or vehicle. Link to comment
DiSaMe Posted December 22, 2012 Share Posted December 22, 2012 When the player or ped shoots the vehicle, use this function: processLineOfSight It lets you know the part of the vehicle which is hit first by the line of sight. Link to comment
patriot Posted December 22, 2012 Author Share Posted December 22, 2012 When the player or ped shoots the vehicle, use this function: processLineOfSight It lets you know the part of the vehicle which is hit first by the line of sight. Great! How do I freeze vehicle's engine health when it doesn't get hit in the hood? We already got the way to check whether the hood was hit or not; but is this possible to freeze engine's health without preventing the vehicles frame (inc. tires) from being damaged? Link to comment
Castillo Posted December 22, 2012 Share Posted December 22, 2012 You can set it damage proof with: setVehicleDamageProof Link to comment
patriot Posted December 22, 2012 Author Share Posted December 22, 2012 If I set damage proof to true, am I still able to blow the vehicle's tires, for example? My goal is only to set the engine health damageproof. Link to comment
Castillo Posted December 22, 2012 Share Posted December 22, 2012 I'm not sure, but you can go and try to blow the tires with damage proof enabled. 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