Table of Contents

Interface INPC.IManagedInterface

Namespace
SampSharp.OpenMp.Core.Api
Assembly
SampSharp.OpenMp.Core.dll

Represents the managed interface implemented by its unmanaged counterpart.

public interface INPC.IManagedInterface : IUnmanagedInterface
Inherited Members

Methods

AimAt(Vector3, bool, int, bool, Vector3, EntityCheckType)

Instructs the NPC to aim at a world position.

void AimAt(Vector3 point, bool shoot, int shootDelay, bool setAngle, Vector3 offsetFrom, EntityCheckType betweenCheckFlags)

Parameters

point Vector3
shoot bool
shootDelay int
setAngle bool
offsetFrom Vector3
betweenCheckFlags EntityCheckType

AimAtPlayer(IPlayer, bool, int, bool, Vector3, Vector3, EntityCheckType)

Instructs the NPC to aim at a specific player.

void AimAtPlayer(IPlayer atPlayer, bool shoot, int shootDelay, bool setAngle, Vector3 offset, Vector3 offsetFrom, EntityCheckType betweenCheckFlags)

Parameters

atPlayer IPlayer
shoot bool
shootDelay int
setAngle bool
offset Vector3
offsetFrom Vector3
betweenCheckFlags EntityCheckType

ApplyAnimation(AnimationData)

Applies an animation. animationData bundles lib + name + flags + duration.

void ApplyAnimation(AnimationData animationData)

Parameters

animationData AnimationData

ChangeNode(int, ushort)

Changes the active node and seeks to a specific target point.

ushort ChangeNode(int nodeId, ushort targetPointId)

Parameters

nodeId int
targetPointId ushort

Returns

ushort

ClearAnimations()

Clears any applied animation.

void ClearAnimations()

EnableInfiniteAmmo(bool)

Enables or disables infinite ammo for the NPC.

void EnableInfiniteAmmo(bool enable)

Parameters

enable bool

EnableReloading(bool)

Enables or disables weapon reloading for the NPC.

void EnableReloading(bool toggle)

Parameters

toggle bool

EnterVehicle(IVehicle, byte, NPCMoveType)

Instructs the NPC to enter a vehicle.

void EnterVehicle(IVehicle vehicle, byte seatId, NPCMoveType moveType)

Parameters

vehicle IVehicle
seatId byte
moveType NPCMoveType

ExitVehicle()

Instructs the NPC to exit the current vehicle.

void ExitVehicle()

GetAmmo()

Gets ammo for the current weapon.

int GetAmmo()

Returns

int

GetAmmoInClip()

Gets the ammo count in the current weapon's clip.

int GetAmmoInClip()

Returns

int

GetAnimation(out int, out float, out bool, out bool, out bool, out bool, out int)

Gets the current foot-sync animation parameters for the NPC.

void GetAnimation(out int animationId, out float delta, out bool loop, out bool lockX, out bool lockY, out bool freeze, out int time)

Parameters

animationId int
delta float
loop bool
lockX bool
lockY bool
freeze bool
time int

GetArmour()

Gets the NPC's armour.

float GetArmour()

Returns

float

GetCurrentPathId()

Gets the ID of the path the NPC is currently following, or -1 if none.

int GetCurrentPathId()

Returns

int

GetCurrentPathPointIndex()

Gets the index of the current waypoint within the active path.

int GetCurrentPathPointIndex()

Returns

int

GetEnteringVehicle()

Gets the vehicle the NPC is in the process of entering, or a handle with no value if not entering one.

IVehicle GetEnteringVehicle()

Returns

IVehicle

GetEnteringVehicleSeat()

Gets the seat index the NPC is targeting while entering a vehicle.

int GetEnteringVehicleSeat()

Returns

int

GetFightingStyle()

Gets the NPC's current fighting style.

PlayerFightingStyle GetFightingStyle()

Returns

PlayerFightingStyle

GetHealth()

Gets the NPC's health.

float GetHealth()

Returns

float

GetInterior()

Gets the interior id this NPC is recorded in (server-side bookkeeping only).

uint GetInterior()

Returns

uint

GetKeys(out ushort, out ushort, out ushort)

Gets the NPC's current movement keys.

void GetKeys(out ushort upAndDown, out ushort leftAndRight, out ushort keys)

Parameters

