Since I am such a kind person( sarcasm intended ), I'll help you out, even though I am thoroughly annoyed by your constant capitalizing of "CONSOLE."
In my examples, ChatInterface is a table of functions for controlling the chat, and System is basically the player interaction class.
For joining and leaving,
game:service'Players'.playerAdded:connect(
function(Player)
Player:waitForChild'PlayerGui';
System.Connect(Player);
ChatInterface.GlobalAnnounce(
'[ CONSOLE ]',
'%s has joined the server.',
'Really blue',
Player.Name);
end);
game:service'Players'.playerRemoving:connect(
function(Player)
System.Disconnect(Player,'Disconnected');
end);
For earning points,
System.AwardPoints=function(Player,Points)
local Client=System.Clients[Player.Name]
or System.Connect(Player);
Client:SetStats(
'Points',
Client:getStats('Points')+Points);
ChatInterface.GlobalAnnounce(
'[ CONSOLE ]',
'%s has earned %d points!',
'New Yeller',
{Exception=Client.Name},
Client.Name,
Points);
ChatInterface.SendMessage(
'[ CONSOLE ]',
Client,
'You have earned %d points!',
'New Yeller',
Points);
end;
For spamming,
System.OnChatted=function(Player,Message)
local Client=System.Clients[Player.Name] or System.Connect(Player);
local Time,Spam=tick();
if(Client.LastSpoke-Time>3)then
Client.MessagesSpammed=Client.MessagesSpammed+1;
else
Client.MessagesSpammed=0;
end;
if(Client.MessagesSpammed>=5 and Client.MessagesSpammed<15)then
ChatInterface.SendMessage(
'[ CONSOLE ]',
Client,
'Please stop spamming.'..(
Client.MessagesSpammed<10 and''or
' You have '..15-Client.MessagesSpammed..' chances left.'),
'Really red');
Spam=true;
elseif(Client.MessagesSpammed>=15)then
System.Disconnect(Client,'Spam');
end;
Client.LastSpoke=Time;
if(not Spam)then
ChatInterface.GlobalChat(
string.format(
(Client.IsAdmin and '~%s~'or''),
Client.Name
),
ChatInterface.FilterString(Message,System:playersUnder13()),
ChatInterface.ChatColor(Client.Name)
);
end;
end;
You better credit me.
1 comment
It doesn't seem to work.