Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- support pastern
- --[[
- Welcome to Knighmare Anti-Cheat Service
- Code Author Contact (KnightMB)
- https://devforum.roblox.com/u/knightmb1
- -----------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------
- -- CONFIGURATION SECTION START
- -----------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------
- -- PLAYER MOVEMENT SPEED ANTI-CHEAT
- --
- If you want to ignore a certain player for Speed Cheat Detection, then
- set an attribute called "KM_IGNORE_PLAYER_SPEED_CHEAT" to true on that specific player
- object. This can be used to create exceptions when needed if the anti-cheat service is causing
- issues with specific parts of your game.
- If you need to teleport a player and only need a temporary exception, then set this
- attribute to true on the player instead, "KM_SPEED_TEMPORARY_EXCEPTION" This will be removed
- after a speed cheat is detected one time.
- Set this to false if you want to turn off all Speed Cheat Detection Server Wide
- Default = true
- --]]
- speedCheatDetectionEnabled = true
- --[[
- Set this to true if you want the server to output Debug info for Speed Cheat Detection.
- This is helpful when trying to fine tune settings for your game through testing.
- Default = false
- --]]
- debugSpeedCheatDetection = true
- --[[
- Max Speed Player Can Move Period. This will set a "speed limit" on the player
- that when exceeded, will increment a counter of how many times the player is moving
- faster than what should be allowed in your game.
- Every player will have an attribute set on the player object as "KM_MAX_PLAYER_SPEED"
- This means you can change the max speed on the specific player anytime you want to, such
- as using powerups or abilities or just running as an example. The anti-cheat
- service will re-calibrate to the new speed limit.
- Default = 16
- --]]
- maxPlayerSpeed = 0
- --[[
- What percentage of the speed reading can be above the Max Player Speed and not
- trigger a speed cheat detection.
- 0.20 is a 20% margin of error on the speed readings due to different client devices
- or Internet latency that can make the measured speed a little higher than normal.
- You can tweak this number if false detections are an issue in game by using a higher
- number to allow more flexibility.
- Default = 0.20 percent
- --]]
- clientPredictionFudge = 0.20
- --[[
- If you have no "falling" in your game, you can turn off this additional check.
- Default = false
- --]]
- ignoreFreeFalling = true
- --[[
- Normally speed is checked in 3 dimensions, so running up stairs is faster than running
- along a flat path distance wise. If your game is having a lot of false detections because of
- really long stairs or hills, disable this to use only the X and Z dimensions speed for checking by
- setting this value to true. Basically ignoring the Y dimension of the player moving up or down.
- Default = false
- --]]
- excludeYDimension = true
- --[[
- How long to ignore Free Fall in seconds when ignoreFreeFalling is set to false above.
- Once the timer expires, the speed will be tracked again to check for speed cheat
- detections even when falling.
- Default = 2.0 seconds
- --]]
- maxFreeFallTime = 2.0
- --[[
- How many bunny hops can a player make when ignoreFreeFalling is set to false above.
- A speed cheater might try to bunny hop and speed cheat when the service is ignoring
- free fall time. This will help stop that.
- Default = 1
- --]]
- maxBunnyHops = 1
- --[[
- If a player is bunny hoping too much, how long do they need to stop before the max
- bunny hops are reset.
- Default = 2.0 seconds
- --]]
- maxBunnyHopTimeout = 2.0
- --[[
- The number of times the speed limit can be broken before acting on the player.
- When a player is not speed cheating, this number will increment back down to zero.
- The player is scanned 5 times per second, so the default gives them about 2 seconds
- to stop cheating before the penalty is applied.
- Because of Internet latency, it is recommended not to set this number too low
- or you'll end up getting false detections on a player with a slow device or lag.
- Default = 10
- --]]
- maxSpeedCheatDetects = 5
- --[[
- This will send the Speed Cheater Back to their Last Location before the Speed Cheating
- max threshold was reached. Set this to false if you want to implement your own form of punishment :)
- Look in the "KnightmareCustomPunishment" file to find the proper section related to this cheat.
- If you want both soft punishment and custom punishment, this is possible by setting this option
- to "both" using full quotation marks.
- Default = true
- --]]
- sendSpeedCheaterBack = true
- -- PLAYER MOVEMENT SPEED ANTI-CHEAT
- -----------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------
- -- PLAYER FLYING ANTI-CHEAT
- --[[
- If you want to ignore a certain player for Fly Cheat Detection, then
- set an attribute called "KM_IGNORE_PLAYER_FLY_CHEAT" to true on that specific player
- object. This can be used to create exceptions when needed if the anti-cheat service is causing
- issues with specific parts of your game.
- Set this to false if you want to turn off all Fly Cheat Detection Server Wide
- Default = true
- --]]
- flyCheatDetectionEnabled = true
- --[[
- Set this to true if you want the server to output Debug info for Fly Cheat Detection.
- This is helpful when trying to fine tune settings for your game through testing.
- Default = false
- --]]
- debugFlyCheatDetection = true
- --[[
- If you have no "climbing" in your game, you can turn off this additional check.
- Default = false
- --]]
- ignoreClimbing = false
- --[[
- If you have no "swimming" in your game, you can turn off this additional check.
- Default = false
- --]]
- ignoreSwimming = false
- --[[
- When ray casting from the player legs, how far down to look for a
- solid object to be standing on.
- Default = 1.5 studs
- --]]
- maxGroundDistance = 1.5
- --[[
- When radius casting from the player legs, how far to look in a sphere for a
- solid object to be standing on sideways.
- Default = 1.0 studs
- --]]
- maxRadiusToObjectDistance = 1.0
- --[[
- When a player is floating, this will boost the scan distance to help find
- a collideable object underneath in case they are riding down a falling
- object at the same rate that the object is falling. Lag can make this
- appear to float to the anti-cheat and cause false detections.
- Default = 1.5 studs
- --]]
- boostFloatingDistanceScan = 1.5
- --[[
- If the player IS moving and nothing is under the player that keeps them
- from falling, how long can they be in this state?
- Default = 3.0 seconds
- --]]
- maxMovingFloatTime = 3.0
- --[[
- Which way is down?
- Default = Y axis
- --]]
- iDownDirection = "Y"
- --[[
- If a player is not standing on an object or slope, they might be
- falling or jumping. If they are floating in the air via hacks, they will
- have no linear velocity. If they are using a gravity cheat, this can also be detected.
- Default = 7.0
- --]]
- minimumLinearVelocity = 7.0
- --[[
- The number of times the fly cheat can be broken before acting on the player.
- When a player is not fly cheating, this number will increment back down to zero.
- The player is scanned 5 times per second, so the default gives them about 2 seconds
- to stop cheating before the penalty is applied.
- Because of Internet latency, it is recommended not to set this number too low
- or you'll end up getting false detections on a player with a slow device or lag.
- Default = 10
- --]]
- maxFlyCheatDetects = 10
- --[[
- This records where the player was last standing on a solid object before the next scan
- determined the player was in the air. This will be used by the soft punishment to send the
- player back to the last ground position instead of straight down to the solid object underneath
- when enabled. This will also be passed to the custom punishment file if enabled.
- Change this setting to true if you want to use this configuration option.
- Default = false
- --]]
- recordFlyGroundPosition = false
- --[[
- This will send the Fly Cheater down to the ground when the maxFlyCheatDetects threshold
- is reached. Set this to false if you want to implement your own form of punishment :)
- Look in the "KnightmareCustomPunishment" file to find the proper section related to this cheat.
- If you want both soft punishment and custom punishment, this is possible by setting this option
- to "both" using full quotation marks.
- Default = true
- --]]
- sendFlyCheaterToGround = true
- -- PLAYER FLYING ANTI-CHEAT
- -----------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------
- -- PLAYER TELEPORT ANTI-CHEAT
- --[[
- If you want to ignore a certain player for Teleport Cheat Detection, then
- set an attribute called "KM_IGNORE_PLAYER_TELEPORT_CHEAT" to true on that specific player
- object. This can be used to create exceptions when needed if the anti-cheat service is causing
- issues with specific parts of your game.
- If you need to teleport a player and only need a temporary exception, then set this
- attribute to true on the player instead, "KM_TELEPORT_TEMPORARY_EXCEPTION" This will be removed
- after a teleport cheat is detected one time.
- Set this to false if you want to turn off all Teleport Cheat Detection Server Wide
- Default = true
- --]]
- teleportCheatDetectionEnabled = true
- --[[
- Set this to true if you want the server to output Debug info for Teleport Cheat Detection.
- This is helpful when trying to fine tune settings for your game through testing.
- Default = false
- --]]
- debugTeleportCheatDetection = true
- --[[
- Maximum distance that no player could ever cover in 0.2 seconds and considered
- an automatic cheat and punishment. Helps with blatant teleport cheating.
- Default = 50 studs
- --]]
- maxLongRangeTeleport = 100
- --[[
- Maximum distance a player can push through any solid object within a 0.2 seconds
- time frame. If your walls or doors are smaller than this, you can tune this setting.
- Default = 1 stud
- --]]
- maxShortRangeTeleport = 80
- --[[
- Ignore teleport detection through other players. If your game allows players to walk
- through each other, it can set off false teleport detections. Enable this with a true
- setting and anything on the player model will be ignored when moving through another
- player.
- Default = false
- --]]
- ignoreTeleportOtherPlayers = true
- --[[
- Ignore teleport detection through specific models chosen by the developer. This will ignore
- all descendant parts of this model. The model needs the attribute "KM_TELEPORT_IGNORE_MODEL"
- set to true. This can be assigned in Studio via a boolean attribute or manually during run-time
- with a script if preferred.
- Default = false
- --]]
- ignoreTeleportExceptionModels = true
- --[[
- This will send the Teleport Cheater Back to their Last Location before the Teleport Cheating
- threshold was reached. Set this to false if you want to implement your own form of punishment :)
- Look in the "KnightmareCustomPunishment" file to find the proper section related to this cheat.
- If you want both soft punishment and custom punishment, this is possible by setting this option
- to "both" using full quotation marks.
- Default = true
- --]]
- sendTeleportCheaterBack = true
- -- PLAYER TELEPORT ANTI-CHEAT
- -----------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------
- -- PLAYER JUMP ANTI-CHEAT
- --[[
- If you want to ignore a certain player for Jump Cheat Detection, then
- set an attribute called "KM_IGNORE_PLAYER_JUMP_CHEAT" to true on that specific player
- object. This can be used to create exceptions when needed if the anti-cheat service is causing
- issues with specific parts of your game.
- If you need a temporary exception, then set this attribute to true on the player
- instead, "KM_JUMP_TEMPORARY_EXCEPTION" This will be removed after a jump cheat is detected one time.
- Set this to false if you want to turn off all Jump Cheat Detection Server Wide
- Default = true
- --]]
- jumpCheatDetectionEnabled = true
- --[[
- Set this to true if you want the server to output Debug info for Jump Cheat Detection.
- This is helpful when trying to fine tune settings for your game through testing.
- Default = false
- --]]
- debugJumpCheatDetection = false
- --[[
- Which way is down?
- Default = Y axis
- --]]
- iJumpDownDirection = "Y"
- --[[
- Which way is jump movement? Usually Positive Numbers, but in case you
- have a different type of game world.
- P = Positive
- N = Negative
- Default = P
- --]]
- iJumpMovement = "P"
- --[[
- Max Player Jump Power. This will be the "jump power" limit on the player that
- when exceeded will act on the player.
- Every player will have an attribute set on the player object as "KM_MAX_JUMP_POWER"
- This means you can change the max jump power of a specific player anytime you want,
- such as using power-ups or abilities. The anti-cheat service will re-calibrate to the
- new jump power limit.
- Default = 13
- --]]
- maxPlayerJumpPower = 0
- --[[
- When ray casting from the player legs, how far down to look for a
- solid object to be standing on.
- Default = 1.5 studs
- --]]
- maxJumpGroundDistance = 1.5
- --[[
- If you have no "climbing" in your game, you can turn off this additional check.
- Default = false
- --]]
- ignoreJumpClimbing = false
- --[[
- If you have no "swimming" in your game, you can turn off this additional check.
- Default = false
- --]]
- ignoreJumpSwimming = false
- --[[
- This will stop the player in mid-air by resetting their Jump velocity back to 0 so they fall
- back down to the ground. Set this to false if you want to implement your own form of punishment :)
- Look in the "KnightmareCustomPunishment" file to find the proper section related to this cheat.
- If you want both soft punishment and custom punishment, this is possible by setting this option
- to "both" using full quotation marks.
- Default = true
- --]]
- stopJumpCheater = true
- -- PLAYER JUMP ANTI-CHEAT
- -----------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------
- -- GLOBAL SETTINGS
- --[[
- Set Text Color in the Debug GUI.
- Default = Color3.fromRGB(170, 255, 255)
- --]]
- debugGUITextColor = Color3.fromRGB(170, 255, 255)
- --[[
- Set Text Size of the Debug GUI
- Default = 14
- --]]
- debugGUITextSize = 14
- --[[
- Set Horizontal Size Percentage of the Debug GUI relative to your Screen size
- Default = 0.35 -> 35%
- --]]
- debugGUISizeX = 0.35
- --[[
- Set Vertical Size Percentage of the Debug GUI relative to your Screen size
- Default = 0.35 -> 35%
- --]]
- debugGUISizeY = 0.35
- -- GLOBAL SETTINGS
- -----------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------
- -- CONFIGURATION SECTION END
- -----------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------
- -- SETUP MAIN ANTI-CHEAT SERVICE - DO NOT MODIFY CODE BELOW THIS
- -----------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------
- -- Does Knightmare Anti-Cheat Service From Network Update Exist?
- local oCopy = game:GetService("ServerScriptService"):FindFirstChild("KnightmareAntiCheatService")
- if not oCopy then
- -- Network Update Failed, Use Local Copy
- oCopy = script.Parent:FindFirstChild("KnightmareAntiCheatService")
- if oCopy then
- -- Local Copy Exist, Use That Instead
- oCopy = oCopy:Clone()
- oCopy.Parent = game:GetService("ServerScriptService")
- print("Loading Local Copy of Knightmare Anti-Cheat Service")
- else
- -- Could Not Find Local Copy of Service to Start
- warn("Knightmare Anti-Cheat Service Failed to Load Neither Network nor Local Code!!")
- return
- end
- end
- -- Move Custom Punishments to Server Storage to Access Later
- script.Parent.KnightmareCustomPunishment.Parent = game:GetService("ServerStorage")
- task.wait()
- -- Copy Variable to Knightmare Anti-Cheat Service From This Configuration File
- oCopy:SetAttribute("speedCheatDetectionEnabled", speedCheatDetectionEnabled)
- oCopy:SetAttribute("debugSpeedCheatDetection", debugSpeedCheatDetection)
- oCopy:SetAttribute("maxPlayerSpeed", maxPlayerSpeed)
- oCopy:SetAttribute("clientPredictionFudge", clientPredictionFudge)
- oCopy:SetAttribute("ignoreFreeFalling", ignoreFreeFalling)
- oCopy:SetAttribute("excludeYDimension", excludeYDimension)
- oCopy:SetAttribute("maxFreeFallTime", maxFreeFallTime)
- oCopy:SetAttribute("maxBunnyHops", maxBunnyHops)
- oCopy:SetAttribute("maxBunnyHopTimeout", maxBunnyHopTimeout)
- oCopy:SetAttribute("maxSpeedCheatDetects", maxSpeedCheatDetects)
- oCopy:SetAttribute("sendSpeedCheaterBack", sendSpeedCheaterBack)
- oCopy:SetAttribute("flyCheatDetectionEnabled", flyCheatDetectionEnabled)
- oCopy:SetAttribute("debugFlyCheatDetection", debugFlyCheatDetection)
- oCopy:SetAttribute("ignoreClimbing", ignoreClimbing)
- oCopy:SetAttribute("ignoreSwimming", ignoreSwimming)
- oCopy:SetAttribute("maxGroundDistance", maxGroundDistance)
- oCopy:SetAttribute("maxRadiusToObjectDistance", maxRadiusToObjectDistance)
- oCopy:SetAttribute("boostFloatingDistanceScan", boostFloatingDistanceScan)
- oCopy:SetAttribute("maxMovingFloatTime", maxMovingFloatTime)
- oCopy:SetAttribute("iDownDirection", iDownDirection)
- oCopy:SetAttribute("minimumLinearVelocity", minimumLinearVelocity)
- oCopy:SetAttribute("maxFlyCheatDetects", maxFlyCheatDetects)
- oCopy:SetAttribute("recordFlyGroundPosition", recordFlyGroundPosition)
- oCopy:SetAttribute("sendFlyCheaterToGround", sendFlyCheaterToGround)
- oCopy:SetAttribute("teleportCheatDetectionEnabled", teleportCheatDetectionEnabled)
- oCopy:SetAttribute("debugTeleportCheatDetection", debugTeleportCheatDetection)
- oCopy:SetAttribute("maxLongRangeTeleport", maxLongRangeTeleport)
- oCopy:SetAttribute("maxShortRangeTeleport", maxShortRangeTeleport)
- oCopy:SetAttribute("ignoreTeleportOtherPlayers", ignoreTeleportOtherPlayers)
- oCopy:SetAttribute("ignoreTeleportExceptionModels", ignoreTeleportExceptionModels)
- oCopy:SetAttribute("sendTeleportCheaterBack", sendTeleportCheaterBack)
- oCopy:SetAttribute("jumpCheatDetectionEnabled", jumpCheatDetectionEnabled)
- oCopy:SetAttribute("debugJumpCheatDetection", debugJumpCheatDetection)
- oCopy:SetAttribute("iJumpDownDirection", iJumpDownDirection)
- oCopy:SetAttribute("iJumpMovement", iJumpMovement)
- oCopy:SetAttribute("maxPlayerJumpPower", maxPlayerJumpPower)
- oCopy:SetAttribute("maxJumpGroundDistance", maxJumpGroundDistance)
- oCopy:SetAttribute("ignoreJumpClimbing", ignoreJumpClimbing)
- oCopy:SetAttribute("ignoreJumpSwimming", ignoreJumpSwimming)
- oCopy:SetAttribute("stopJumpCheater", stopJumpCheater)
- oCopy:SetAttribute("debugGUITextColor", debugGUITextColor)
- oCopy:SetAttribute("debugGUITextSize", debugGUITextSize)
- oCopy:SetAttribute("debugGUISizeX", debugGUISizeX)
- oCopy:SetAttribute("debugGUISizeY", debugGUISizeY)
- task.wait()
- -- Enable Service
- oCopy.Enabled = true
- task.wait()
- -- Remove This Setup Object From Memory, We Are Done :)
- script.Parent:Destroy()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement