-- AdminScript (ServerScript) – in ServerScriptService einfügen
-- =====================================================
local Players = game:GetService("Players")
local admins = {
-- Füge hier Benutzernamen ein
["DeinUsername"] = "owner", -- Rank: owner
["Freund1"] = "admin", -- Rank: admin
["Freund2"] = "mod", -- Rank: mod
}
local prefix = "!" -- Befehlspräfix (z.B. !kick Spieler)
-- Rang-Berechtigungen prüfen
local rankLevel = { owner = 3, admin = 2, mod = 1 }
local function getRank(player)
return admins[player.Name] or "none"
end
local function hasPermission(player, minRank)
local rank = getRank(player)
return (rankLevel[rank] or 0) >= (rankLevel[minRank] or 99)
end
local function findPlayer(name)
for _, p in pairs(Players:GetPlayers()) do
if p.Name:lower():find(name:lower()) then
return p
end
end
end
-- Befehle definieren
local commands = {}
commands["kick"] = {
rank = "mod",
run = function(sender, args)
local target = findPlayer(args[1] or "")
if target then
target:Kick(args[2] or "Du wurdest gekickt.")
end
end
}
commands["kill"] = {
rank = "mod",
run = function(sender, args)
local target = findPlayer(args[1] or "")
if target and target.Character then
target.Character:BreakJoints()
end
end
}
commands["speed"] = {
rank = "admin",
run = function(sender, args)
local target = findPlayer(args[1] or "")
local val = tonumber(args[2]) or 16
if target and target.Character then
target.Character.Humanoid.WalkSpeed = val
end
end
}
commands["jump"] = {
rank = "admin",
run = function(sender, args)
local target = findPlayer(args[1] or "")
local val = tonumber(args[2]) or 50
if target and target.Character then
target.Character.Humanoid.JumpPower = val
end
end
}
commands["tp"] = {
rank = "admin",
run = function(sender, args)
local target = findPlayer(args[1] or "")
if target and target.Character and sender.Character then
target.Character.HumanoidRootPart.CFrame =
sender.Character.HumanoidRootPart.CFrame
end
end
}
commands["admin"] = {
rank = "owner",
run = function(sender, args)
local name = args[1] or ""
local rank = args[2] or "mod"
admins[name] = rank
local t = findPlayer(name)
if t then
game.ReplicatedStorage.AdminNotify:FireClient(
t, "Du hast Rang: " .. rank)
end
end
}
commands["unadmin"] = {
rank = "owner",
run = function(sender, args)
admins[args[1] or ""] = nil
end
}
commands["heal"] = {
rank = "mod",
run = function(sender, args)
local target = findPlayer(args[1] or sender.Name)
if target and target.Character then
target.Character.Humanoid.Health =
target.Character.Humanoid.MaxHealth
end
end
}
-- RemoteEvent für Benachrichtigungen erstellen
local rs = game:GetService("ReplicatedStorage")
local notify = Instance.new("RemoteEvent")
notify.Name = "AdminNotify"
notify.Parent = rs
-- Chat-Listener
Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg:sub(1, #prefix) ~= prefix then return end
local parts = msg:sub(#prefix + 1):split(" ")
local cmd = parts[1]:lower()
local args = {}
for i = 2, #parts do args[i-1] = parts[i] end
local c = commands[cmd]
if c then
if hasPermission(player, c.rank) then
c.run(player, args)
else
notify:FireClient(player, "❌ Keine Berechtigung!")
end
end
end)
end)
Comments
No comments yet
Be the first to share your thoughts!