Created
July 30, 2016 19:43
-
-
Save h3xcat/1a07ccc4fa275f469838666c75d2549b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timer.Simple( 3, function() | |
DarkRP.addPhrase('en', 'advert', '[Advert]') | |
local billboardfunction = DarkRP.getChatCommand("advert") | |
billboardfunction = billboardfunction['callback'] | |
DarkRP.removeChatCommand("advert") | |
-- https://github.com/FPtje/DarkRP/blob/4f282174556ba32082c6827066a70d9467c93e94/gamemode/modules/chat/sv_chatcommands.lua#L107 | |
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, DarkRP.getPhrase("advert") .. " " .. ply:Nick(), Color(255, 255, 0, 255), text, ply) | |
end | |
end | |
return args, DoSay | |
end | |
-- https://github.com/FPtje/DarkRP/blob/master/entities/entities/darkrp_billboard/shared.lua#L55 | |
DarkRP.declareChatCommand{ | |
command = "billboard", | |
description = "Create a billboard holding an advertisement.", | |
delay = 1.5 | |
} | |
-- https://github.com/FPtje/DarkRP/blob/4f282174556ba32082c6827066a70d9467c93e94/gamemode/modules/chat/sh_chatcommands.lua#L113 | |
DarkRP.declareChatCommand{ | |
command = "advert", | |
description = "Advertise something to everyone in the server.", | |
delay = 1.5 | |
} | |
if SERVER then | |
-- https://github.com/FPtje/DarkRP/blob/4f282174556ba32082c6827066a70d9467c93e94/gamemode/modules/chat/sv_chatcommands.lua#L124 | |
DarkRP.defineChatCommand("advert", PlayerAdvertise, 1.5) | |
-- https://github.com/FPtje/DarkRP/blob/master/entities/entities/darkrp_billboard/init.lua#L92 | |
DarkRP.defineChatCommand("billboard", billboardfunction) | |
end | |
end) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment