Created
November 11, 2024 19:47
-
-
Save na-stewart/bb51c262611fa925a2fc136f1043f421 to your computer and use it in GitHub Desktop.
Garry's Mod SAM advert command.
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
if SAM_LOADED then return end | |
local sam, command, language = sam, sam.command, sam.language | |
command.set_category("Advert") | |
sam.command.new("tsay") | |
:SetPermission("tsay", "trialstaff") | |
:Help("This will put a message in chat everyone will be able to see.") | |
:GetRestArgs(true) | |
:AddArg("text") | |
:OnExecute(function(calling_ply, targets) | |
net.Start("Announce") | |
net.WriteString(targets) | |
net.Broadcast() | |
end) | |
:End() | |
if SERVER then | |
util.AddNetworkString("Announce") | |
else | |
net.Receive("Announce", function() | |
chat.AddText(Color(255, 0, 0), "[All]: ", Color(255, 255, 255), net.ReadString()) | |
end) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment