OnClientPlayerStealthKill: Difference between revisions
Jump to navigation
Jump to search
Cazomino05 (talk | contribs) (Created page with '__NOTOC__ {{Client event}} This event is triggered when a player stealth kills another player. ==Parameters== <syntaxhighlight lang="lua"> element targetPlayer </syntaxhighlight> *'''targetPlayer''': T…') |
(Improve example.) |
||
(9 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client event}} | {{Client event}} | ||
This event is triggered when | This event is triggered when the local player stealth kills another player. | ||
==Parameters== | ==Parameters== | ||
Line 8: | Line 8: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
*'''targetPlayer''': The [[player]] that is being stealth killed. | *'''targetPlayer''': The [[player]] or [[ped]] that is being stealth killed. | ||
==Source== | ==Source== | ||
The [[event system#Event source|source]] of this event is the [[player]] that initiated the stealth kill. | The [[event system#Event source|source]] of this event is the [[player]] that initiated the stealth kill. (Local player only) | ||
==Cancel effect== | ==Cancel effect== | ||
Line 17: | Line 17: | ||
==Example== | ==Example== | ||
This example disables stealth kills. | |||
<syntaxhighlight lang="lua"> | |||
function abortAllStealthKills(targetPlayer) | |||
cancelEvent() | |||
end | |||
addEventHandler("onClientPlayerStealthKill", localPlayer, abortAllStealthKills) | |||
</syntaxhighlight> | |||
This example disables stealth kills on a specific Ped. | |||
<syntaxhighlight lang="lua"> | |||
local myNPC = createPed(187, 1481.265, -1752.25, 15.446, 0) | |||
function antiKnife(targetPlayer) | |||
if targetPlayer == myNPC then | |||
cancelEvent() | |||
end | |||
end | |||
addEventHandler("onClientPlayerStealthKill", localPlayer, antiKnife) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 25: | Line 39: | ||
===Client player events=== | ===Client player events=== | ||
{{Client_player_events}} | {{Client_player_events}} | ||
===Client event functions=== | |||
{{Client_event_functions}} |
Latest revision as of 05:42, 26 August 2021
This event is triggered when the local player stealth kills another player.
Parameters
element targetPlayer
Source
The source of this event is the player that initiated the stealth kill. (Local player only)
Cancel effect
If this event is canceled, then the stealth kill is aborted.
Example
This example disables stealth kills.
function abortAllStealthKills(targetPlayer) cancelEvent() end addEventHandler("onClientPlayerStealthKill", localPlayer, abortAllStealthKills)
This example disables stealth kills on a specific Ped.
local myNPC = createPed(187, 1481.265, -1752.25, 15.446, 0) function antiKnife(targetPlayer) if targetPlayer == myNPC then cancelEvent() end end addEventHandler("onClientPlayerStealthKill", localPlayer, antiKnife)
See Also
Client player events
- onClientPlayerChangeNick
- onClientPlayerChoke
- onClientPlayerDamage
- onClientPlayerHeliKilled
- onClientPlayerHitByWaterCannon
- onClientPlayerJoin
- onClientPlayerPickupHit
- onClientPlayerPickupLeave
- onClientPlayerQuit
- onClientPlayerRadioSwitch
- onClientPlayerSpawn
- onClientPlayerStealthKill
- onClientPlayerStuntFinish
- onClientPlayerStuntStart
- onClientPlayerTarget
- onClientPlayerVehicleEnter
- onClientPlayerVehicleExit
- onClientPlayerVoicePause
- onClientPlayerVoiceResumed
- onClientPlayerVoiceStart
- onClientPlayerVoiceStop
- onClientPlayerWasted
- onClientPlayerWeaponFire
- onClientPlayerWeaponSwitch
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled