Jump to content

Car Number or CarID


MasterTobi

Recommended Posts

Hey

i have two Teams (Team1 and Team2). Everyone of these Team is reported to have a NRG.

But, Team1 is not permitted to drive the NRG from Team2 and Team2 is not permitted to drive the NRG from Team1.

one can make one beside the vehicle ID carid ? also Vehicle ID = 454 and carid = 1 ?

thx

Tobi

Link to comment

MTA uses elements.

theVehicle=createVehicle(432,0,0,5) -- We create a vehicle, and save it in variable theVehicle 
outputChatBox(getVehicleName(theVehicle)) -- We'll output the vehicle's name, for pointless reasons 

However, you can use setElementData on a vehicle to set an "ID" field for instance. Or you can use setElementID, even easier. :D

But I'll try to help you out on this one. You might want to use:

- createVehicle (how else do you expect to create it, beside a map)

- setElementID, setElementData or anything that might help

- onVehicleStartEnter to check for the player's team and compare it with the team required to get onto it. If the team not is the same, then you can do cancelEvent()

How to do it:

Create a function that creates vehicles for teams. In it, you should do createVehicle, set element data (setElementData) to the team element (made with createTeam I guess?), and then use addEventHandler together with onVehicleStartEnter to check for the team.

If you have problems with anything, feel free to ask.

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...