upAndDown ushort
leftAndRight ushort
keys ushort

GetPlayer()

Gets the underlying IPlayer instance for this NPC.

IPlayer GetPlayer()

Returns

IPlayer

GetPlayerAimingAt()

Gets the player the NPC is currently aiming at, or a handle with no value if not aiming at any player.

IPlayer GetPlayerAimingAt()

Returns

IPlayer

GetPlayerMovingTo()

Gets the player the NPC is currently moving towards, or a handle with no value if not following a player.

IPlayer GetPlayerMovingTo()

Returns

IPlayer

GetPosition()

Gets the NPC's world position.

Vector3 GetPosition()

Returns

Vector3

GetPositionMovingTo()

Gets the world position the NPC is currently moving to.

Vector3 GetPositionMovingTo()

Returns

Vector3

GetRotation()

Gets the NPC's rotation as a quaternion.

GTAQuat GetRotation()

Returns

GTAQuat

GetSpecialAction()

Gets the current special action for the NPC.

PlayerSpecialAction GetSpecialAction()

Returns

PlayerSpecialAction

GetSurfingData()

Gets the current surfing data for the NPC.

PlayerSurfingData GetSurfingData()

Returns

PlayerSurfingData

GetVehicle()

Gets the vehicle this NPC is currently in, or a handle with no value if not in a vehicle.

IVehicle GetVehicle()

Returns

IVehicle

GetVehicleGearState()

Gets the gear state for the NPC's vehicle.

int GetVehicleGearState()

Returns

int

GetVehicleHealth()

Gets the health of the NPC's current vehicle.

float GetVehicleHealth()

Returns

float

GetVehicleHydraThrusters()

Gets the hydra thruster direction for the NPC's vehicle.

int GetVehicleHydraThrusters()

Returns

int

GetVehicleSeat()

Gets the seat index this NPC occupies in the current vehicle.

int GetVehicleSeat()

Returns

int

GetVehicleTrainSpeed()

Gets the train speed for the NPC's vehicle.

float GetVehicleTrainSpeed()

Returns

float

GetVelocity()

Gets the current velocity vector.

Vector3 GetVelocity()

Returns

Vector3

GetVirtualWorld()

Gets the virtual world this NPC is in.

int GetVirtualWorld()

Returns

int

GetWeapon()

Gets the current weapon id.

byte GetWeapon()

Returns

byte

GetWeaponAccuracy(byte)

Gets the accuracy of the NPC for the specified weapon.

float GetWeaponAccuracy(byte weapon)

Parameters

weapon byte

Returns

float

GetWeaponActualClipSize(byte)

Gets the actual clip size accounting for skill level and infinite ammo.

int GetWeaponActualClipSize(byte weapon)

Parameters

weapon byte

Returns

int

GetWeaponActualReloadTime(byte)

Gets the actual reload time accounting for skill level and dual wield.

int GetWeaponActualReloadTime(byte weapon)

Parameters

weapon byte

Returns

int

GetWeaponClipSize(byte)

Gets the clip size for the specified weapon.

int GetWeaponClipSize(byte weapon)

Parameters

weapon byte

Returns

int

GetWeaponReloadTime(byte)

Gets the reload time (in milliseconds) for the specified weapon.

int GetWeaponReloadTime(byte weapon)

Parameters

weapon byte

Returns

int

GetWeaponShootTime(byte)

Gets the shoot time (in milliseconds) for the specified weapon.

int GetWeaponShootTime(byte weapon)

Parameters

weapon byte

Returns

int

GetWeaponSkillLevel(PlayerWeaponSkill)

Gets the weapon skill level for the specified weapon skill.

int GetWeaponSkillLevel(PlayerWeaponSkill weaponSkill)

Parameters

weaponSkill PlayerWeaponSkill

Returns

int

GetWeaponState()

Gets the NPC's current weapon state.

PlayerWeaponState GetWeaponState()

Returns

PlayerWeaponState

IsAiming()

Gets a value indicating whether the NPC is currently aiming.

bool IsAiming()

Returns

bool

IsAimingAtPlayer(IPlayer)

Gets a value indicating whether the NPC is currently aiming at the specified player.

bool IsAimingAtPlayer(IPlayer player)

Parameters

player IPlayer

Returns

bool

IsDead()

True if the NPC has been killed and not yet respawned.

bool IsDead()

Returns

