forked from cuberite/Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtell.lua
More file actions
28 lines (20 loc) · 856 Bytes
/
tell.lua
File metadata and controls
28 lines (20 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function HandleTellCommand(Split, Player, OtherPlayer)
if (Split[2] == nil) or (Split[3] == nil) then
SendMessage( Player, "Usage: /tell <player> <message>")
return true
end
local SendMessage = function(OtherPlayer)
Sender = Player:GetName()
Reciever = Split[2]
if (OtherPlayer:GetName() == Split[2]) then
local newSplit = table.concat( Split, " ", 3 )
SendMessageSuccess( Player, "Message to player " .. Reciever .. " sent!" )
-- Conforms to http://forum.mc-server.org/showthread.php?tid=1212
OtherPlayer:SendMessage(cChatColor.LightBlue .. "[MSG: " .. Sender .. "] " .. cChatColor.White .. newSplit )
return true
end
end
cRoot:Get():ForEachPlayer(SendMessage)
SendMessageFailure( Player, 'Player "' ..Split[2].. '" not found') -- Codepath comes here if no matching player was found
return true;
end