Vehicle::Vehicle: Difference between revisions
(→Syntax) |
CocaColaBear (talk | contribs) No edit summary |
||
| Line 2: | Line 2: | ||
== Syntax == | == Syntax == | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
let vehicle = mp.vehicles.new(Number modelHash, Vector3 position) | let vehicle = mp.vehicles.new(Number modelHash, Vector3 position [, Number dimension = 0]) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 07:44, 15 April 2017
This function creates the vehicle.
Syntax
let vehicle = mp.vehicles.new(Number modelHash, Vector3 position [, Number dimension = 0])
Example
This example creates the vehicle from name.
mp.events.add('playerCommand', (player, cmd) => {
let arr = cmd.split(' ');
if (arr[0] == 'veh') {
if (!arr[1]) {
return player.outputChatBox('Use syntax: /veh [vehicle_name]');
} else {
let pos = player.position;
pos.x += 3;
mp.vehicles.new(mp.joaat(arr[1]), pos);
}
}
});