Skip to content

PlayPlayerEmote

Makes a player perform an emote - the heart of an emote command.

As if they had picked it on the wheel - the server’s own rules still apply (in the world and alive, standing still on foot, no weapon out, not fighting) but OnPlayerEmote is not asked. A new emote replaces the one playing. When it cannot play, the second value says why in words the player can read (“Stand still first.”, “Put your weapon away first.”, “There is no emote ‘juggle’ here.” …), ready for the chat.

PlayPlayerEmote(pid, name)
Parameter Type
pid number the player
name string the emote (any case)

true, or false, reason - the reason as the player reads it ("Stand still first.", "There is no emote 'juggle' here." …)

-- the shipped modes' /anim: /anim <name> plays one, /anim stop ends it, /anim alone lists them
function OnPlayerCommandText(pid, cmd, args)
if cmd == "anim" then
local name = args:match("^(%S+)")
if not name then
SendClientMessage(pid, COLOR_SERVER, "anims: " .. table.concat(GetEmotes(), ", ") .. " - /anim <name>, /anim stop")
elseif name:lower() == "stop" then
if not StopPlayerEmote(pid) then SendClientMessage(pid, COLOR_SERVER, "No animation is playing.") end
else
local ok, why = PlayPlayerEmote(pid, name)
if not ok then SendClientMessage(pid, COLOR_RED, why) end
end
return true
end
return false
end
-- the winner of a duel cheers
function OnPlayerDeath(victim, killer)
if killer >= 0 then PlayPlayerEmote(killer, "cheer") end
end

StopPlayerEmote · GetEmotes · GetPlayerEmote · OnPlayerEmote · the Emotes group of the index