Jump to content

I need help with vehicle armor.


Rafax7

Recommended Posts

Hello Rafax7,

I suggest you to look at the following MTA functionality:

First create a marker on the game world (createMarker could help). Then assign an event handler to the onMarkerHit event with the marker as base-element. Inside of said event handler check if the hitElement argument is a player element. If the hitElement is a player then perform a check using hasObjectPermissionTo on the hitElement for the "vehicleShield" permission. If both checks were successful, then set the element data "applicableVehicleShield" of the hitElement to true.

After the event handler registration we put a command-handler for the "vehshield" command. Inside of that command-handler we check that the player who typed that command has the "applicableVehicleShield" element data set to true. Then we get the vehicle of the player. If there is a vehicle then we set it damage proof.

It is possible to armor the car if the player enters a car after hitting the marker. It could be possible to armor the car where the player is not the driver. It is possible that allowances for vehicle damage proof applications carry-over across resource stop-and-start. Preventing these scenarios would require additional checks (exercise left for the reader).

Good luck! ?

Edited by The_GTA
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...