-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprivatemessaging.lua
More file actions
executable file
·36 lines (29 loc) · 1.17 KB
/
privatemessaging.lua
File metadata and controls
executable file
·36 lines (29 loc) · 1.17 KB
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
27
28
29
30
31
32
33
34
35
36
--not my plugin, updated to support oxide 1.8
--see more info at: http://forum.rustoxide.com/resources/private-messaging.4/
PLUGIN.Title = "Private Messaging"
PLUGIN.Description = "Allows players to talk to each other privately"
function PLUGIN:Init()
self:AddChatCommand("pm", self.cmdWhisper)
end
function PLUGIN:cmdWhisper( netuser, cmd, args )
if (#args < 2) then
rust.Notice(netuser, "Syntax: /pm \"name\" message ")
return
end
local b, targetuser = rust.FindNetUsersByName(args[1])
if (not b) then
if (targetuser == 0) then
rust.Notice(netuser, "No players found with that name!")
else
rust.Notice(netuser, "Multiple players found with that name!")
end
return
end
table.remove(args, 1)
local message = util.QuoteSafe( table.concat(args, " ") )
rust.RunClientCommand(targetuser, "chat.add \"(PM) from " .. rust.QuoteSafe( netuser.displayName ) .. " \" \"" .. message .. "\"" )
rust.RunClientCommand(netuser, "chat.add \"(PM) to " .. rust.QuoteSafe( targetuser.displayName ) .. " \" \"" .. message .. "\"" )
end
function PLUGIN:SendHelpText( netuser )
rust.SendChatToUser( netuser, "Use /pm to send a private message." )
end