bool

IsInfiniteAmmoEnabled()

Gets a value indicating whether infinite ammo is enabled for the NPC.

bool IsInfiniteAmmoEnabled()

Returns

bool

IsInvulnerable()

True iff the NPC is invulnerable.

bool IsInvulnerable()

Returns

bool

IsMeleeAttacking()

Gets a value indicating whether the NPC is currently performing a melee attack.

bool IsMeleeAttacking()

Returns

bool

IsMoving()

True if the NPC is currently moving (path or direct).

bool IsMoving()

Returns

bool

IsMovingByPath()

Gets a value indicating whether the NPC is currently moving along a path.

bool IsMovingByPath()

Returns

bool

IsMovingToPlayer(IPlayer)

Gets a value indicating whether the NPC is currently moving towards the specified player.

bool IsMovingToPlayer(IPlayer player)

Parameters

player IPlayer

Returns

bool

IsPathPaused()

Gets a value indicating whether the NPC's path movement is currently paused.

bool IsPathPaused()

Returns

bool

IsPlaybackPaused()

Gets a value indicating whether playback is currently paused.

bool IsPlaybackPaused()

Returns

bool

IsPlayingNode()

Gets a value indicating whether the NPC is currently following a node path.

bool IsPlayingNode()

Returns

bool

IsPlayingNodePaused()

Gets a value indicating whether node-based movement is currently paused.

bool IsPlayingNodePaused()

Returns

bool

IsPlayingPlayback()

Gets a value indicating whether the NPC is currently playing a recording.

bool IsPlayingPlayback()

Returns

bool

IsReloadEnabled()

Gets a value indicating whether weapon reloading is enabled for the NPC.

bool IsReloadEnabled()

Returns

bool

IsReloading()

Gets a value indicating whether the NPC is currently reloading its weapon.

bool IsReloading()

Returns

bool

IsShooting()

Gets a value indicating whether the NPC is currently shooting.

bool IsShooting()

Returns

bool

IsStreamedInForPlayer(IPlayer)

Checks whether this NPC is streamed in for the given player.

bool IsStreamedInForPlayer(IPlayer other)

Parameters

other IPlayer

Returns

bool

IsVehicleSirenUsed()

Gets a value indicating whether the NPC's vehicle siren is currently active.

bool IsVehicleSirenUsed()

Returns

bool

Kill(IPlayer, byte)

Simulates NPC death, optionally with a killer and weapon.

void Kill(IPlayer killer, byte weapon)

Parameters

killer IPlayer
weapon byte

MeleeAttack(int, bool)

Starts a melee attack for the specified duration.

void MeleeAttack(int time, bool secondaryMeleeAttack)

Parameters

time int

Duration of the attack in milliseconds.

secondaryMeleeAttack bool

If true, performs the secondary melee attack.

Move(Vector3, NPCMoveType, float, float)

Tells the NPC to walk/jog/sprint/drive to position.

bool Move(Vector3 position, NPCMoveType moveType, float moveSpeed, float stopRange)

Parameters

position Vector3
moveType NPCMoveType
moveSpeed float
stopRange float

Returns

bool

MoveByPath(int, NPCMoveType, float, bool)

Instructs the NPC to move along a previously created path.

bool MoveByPath(int pathId, NPCMoveType moveType, float moveSpeed, bool reverse)

Parameters

pathId int
moveType NPCMoveType
moveSpeed float
reverse bool

Returns

bool

MoveToPlayer(IPlayer, NPCMoveType, float, float, Milliseconds, bool)

Tells the NPC to continuously follow targetPlayer using the specified movement type.

bool MoveToPlayer(IPlayer targetPlayer, NPCMoveType moveType, float moveSpeed, float stopRange, Milliseconds posCheckUpdateDelay, bool autoRestart)

Parameters

targetPlayer IPlayer

The player to follow.

moveType NPCMoveType

The movement type (walk, jog, sprint, etc.).

moveSpeed float

The movement speed (-1 for automatic).

stopRange float

The radius within which the NPC stops following.

posCheckUpdateDelay Milliseconds

How often (in milliseconds) the NPC recalculates the target's position.

autoRestart bool

If true, the NPC will restart following after reaching the player.

Returns

bool

PausePath()

Pauses path-based movement temporarily.

void PausePath()

PausePlayback(bool)

Pauses or resumes the current playback.

void PausePlayback(bool paused)

Parameters

paused bool

PausePlayingNode()

Pauses node-based movement.

void PausePlayingNode()

PlayNode(int, NPCMoveType, float, float, bool)

Starts node-based movement for the NPC.

bool PlayNode(int nodeId, NPCMoveType moveType, float moveSpeed, float radius, bool setAngle)

Parameters

nodeId int
moveType NPCMoveType
moveSpeed float
radius float
setAngle bool

Returns

bool

PutInVehicle(IVehicle, byte)

Teleports the NPC directly into a vehicle seat.

bool PutInVehicle(IVehicle vehicle, byte seat)

Parameters

vehicle IVehicle
seat byte

Returns

bool

RemoveFromVehicle()

Removes the NPC from its current vehicle.

bool RemoveFromVehicle()

Returns

bool

ResetAnimation()

Resets the foot-sync animation for the NPC.

void ResetAnimation()

ResetSurfingData()

Resets the NPC's surfing data.

void ResetSurfingData()

Respawn()

Respawns the NPC keeping its current state.

void Respawn()

ResumePath()

Resumes previously paused path-based movement.

void ResumePath()

ResumePlayingNode()

Resumes previously paused node-based movement.

void ResumePlayingNode()

SetAmmo(int)

Sets ammo for the current weapon.

void SetAmmo(int ammo)

Parameters

ammo int

SetAmmoInClip(int)

Sets the ammo count in the current weapon's clip.

void SetAmmoInClip(int ammo)

Parameters

ammo int

SetAnimation(int, float, bool, bool, bool, bool, int)

Sets the foot-sync animation for the NPC.

void SetAnimation(int animationId, float delta, bool loop, bool lockX, bool lockY, bool freeze, int time)

Parameters

animationId int
delta float
loop bool
lockX bool
lockY bool
freeze bool
time int

SetArmour(float)

Sets the NPC's armour.

void SetArmour(float armour)

Parameters

armour float

SetFightingStyle(PlayerFightingStyle)

Sets the NPC's fighting style.

void SetFightingStyle(PlayerFightingStyle style)

Parameters

style PlayerFightingStyle

SetHealth(float)

Sets the NPC's health.

void SetHealth(float health)

Parameters

health float

SetInterior(uint)

Sets the interior id (server-side bookkeeping only — does not relocate the NPC).

void SetInterior(uint interior)

Parameters

interior uint

SetInvulnerable(bool)

Sets invulnerability.

void SetInvulnerable(bool toggle)

Parameters

toggle bool

SetKeys(ushort, ushort, ushort)

Sets the NPC's movement keys.

void SetKeys(ushort upAndDown, ushort leftAndRight, ushort keys)

Parameters

upAndDown ushort
leftAndRight ushort
keys ushort

SetPosition(Vector3, bool)

Sets the NPC's position. immediateUpdate=true broadcasts a sync to streamed-in players right away instead of waiting for the next tick.

void SetPosition(Vector3 position, bool immediateUpdate)

Parameters

position Vector3
immediateUpdate bool

SetRotation(GTAQuat, bool)

Sets the NPC's rotation. See SetPosition(Vector3, bool) for the immediate-update flag.

void SetRotation(GTAQuat rotation, bool immediateUpdate)

Parameters

rotation GTAQuat
immediateUpdate bool

SetSkin(int)

Sets the NPC's skin model id.

void SetSkin(int model)

Parameters

model int

SetSpecialAction(PlayerSpecialAction)

Sets the special action for the NPC.

void SetSpecialAction(PlayerSpecialAction action)

Parameters

action PlayerSpecialAction

SetSurfingData(PlayerSurfingData)

Sets the surfing data for the NPC.

void SetSurfingData(PlayerSurfingData data)

Parameters

data PlayerSurfingData

SetVehicleGearState(int)

Sets the gear state for the NPC's vehicle.

void SetVehicleGearState(int gear)

Parameters

gear int

SetVehicleHealth(float)

Sets the health of the NPC's current vehicle.

void SetVehicleHealth(float health)

Parameters

health float

SetVehicleHydraThrusters(int)

Sets the hydra thruster direction for the NPC's vehicle.

void SetVehicleHydraThrusters(int direction)

Parameters

direction int

SetVehicleTrainSpeed(float)

