Skip to content

Commit d6ccae6

Browse files
committed
new natives
1 parent ae817cb commit d6ccae6

1 file changed

Lines changed: 103 additions & 0 deletions

File tree

omp_npc.inc

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,17 @@ native NPC_Spawn(npcid);
203203
*/
204204
native NPC_Respawn(npcid);
205205

206+
/**
207+
* <library>omp_npc</library>
208+
* <summary>Checks if an NPC is spawned in the game world.</summary>
209+
* <param name="npcid">The ID of the NPC to check</param>
210+
* <returns>Returns true if the NPC is spawned, false otherwise.</returns>
211+
* <seealso name="NPC_Spawn" />
212+
* <seealso name="NPC_Respawn" />
213+
* <seealso name="NPC_IsDead" />
214+
*/
215+
native bool:NPC_IsSpawned(npcid);
216+
206217
/**
207218
* <library>omp_npc</library>
208219
* <summary>Gets all NPC IDs and stores them in an array.</summary>
@@ -319,6 +330,43 @@ native bool:NPC_StopMove(npcid);
319330
*/
320331
native bool:NPC_IsMoving(npcid);
321332

333+
/**
334+
* <library>omp_npc</library>
335+
* <summary>Checks if an NPC is moving toward a specific player.</summary>
336+
* <param name="npcid">The ID of the NPC</param>
337+
* <param name="playerid">The ID of the player to check</param>
338+
* <returns>Returns true if the NPC is moving toward the specified player, false otherwise.</returns>
339+
* <seealso name="NPC_MoveToPlayer" />
340+
* <seealso name="NPC_IsMoving" />
341+
*/
342+
native bool:NPC_IsMovingToPlayer(npcid, playerid);
343+
344+
/**
345+
* <library>omp_npc</library>
346+
* <summary>Sets the velocity of an NPC.</summary>
347+
* <param name="npcid">The ID of the NPC</param>
348+
* <param name="x">The X velocity component</param>
349+
* <param name="y">The Y velocity component</param>
350+
* <param name="z">The Z velocity component</param>
351+
* <returns>Returns true on success, false on failure.</returns>
352+
* <seealso name="NPC_GetVelocity" />
353+
* <seealso name="NPC_SetPos" />
354+
*/
355+
native NPC_SetVelocity(npcid, Float:x, Float:y, Float:z);
356+
357+
/**
358+
* <library>omp_npc</library>
359+
* <summary>Gets the velocity of an NPC.</summary>
360+
* <param name="npcid">The ID of the NPC</param>
361+
* <param name="x">Variable to store the X velocity component, passed by reference</param>
362+
* <param name="y">Variable to store the Y velocity component, passed by reference</param>
363+
* <param name="z">Variable to store the Z velocity component, passed by reference</param>
364+
* <returns>Returns true on success, false on failure.</returns>
365+
* <seealso name="NPC_SetVelocity" />
366+
* <seealso name="NPC_GetPos" />
367+
*/
368+
native NPC_GetVelocity(npcid, &Float:x, &Float:y, &Float:z);
369+
322370
/*
323371
native # Appearance();
324372
native Appearance(
@@ -331,6 +379,16 @@ native
331379
*/
332380
native NPC_SetSkin(npcid, model);
333381

382+
/**
383+
* <library>omp_npc</library>
384+
* <summary>Gets the skin/model ID of an NPC.</summary>
385+
* <param name="npcid">The ID of the NPC</param>
386+
* <returns>Returns the skin/model ID of the NPC, or -1 if invalid.</returns>
387+
* <seealso name="NPC_SetSkin" />
388+
* <seealso name="NPC_IsValid" />
389+
*/
390+
native NPC_GetSkin(npcid);
391+
334392
/**
335393
* <library>omp_npc</library>
336394
*/
@@ -388,6 +446,18 @@ native NPC_SetInvulnerable(npcid, bool:toggle);
388446
*/
389447
native bool:NPC_IsInvulnerable(npcid);
390448

449+
/**
450+
* <library>omp_npc</library>
451+
* <summary>Kills an NPC with a specific weapon/reason.</summary>
452+
* <param name="npcid">The ID of the NPC to kill</param>
453+
* <param name="killerid">The ID of the player who killed the NPC (optional, use INVALID_PLAYER_ID for no killer)</param>
454+
* <param name="reason">The weapon ID or reason for death</param>
455+
* <returns>Returns true on success, false on failure.</returns>
456+
* <seealso name="NPC_IsDead" />
457+
* <seealso name="NPC_SetHealth" />
458+
*/
459+
native NPC_Kill(npcid, killerid = INVALID_PLAYER_ID, reason = 0);
460+
391461
/*
392462
native # Weapons & Combat();
393463
native Weapons & Combat(
@@ -490,6 +560,17 @@ native bool:NPC_IsInfiniteAmmoEnabled(npcid);
490560
*/
491561
native NPC_GetWeaponState(npcid);
492562

563+
/**
564+
* <library>omp_npc</library>
565+
* <summary>Sets the weapon state of an NPC.</summary>
566+
* <param name="npcid">The ID of the NPC</param>
567+
* <param name="weaponState">The weapon state to set</param>
568+
* <returns>Returns true on success, false on failure.</returns>
569+
* <seealso name="NPC_GetWeaponState" />
570+
* <seealso name="NPC_SetWeapon" />
571+
*/
572+
native NPC_SetWeaponState(npcid, weaponState);
573+
493574
/**
494575
* <library>omp_npc</library>
495576
* <summary>Makes an NPC fire a weapon shot.</summary>
@@ -541,6 +622,28 @@ native bool:NPC_IsAiming(npcid);
541622
*/
542623
native bool:NPC_IsAimingAtPlayer(npcid, playerid);
543624

625+
/**
626+
* <library>omp_npc</library>
627+
* <summary>Gets the ID of the player that an NPC is currently aiming at.</summary>
628+
* <param name="npcid">The ID of the NPC</param>
629+
* <returns>Returns the ID of the player being aimed at, or INVALID_PLAYER_ID if not aiming at anyone.</returns>
630+
* <seealso name="NPC_AimAtPlayer" />
631+
* <seealso name="NPC_IsAiming" />
632+
* <seealso name="NPC_GetPlayerMovingTo" />
633+
*/
634+
native NPC_GetPlayerAimingAt(npcid);
635+
636+
/**
637+
* <library>omp_npc</library>
638+
* <summary>Gets the ID of the player that an NPC is currently moving toward.</summary>
639+
* <param name="npcid">The ID of the NPC</param>
640+
* <returns>Returns the ID of the player being moved toward, or INVALID_PLAYER_ID if not moving toward anyone.</returns>
641+
* <seealso name="NPC_MoveToPlayer" />
642+
* <seealso name="NPC_IsMovingToPlayer" />
643+
* <seealso name="NPC_GetPlayerAimingAt" />
644+
*/
645+
native NPC_GetPlayerMovingTo(npcid);
646+
544647
/**
545648
* <library>omp_npc</library>
546649
*/

0 commit comments

Comments
 (0)