OnPlayerStealthKill: Difference between revisions
Jump to navigation
Jump to search
Spider Pork (talk | contribs) |
Spider Pork (talk | contribs) |
||
Line 23: | Line 23: | ||
[lua] | [lua] | ||
function onStealthKill(targetPlayer) | function onStealthKill(targetPlayer) | ||
outputChatBox("Stealth kill!", source) | outputChatBox("Stealth kill!", source) -- Tell the player he/she has done a stealth kill. | ||
outputChatBox("" .. getPlayerName(targetPlayer) .. " has been stealth-killed by " .. getPlayerName(source) .. ".", source) | outputChatBox("" .. getPlayerName(targetPlayer) .. " has been stealth-killed by " .. getPlayerName(source) .. ".", source) | ||
end | end | ||
addEventHandler("onPlayerStealthKill", getRootElement(), onStealthKill) | addEventHandler("onPlayerStealthKill", getRootElement(), onStealthKill) -- Adds a handler for the stealth kill event. | ||
</syntaxhighlight> | |||
</section> | |||
<section name="Server" class="server" show="true"> | |||
<syntaxhighlight lang="lua"> | |||
[lua] | |||
function 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. | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> |
Revision as of 14:39, 3 June 2010
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 [-]
Server[lua] function 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) .. ".", source) end addEventHandler("onPlayerStealthKill", getRootElement(), onStealthKill) -- Adds a handler for the stealth kill event.
Click to collapse [-]
Server[lua] function 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.
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