All pastes #686681 Raw Edit

Administration Script

public lua v1 · immutable
#686681 ·published 2007-09-08 02:48 UTC
rendered paste body
-- Anaminusprint("Chat: Administration")permission = {"Anaminus"}function check(name)	if table.maxn(permission) == 0 then print("No admins") return true end --Remove all names from permission to allow all players to use command.	for i = 1,#permission do		if (string.upper(name) == string.upper(permission[i].Name)) then return true end	end	return falseendfunction DisplayMessage(text, Wait, parent)	local message = Instance.new("Message")	message.Text = text	message.Name = "Message"	message.Parent = parent	wait(Wait)	message.Parent = nilendfunction admin(name, source)	if (name == source.Name) then DisplayMessage("Can't administrate yourself!",3,source) return end	if check(string.lower(name)) then DisplayMessage(name.." is already an admin!",3,source) return end	table.insert(permission, name)	DisplayMessage("You are now an admin", 3, game.Players:FindFirstChild(name))endfunction deadmin(name, source)--	if (name == source.Name) then DisplayMessage("Can't deadministrate yourself!",3,source) return end	if not check(string.lower(name)) then DisplayMessage("But "..name.." isn't an admin...",3,source) return end	local ch = table.maxn(permission)	for n = 1,ch do		if permission[n]==name then			table.remove(permission,n)			DisplayMessage("You are no longer an admin", 3, game.Players:FindFirstChild(name))		end	endendfunction onChatted(msg, recipient, speaker)	-- convert to all lower case	local source = string.lower(speaker.Name)	msg = string.lower(msg)	-- Below is only for Admins	if not check(source) then return end		if string.match(msg, "/administrate") then		local players=game.Players:GetChildren()		for i=1, #players do			if string.match(msg, string.lower(players[i].Name)) then				admin(players[i].Name, speaker)				return			end		end	end	if string.match(msg, "/deadmin") then		local players=game.Players:GetChildren()		for i=1, #players do			if string.match(msg, string.lower(players[i].Name)) then				deadmin(players[i].Name, speaker)				return			end		end	endendfunction onPlayerEntered(newPlayer)	newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) endgame.Players.ChildAdded:connect(onPlayerEntered)