LibAction: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
No edit summary
No edit summary
Line 21: Line 21:
OnPullingTrigger([integer] keys, [Vector]pos,  [float]angle, [integer]health, [integer]armour, [integer]weapon, [integer]ammo, [Vector]speed, [Vector]aimpos, [Vector]aimdir, [bool]isCrouching, [bool]isReloading )
OnPullingTrigger([integer] keys, [Vector]pos,  [float]angle, [integer]health, [integer]armour, [integer]weapon, [integer]ammo, [Vector]speed, [Vector]aimpos, [Vector]aimdir, [bool]isCrouching, [bool]isReloading )
</source>
</source>
 
<poem>This event is called just before sending the Aiming Packet( with decreased ammo) to server. The purpose is to manually change the aimpos/aimdir for accuracy.
To manually change, Call [[SendOnFootSyncDataEx]] at this point and then return false.
The automatic sending of aim packet depends on the return value of this function:
{| class="wikitable"
|-
! return value
!
!
|-
| false
| will not send packet, assuming the user send it using SendOnFootSyncDataEx or similar functions
|
|-
| 0
| style="text-align:center;" | "
|
|-
| null (or no return value)
| style="text-align:center;" | "
|
|}
Functions
Functions
ShootTarget(playerid)
ShootTarget(playerid)
ClearTarget()
ClearTarget()
GetTarget()
GetTarget()

Revision as of 04:23, 20 February 2023

Callbacks

1. OnTargetCleared

OnTargetCleared([integer]targetpid, [integer]reason)

The value of reason can be:

Constant
AMMO_SHORTAGE
PLAYER_STREAMEDOUT
INSTRUCTION_RECEIVED

2. OnTargetOutOfRange

OnTargetOutOfRange([integer]targetid)

Called when target is out of range of the weaponrange of the current weapon of npc. If target is not cleared, npc resumes shooting when target comes in range again.

3. OnPullingTrigger

OnPullingTrigger([integer] keys, [Vector]pos,  [float]angle, [integer]health, [integer]armour, [integer]weapon, [integer]ammo, [Vector]speed, [Vector]aimpos, [Vector]aimdir, [bool]isCrouching, [bool]isReloading )

<poem>This event is called just before sending the Aiming Packet( with decreased ammo) to server. The purpose is to manually change the aimpos/aimdir for accuracy. To manually change, Call SendOnFootSyncDataEx at this point and then return false. The automatic sending of aim packet depends on the return value of this function:

return value
false will not send packet, assuming the user send it using SendOnFootSyncDataEx or similar functions
0 "
null (or no return value) "

Functions ShootTarget(playerid) ClearTarget() GetTarget()