Skip to content

OnPlayerPickpocketEnd

A pickpocket session is over - what came of it.

outcome is "took" (stacks moved - taken of them), "nothing" (the minigame ended with nothing taken, or all of it was vetoed or gone), "caught" (the game’s own roll caught the thief in the charge, or he failed the tile game - nothing moves; the consequence is the mode’s: tell the victim, start a fight with StartFight, call the guards) or "cancelled" (the session was broken off; nothing taken).

reason says why. For the outcomes the game decides it is the game’s own: "succeeded", "detected" (the victim noticed - what a caught thief usually says), "seen" (someone saw), "lost" (the thief walked off or looked away: the game’s own break without a crime - the game can end a "caught" with it, so read the reason before you punish), "interrupted", "nothing stolen" or "unknown". For "cancelled" it is "broken off" (the thief’s game), "thief died", "victim died", "thief left", "victim left", "respawned", "moved" (the server moved one of them), "moved away" (past the range and a metre), "mounted", "cart", "flying", "knocked out", "carried", "carrying" (one of the two started carrying someone), "busy", "fight", "timeout" (ninety seconds), "victim gone" (an NPC actor removed), "world" (another virtual world), "too fast" or "bad claim" (a claim the server refused), or the word the mode gave CancelPickpocket ("mode" when it gave none).

A player who leaves the server is still one here: the session ends before OnPlayerDisconnect. A mode reload ends sessions without a word to the mode. victim and actor are as in OnPlayerPickpocketStart.

function OnPlayerPickpocketEnd(pid, victim, actor, outcome, reason, taken)
-- ...
end
Parameter Type
pid number the thief
victim number the player robbed; -1 for an actor
actor number the NPC actor robbed; -1 for a player
outcome string "took", "nothing", "caught" or "cancelled"
reason string why it ended
taken number how many stacks moved

nothing

function OnPlayerPickpocketEnd(pid, victim, actor, outcome, reason, taken)
if victim < 0 then return end
if outcome == "took" then
SendClientMessage(victim, COLOR_SERVER, "Your pockets feel lighter.")
elseif outcome == "caught" and (reason == "detected" or reason == "seen") then
SendClientMessage(victim, COLOR_SERVER, GetPlayerName(pid) .. " had a hand in your pocket!")
StartFight(pid, victim)
end
end

OnPlayerPickpocketStart · OnPlayerPickpocket · CancelPickpocket · the Pickpocketing group of the index