Player::taskVehicleDriveToCoord: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
No edit summary
 
Line 17: Line 17:
==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
/* Create a Cop Car (x,y,z = arg1/arg2/arg3) and a Cop, Enter Vehicle, Drive to 0,0,72 Coords. */
 
let testPed = mp.peds.new(mp.game.joaat(arg0), new mp.Vector3(arg1, arg2, arg3), {dynamic:true}); //synced ped
testPed.controller = mp.players.at(0);
 
setTimeout(function () {
testPed.freezePosition(false);
testPed.setCanBeDamaged(true);
testPed.setInvincible(false);
testPed.CanRagdoll = true;
testPed.setOnlyDamagedByPlayer(true);
testPed.setCanRagdollFromPlayerImpact(true);
testPed.setSweat(100);
testPed.setRagdollOnCollision(true);
 
testPed.setProofs(false, false, false, false, false, false, false, false);
testPed.giveWeapon(487013001, 50, true);
 
let Veh = mp.vehicles.new(mp.game.joaat("police"), new mp.Vector3(arg1, arg2, arg3),
{
numberPlate: "ADMIN",
locked: false,
engine: true,
color: [[255, 255, 255],[0,0,0]]
});
 
setTimeout(function () {
testPed.taskEnterVehicle(Veh.handle, 10000, -1, 1, 1, 0);
}, 1500);
 
//player.taskVehicleDriveToCoord(vehicle, x, y, z, speed, p6, vehicleModel, drivingMode, stopRange, p10);
setTimeout(function () {
testPed.taskVehicleDriveToCoord(Veh.handle, 0.52, 0.38, 72.1, 40, 1, 2046537925, 2, 3, true);
mp.gui.chat.push("StartDriveTo: " + new Date());
}, 10500);
}, 300);
</syntaxhighlight>
</syntaxhighlight>
==See also==
==See also==
{{Player_function_c}}
{{Player_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 12:45, 24 August 2020

info about driving modes: HTTP://gtaforums.com/topic/822314-guide-driving-styles/
---------------------------------------------------------------
Passing P6 value as floating value didn't throw any errors, though unsure what is it exactly, looks like radius or something.

P10 though, it is mentioned as float, however, I used bool and set it to true, that too worked.
Here the e.g. code I used
Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, Ped, Vehicle, Cor X, Cor Y, Cor Z, 30f, 1f, Vehicle.GetHashCode(), 16777216, 1f, true);

Syntax

player.taskVehicleDriveToCoord(vehicle, x, y, z, speed, p6, vehicleModel, drivingMode, stopRange, p10);

Required Arguments

  • vehicle: Vehicle handle or object
  • x: float
  • y: float
  • z: float
  • speed: float
  • p6: unknown (to be checked)
  • vehicleModel: Model hash or name
  • drivingMode: int
  • stopRange: float
  • p10: float

Return value

  • Undefined

Example

/* Create a Cop Car (x,y,z = arg1/arg2/arg3) and a Cop, Enter Vehicle, Drive to 0,0,72 Coords. */

let testPed = mp.peds.new(mp.game.joaat(arg0), new mp.Vector3(arg1, arg2, arg3), {dynamic:true}); //synced ped
testPed.controller = mp.players.at(0);

	setTimeout(function () {
	
		testPed.freezePosition(false);
		testPed.setCanBeDamaged(true);
		testPed.setInvincible(false);
		testPed.CanRagdoll = true;
		testPed.setOnlyDamagedByPlayer(true);
		testPed.setCanRagdollFromPlayerImpact(true);
		testPed.setSweat(100);
		testPed.setRagdollOnCollision(true);

		testPed.setProofs(false, false, false, false, false, false, false, false); 
		testPed.giveWeapon(487013001, 50, true);

		let Veh = mp.vehicles.new(mp.game.joaat("police"), new mp.Vector3(arg1, arg2, arg3),
		{
			numberPlate: "ADMIN",
			locked: false,
			engine: true,
			color: [[255, 255, 255],[0,0,0]]
		});

		setTimeout(function () {
			testPed.taskEnterVehicle(Veh.handle, 10000, -1, 1, 1, 0);
		}, 1500);

		//player.taskVehicleDriveToCoord(vehicle, x, y, z, speed, p6, vehicleModel, drivingMode, stopRange, p10);
		
		setTimeout(function () {
			testPed.taskVehicleDriveToCoord(Veh.handle, 0.52, 0.38, 72.1, 40, 1, 2046537925, 2, 3, true);
			mp.gui.chat.push("StartDriveTo: " + new Date());
		}, 10500);
	}, 300);

See also