SendShotInfo: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
No edit summary
No edit summary
Line 14: Line 14:
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>
If player with ID <source inline>1</source> shot down npc with Ruger <source inline>26</source>:
If player with ID <source inline>1</source> shot down npc with Ruger in head<source inline>26</source>:
<source lang="lua">SendShotInfo(BODYPART_HEAD,40,true,26, 1);</source> See [http://wiki.thijn.ovh/index.php?title=Animations this] page for animation IDs. Thanks to thijn for website|
<source lang="lua">SendShotInfo(BODYPART_HEAD,40,true,26, 1);</source> See [http://wiki.thijn.ovh/index.php?title=Animations this] page for animation IDs. Thanks to thijn for website|
relfuncs=*[[SendDeathInfo]]
relfuncs=*[[SendDeathInfo]]
}}
}}

Revision as of 17:51, 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 );

If player with ID 1 shot down npc with Ruger in head26:

SendShotInfo(BODYPART_HEAD,40,true,26, 1);

See this page for animation IDs. Thanks to thijn for website

Related Functions

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