Hello everybody,
I want to create a new chat command for DarkRP.
That is to send a message in anonymous to everyone and a message to the admins with the name of the player and the text.
I have found a code for this:
[CODE]local config = AnoConfig
local function Anonymous(ply, args)
if args == "" then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
return ""
end
local DoSay = function(text)
if text == "" then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
return
end
if ply:IsStaff() then
for k,v in pairs(player.GetAll()) do
DarkRP.talkToPerson(v, config.colorprefixe, config.chatprefixe, Color(255, 255, 255, 255), text, ply)
end
else
for k,v in pairs(player.GetAll()) do
DarkRP.talkToPerson(v, config.colorprefixe, config.chatprefixe, Color(255, 255, 255, 255), text, ply)
end
end
end
return args, DoSay
end
DarkRP.defineChatCommand(config.cmd, Anonymous, 1.5)
DarkRP.declareChatCommand{
command = config.cmd,
description = "Speak in unknown person",
delay = 1.5
}}[/CODE]
It works but it didn't send a message to the admin,
So I have added
[CODE]DarkRP.talkToPerson(v, config.colorprefixe, ply:Nick(), Color(255, 255, 255, 255),"@ I wrote anonymously:" .. text, ply)[/CODE]
After the two DarkRP.talkToPerson before, it work but it didn't send the message to admin chat, it just write "@ ..."
Can you help me please ?
(I think a lot of this code is useless but I'm not a god, that's why I need your help D: )
Sorry, you need to Log In to post a reply to this thread.