Added notification sound for /r + now also displayed for sender (issue #52)

This commit is contained in:
Timo Smit 2016-02-25 12:49:49 +01:00
parent 356e6951ce
commit 6a76718c01

View file

@ -27,15 +27,25 @@ function commandR(clientId, cmdArguments)
if not (recipient and et.gentity_get(recipient, "pers.netname")) then if not (recipient and et.gentity_get(recipient, "pers.netname")) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"player not found\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"player not found\";")
else else
local message = {} local message, messageConcatenated = {}, ""
for i = 1, #cmdArguments do for i = 1, #cmdArguments do
message[i] = cmdArguments[i] message[i] = cmdArguments[i]
end end
messageConcatenated = table.concat(message, " ")
stats.set(recipient, "lastMessageFrom", clientId) stats.set(recipient, "lastMessageFrom", clientId)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..recipient.." \"^7"..et.gentity_get(clientId, "pers.netname").."^7 -> "..recipient.." (1 recipients): ^3"..table.concat(message, " ").."\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..clientId.." \"^7"..et.gentity_get(clientId, "pers.netname").."^7 -> "..recipient..": (1 recipients): ^3"..messageConcatenated.."\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "playsound "..clientId.." \"sound/misc/pm.wav\";")
if clientId ~= recipient then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..recipient.." \"^7"..et.gentity_get(clientId, "pers.netname").."^7 -> "..recipient..": (1 recipients): ^3"..messageConcatenated.."\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "playsound "..clientId.." \"sound/misc/pm.wav\";")
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "ccp "..recipient.." \"^3private message from "..et.gentity_get(clientId, "pers.netname").."\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..recipient.." \"^9reply: ^7r [^2message^7]\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..recipient.." \"^9reply: ^7r [^2message^7]\";")
end end
end end