Player::taskVehicleChase: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
 
Line 8: Line 8:
==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
 
/*arg0 = pedName, arg1 = Position.X, arg2 = Position.Y, arg3 = Position.Z */
 
const myplayer = mp.players.local;
 
mp.events.add('PedDriving3', (arg0, arg1, arg2, arg3) => {
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.taskVehicleChase(myplayer.handle);
//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:56, 24 August 2020

chases targetEnt fast and aggressively
--
Makes ped (needs to be in vehicle) chase targetEnt.

Syntax

player.taskVehicleChase(targetEnt);

Required Arguments

  • targetEnt: Entity handle or object

Return value

  • Undefined

Example

/*arg0 = pedName, arg1 = Position.X, arg2 = Position.Y, arg3 = Position.Z */

const myplayer = mp.players.local;

mp.events.add('PedDriving3', (arg0, arg1, arg2, arg3) => {
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.taskVehicleChase(myplayer.handle);
			//mp.gui.chat.push("StartDriveTo: " + new Date());
		}, 10500);
	}, 300);
});

See also