Rafax7 Posted November 9, 2021 Share Posted November 9, 2021 I was trying to make an example vehicle shield script: When a person passes the Marker and is in an ACL chosen by me, typing a command would armor their car. but could not help me? Link to comment
The_GTA Posted November 9, 2021 Share Posted November 9, 2021 (edited) Hello Rafax7, I suggest you to look at the following MTA functionality: onMarkerHit event createMarker function hasObjectPermissionTo function setVehicleDamageProof function setElementData / getElementData functions addCommandHandler function getPedOccupiedVehicle function 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 November 9, 2021 by The_GTA 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