Sets the train speed for the NPC's vehicle.

void SetVehicleTrainSpeed(float speed)

Parameters

speed float

SetVelocity(Vector3, bool)

Sets the velocity vector. update=true forces a sync this tick.

void SetVelocity(Vector3 velocity, bool update)

Parameters

velocity Vector3
update bool

SetVirtualWorld(int)

Sets the virtual world this NPC is in.

void SetVirtualWorld(int vw)

Parameters

vw int

SetWeapon(byte)

Sets the current weapon id.

void SetWeapon(byte weapon)

Parameters

weapon byte

SetWeaponAccuracy(byte, float)

Sets the accuracy of the NPC for the specified weapon.

void SetWeaponAccuracy(byte weapon, float accuracy)

Parameters

weapon byte
accuracy float

SetWeaponClipSize(byte, int)

Sets the clip size for the specified weapon.

void SetWeaponClipSize(byte weapon, int size)

Parameters

weapon byte
size int

SetWeaponReloadTime(byte, int)

Sets the reload time (in milliseconds) for the specified weapon.

void SetWeaponReloadTime(byte weapon, int time)

Parameters

weapon byte
time int

SetWeaponShootTime(byte, int)

Sets the shoot time (in milliseconds) for the specified weapon.

void SetWeaponShootTime(byte weapon, int time)

Parameters

weapon byte
time int

SetWeaponSkillLevel(PlayerWeaponSkill, int)

Sets the weapon skill level for the specified weapon skill.

void SetWeaponSkillLevel(PlayerWeaponSkill weaponSkill, int level)

Parameters

weaponSkill PlayerWeaponSkill
level int

SetWeaponState(PlayerWeaponState)

Sets the NPC's weapon state.

void SetWeaponState(PlayerWeaponState state)

Parameters

state PlayerWeaponState

Shoot(int, PlayerBulletHitType, byte, Vector3, Vector3, bool, EntityCheckType)

Triggers a weapon shot from the NPC.

void Shoot(int hitId, PlayerBulletHitType hitType, byte weapon, Vector3 endPoint, Vector3 offset, bool isHit, EntityCheckType betweenCheckFlags)

Parameters

hitId int
hitType PlayerBulletHitType
weapon byte
endPoint Vector3
offset Vector3
isHit bool
betweenCheckFlags EntityCheckType

Spawn()

Spawns the NPC at its currently configured position/rotation.

void Spawn()

StartPlaybackById(int, bool, Vector3, GTAQuat)

Starts playing a pre-loaded recording by its record ID.

bool StartPlaybackById(int recordId, bool autoUnload, Vector3 point, GTAQuat rotation)

Parameters

recordId int

The record ID returned by LoadRecord(string).

autoUnload bool

If true, the record is unloaded when playback ends.

point Vector3

The starting position for playback (zero vector for current position).

rotation GTAQuat

The starting rotation for playback.

Returns

bool

StartPlaybackByName(string, bool, Vector3, GTAQuat)

Starts playing a pre-recorded movement by file name.

bool StartPlaybackByName(string recordName, bool autoUnload, Vector3 point, GTAQuat rotation)

Parameters

recordName string

The path to the record file (relative to scriptfiles).

autoUnload bool

If true, the record is unloaded when playback ends.

point Vector3

The starting position for playback (zero vector for current position).

rotation GTAQuat

The starting rotation for playback.

Returns

bool

StopAim()

Stops the NPC from aiming.

void StopAim()

StopMeleeAttack()

Stops the current melee attack.

void StopMeleeAttack()

StopMove()

Stops any active movement.

void StopMove()

StopPath()

Stops path-based movement entirely.

void StopPath()

StopPlayback()

Stops the current playback.

void StopPlayback()

StopPlayingNode()

Stops node-based movement.

void StopPlayingNode()

StreamedForPlayers()

Gets the set of players this NPC is currently streamed in for.

FlatPtrHashSet<IPlayer> StreamedForPlayers()

Returns

FlatPtrHashSet<IPlayer>

UpdateNodePoint(ushort)

Updates the current node point to the specified point ID.

bool UpdateNodePoint(ushort pointId)

Parameters

pointId ushort

Returns

bool

UseVehicleSiren(bool)

Enables or disables the siren on the NPC's vehicle.

void UseVehicleSiren(bool use)

Parameters

use bool