OnClientPlayerStealthKill

From Multi Theft Auto: Wiki
Revision as of 05:42, 26 August 2021 by Srslyyyy (talk | contribs) (Improve example.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This event is triggered when the local player stealth kills another player.

Parameters

element targetPlayer
  • targetPlayer: The player or ped that is being stealth killed.

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


Client event functions