SendShotInfo: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
<poem style="border: 2px solid #d6d2c5; background-color: #f9f4e6; padding: 1em;">
The parameters autodeath, autodeathweapon, autodeathkiller were added in v1.8 beta and will not work in previous versions.
</poem>
{{Welcome|
{{Welcome|
desc= This function registers to server that the npc is shot down ( by another player ). This function is followed by [[SendDeathInfo]] after a delay (must be called after say 1000 ms )|
desc= This function registers to server that the npc is shot down ( by another player ). This function is followed by [[SendDeathInfo]] after a delay (must be called after say 1000 ms ) if autodeath parameters are not used.|
params=<syntaxhighlight lang="lua">( bodypartId, animationId )</syntaxhighlight>
params=<syntaxhighlight lang="lua">( bodypartId, animationId, autodeath=false, autodeathweapon=0, autodeathkiller=255 )</syntaxhighlight>
<poem>::bodypartId : The [[bodypart]] which 'was' hit.
<poem>::bodypartId : The [[bodypart]] which 'was' hit.
::animationId :: The same as the animation ID used in server side.</poem>|
::animationId : The same as the animation ID used in server side.
::autodeath : If true, npc registers death by itself eliminating need to call [[SendDeathInfo]].
::autodeathweapon : The ID of the weapon with which npc was killed.(Use 70 for suicide)
::autodeathkiller : The ID of the killer who killed npc. (255 if npc died itself)
</poem>|
example=<source lang="lua">
example=<source lang="lua">
SendShotInfo( 6, 17 ); //6 means head and 17 means shot in face.
SendShotInfo( 6, 17 ); //6 means head and 17 means shot in face.
SetTimerEx( "SendDeathInfo", 2000, 1, 27, 0, 6 );</source>|
SetTimerEx( "SendDeathInfo", 2000, 1, 27, 0, 6 );</source>
<source lang="lua">SendShotInfo(BODYPART_HEAD,40,true,26, 1);</source>|
relfuncs=*[[SendDeathInfo]]
relfuncs=*[[SendDeathInfo]]
}}
}}

Revision as of 17:45, 8 February 2024

The parameters autodeath, autodeathweapon, autodeathkiller were added in v1.8 beta and will not work in previous versions.


Description:
This function registers to server that the npc is shot down ( by another player ). This function is followed by SendDeathInfo after a delay (must be called after say 1000 ms ) if autodeath parameters are not used.


Parameters:

( bodypartId, animationId, autodeath=false, autodeathweapon=0, autodeathkiller=255 )

bodypartId : The bodypart which 'was' hit.
animationId : The same as the animation ID used in server side.
autodeath : If true, npc registers death by itself eliminating need to call SendDeathInfo.
autodeathweapon : The ID of the weapon with which npc was killed.(Use 70 for suicide)
autodeathkiller : The ID of the killer who killed npc. (255 if npc died itself)


Return Values:
This function does not return any specific values.


Example

SendShotInfo( 6, 17 ); //6 means head and 17 means shot in face.
SetTimerEx( "SendDeathInfo", 2000, 1, 27, 0, 6 );
SendShotInfo(BODYPART_HEAD,40,true,26, 1);

Related Functions

The following functions may be helpful as they relate to this function in one way or another.