I'm trying to edit some darkrp chat outputs (specifically /advert, /g, /radio) to make the output something else.
For /advert;
I'm trying to make it output something different instead of [Advert] playername: text. I want it to output [Radio Broadcast] instead of [Advert].
Heres what I have so far for that:
[CODE]local function PlayerAdvertise(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
for k,v in pairs(player.GetAll()) do
local col = team.GetColor(ply:Team())
DarkRP.talkToPerson(v, col, "[Radio Broadcast]", .." "..ply:Nick(), Color(255,255,0,255), text, ply)
end
end
return args, DoSay
end
DarkRP.defineChatCommand("advert", PlayerAdvertise, 1.5)[/CODE]
For /radio, I want it to output "[Radio] Playername: text" and then after the command is called, i want it to say "Playername has spoken into their radio" in chat.
Heres what I have:
[CODE]local function SayThroughRadio(ply,args)
if not ply.RadioChannel then ply.RadioChannel = 1 end
if not args or 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
for k,v in pairs(player.GetAll()) do
if v.RadioChannel == ply.RadioChannel then
DarkRP.talkToPerson(v, Color(180,180,180,255), DarkRP.getPhrase("radio_x", ply.RadioChannel) .." "..ply:Nick(), Color(180,180,180,255), text, ply)
return ply:ChatPrint(ply.Nick(), "spoke into their radio.")
end
end
end
return args, DoSay
end
DarkRP.defineChatCommand("radio", SayThroughRadio, 1.5)[/CODE]
And for /g, I want the same principle as above, for it to say "Playername has spoken into their radio" after the command is called.
I have:
[CODE]local function GroupMsg(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
local t = ply:Team()
local col = team.GetColor(ply:Team())
local hasReceived = {}
for _, func in pairs(GAMEMODE.DarkRPGroupChats) do
-- not the group of the player
if not func(ply) then continue end
for _, target in pairs(player.GetAll()) do
if func(target) and not hasReceived[target] then
hasReceived[target] = true
DarkRP.talkToPerson(target, col, DarkRP.getPhrase("group") .. " " .. ply:Nick(), Color(255,255,255,255), text, ply)
return ply:ChatPrint(ply.Nick(), "spoke into their radio.")
end
end
end
if next(hasReceived) == nil then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("unable", "/g", ""))
end
end
return args, DoSay
end
DarkRP.defineChatCommand("g", GroupMsg, 1.5)[/CODE]
i don't want any shit from people saying darkrp is a gamemode for killing everyone in sight or something. i don't care.
[editline]14th June 2015[/editline]
Done /advert, just had to remove the comma after the [Radio Broadcast]
[editline]14th June 2015[/editline]
Done /g and /radio
changed "return ply:ChatPrint(ply.Nick(), "spoke into their radio.")" to "return ply:ChatPrint(ply:Nick().." ".."spoke into their radio.")"
Sorry, you need to Log In to post a reply to this thread.