OnPlayerStealthKill: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 55: | Line 55: | ||
</section> | </section> | ||
{{See also/Server event|Player events}} | |||
Revision as of 03:02, 27 September 2018
This event is triggered when a player stealth kills another player.
Parameters
element targetPlayer
Source
The source of this event is the player that initiated the stealth kill.
Cancel effect
If this event is canceled, then the stealth kill is aborted.
Example
Click to collapse [-]
Serverfunction onStealthKill(targetPlayer) outputChatBox("Stealth kill!", source) -- Tell the player he/she has done a stealth kill. outputChatBox("" .. getPlayerName(targetPlayer) .. " has been stealth-killed by " .. getPlayerName(source) .. ".") end addEventHandler("onPlayerStealthKill", getRootElement(), onStealthKill) -- Adds a handler for the stealth kill event.
Click to collapse [-]
Serverfunction onStealthKill(targetPlayer) cancelEvent(true, "No more stealth kills.") -- Aborts the stealth-kill. end addEventHandler("onPlayerStealthKill", getRootElement(), onStealthKill) -- Adds a handler for the stealth kill event.
Click to collapse [-]
ServerThis example will prevent the stealthkill animation of the attacker as it occurs, something which is tricky to achieve (hence this example is extra useful). Note: you won't get this to work properly without timer and 'fake' animation. Lots of scripters have broken their backs over this.
addEventHandler( "onPlayerStealthKill", getRootElement(), function(targetPlayer) setTimer( function(thePlayer) setPedAnimation(thePlayer, "ped", "0", -1, true, true, true, true, 350) end, 50, 1, source ) end )
See Also
Player events
- onPlayerACInfo
- onPlayerBan
- onPlayerChangeNick
- onPlayerChat
- onPlayerClick
- onPlayerCommand
- onPlayerConnect
- onPlayerContact
- onPlayerDamage
- onPlayerJoin
- onPlayerLogin
- onPlayerLogout
- onPlayerMarkerHit
- onPlayerMarkerLeave
- onPlayerModInfo
- onPlayerMute
- onPlayerNetworkStatus
- onPlayerPickupHit
- onPlayerPickupLeave
- onPlayerPickupUse
- onPlayerPrivateMessage
- onPlayerQuit
- onPlayerScreenShot
- onPlayerSpawn
- onPlayerStealthKill
- onPlayerTarget
- onPlayerUnmute
- onPlayerVehicleEnter
- onPlayerVehicleExit
- onPlayerVoiceStart
- onPlayerVoiceStop
- onPlayerWasted
- onPlayerWeaponFire
- onPlayerWeaponSwitch
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled