<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>https://rage.grandroleplay.ru/index.php?action=history&amp;feed=atom&amp;title=Player%3A%3AtaskCombat</id>
	<title>Player::taskCombat - История изменений</title>
	<link rel="self" type="application/atom+xml" href="https://rage.grandroleplay.ru/index.php?action=history&amp;feed=atom&amp;title=Player%3A%3AtaskCombat"/>
	<link rel="alternate" type="text/html" href="https://rage.grandroleplay.ru/index.php?title=Player::taskCombat&amp;action=history"/>
	<updated>2026-07-24T20:00:41Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://rage.grandroleplay.ru/index.php?title=Player::taskCombat&amp;diff=12418&amp;oldid=prev</id>
		<title>imported&gt;Shr0x в 13:15, 11 ноября 2024</title>
		<link rel="alternate" type="text/html" href="https://rage.grandroleplay.ru/index.php?title=Player::taskCombat&amp;diff=12418&amp;oldid=prev"/>
		<updated>2024-11-11T13:15:07Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{ClientsideJsFunction}}&lt;br /&gt;
&lt;br /&gt;
{{JSContainer|&lt;br /&gt;
==Summary==&lt;br /&gt;
Directs the specified ped to attack a target player. Combat behavior and response can be adjusted using `combatFlags` and `threatResponseFlags`.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
player.taskCombat(targetPed, combatFlags, threatResponseFlags);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Combat Flags ==&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;0&amp;#039;&amp;#039;&amp;#039;: Standard combat behavior&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;16&amp;#039;&amp;#039;&amp;#039;: Aggressively pursue and attack the target&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;33&amp;#039;&amp;#039;&amp;#039;: Defensive stance, attacks only if provoked&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;128&amp;#039;&amp;#039;&amp;#039;: Avoids direct engagement in combat&lt;br /&gt;
&lt;br /&gt;
== Threat Response Flags ==&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;0&amp;#039;&amp;#039;&amp;#039;: Default threat response&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;1&amp;#039;&amp;#039;&amp;#039;: Defensive response, only counters attacks&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;16&amp;#039;&amp;#039;&amp;#039;: High aggression, prioritizes combat engagement&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;256&amp;#039;&amp;#039;&amp;#039;: Ignores threats, remains passive&lt;br /&gt;
&lt;br /&gt;
== Required Arguments ==&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;targetPed:&amp;#039;&amp;#039;&amp;#039; The handle or object of the ped the player will attack.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;combatFlags:&amp;#039;&amp;#039;&amp;#039; {{RageType|int}} - Adjusts how the attacker engages the target. &lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;threatResponseFlags:&amp;#039;&amp;#039;&amp;#039; {{RageType|int}} - Modifies how the attacker reacts to threats. &lt;br /&gt;
&lt;br /&gt;
=== Return Value ===&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;undefined&amp;#039;&amp;#039;&amp;#039; - This function does not return a value.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
In this example, an NPC is spawned and instructed to engage the nearest player using specific combat settings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
const targetPlayer = mp.players.local; // Get the local player as the target (example)&lt;br /&gt;
const npc = mp.peds.new(mp.game.joaat(&amp;#039;mp_m_freemode_01&amp;#039;),targetPlayer.position, 0, 0); // Create a freemode ped at a position&lt;br /&gt;
&lt;br /&gt;
if (targetPlayer) {&lt;br /&gt;
    npc.taskCombat(targetPlayer.handle, 16, 16); // Task NPC to aggressively pursue and engage the player&lt;br /&gt;
    mp.gui.chat.push(`NPC is now engaging in combat with ${targetPlayer.name}`);&lt;br /&gt;
} else {&lt;br /&gt;
    mp.gui.chat.push(&amp;quot;Target player not found.&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
== See Also ==&lt;br /&gt;
{{Player_function_c}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Clientside API]]&lt;br /&gt;
[[Category:TODO: Example]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Shr0x</name></author>
	</entry>
</feed>