Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local Debris = game:GetService("Debris")
- -- รายการคำสั่งที่ยอมรับได้ (ผู้เล่นตายจากคำสั่งเหล่านี้จะไม่ถูกแบน)
- local allowedCommands = {
- ":kill all", ":explode all", ":reset all", ":smite all", ":pipe all",
- ":kill ", ":explode ", ":reset ", ":smite ", ":pipe "
- }
- -- เก็บประวัติการฆ่าผู้เล่น
- local killLogs = {}
- -- ฟังก์ชันตรวจสอบการตายของผู้เล่น
- local function onPlayerDied(player, humanoid)
- local killer = killLogs[player.UserId]
- -- ตรวจสอบว่าการตายเกิดจากอะไร
- if humanoid and humanoid:FindFirstChild("creator") then
- local creator = humanoid.creator.Value -- ตรวจสอบว่าผู้เล่นถูกฆ่าโดยใคร
- -- ถ้าผู้เล่นถูกฆ่าโดยไอเท็มของเกมเอง → ไม่ถือว่าโกง
- if creator and creator:IsA("Player") then
- return
- end
- end
- -- ถ้ามีคนฆ่า และไม่ใช่ระบบเกมปกติ ให้ตรวจสอบว่าเป็นการโกงหรือไม่
- if killer and killer == "SCRIPT_EXECUTION" then
- local bannedPlayer = Players:GetPlayerByUserId(killer)
- if bannedPlayer then
- bannedPlayer:Kick("คุณถูกแบนเนื่องจากใช้สคริปต์โกง")
- end
- end
- end
- -- ตรวจจับการตายของผู้เล่น
- Players.PlayerAdded:Connect(function(player)
- player.CharacterAdded:Connect(function(character)
- local humanoid = character:FindFirstChildOfClass("Humanoid")
- if humanoid then
- humanoid.Died:Connect(function()
- onPlayerDied(player, humanoid)
- end)
- end
- end)
- end)
- -- ตรวจจับการใช้คำสั่งแชท
- Players.PlayerAdded:Connect(function(player)
- player.Chatted:Connect(function(message)
- -- ตรวจสอบว่าคำสั่งที่ใช้เป็นคำสั่งที่อนุญาตหรือไม่
- for _, cmd in pairs(allowedCommands) do
- if string.find(string.lower(message), string.lower(cmd)) then
- return -- ไม่ถือว่าโกง
- end
- end
- -- ตรวจสอบว่ามีการใช้ loadstring หรือโค้ดต้องห้ามหรือไม่
- if string.find(message, "loadstring") or string.find(message, "require") then
- player:Kick("คุณถูกแบนเนื่องจากใช้สคริปต์ที่ผิดกฎ")
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement