Korea Posted March 18 Share Posted March 18 (edited) This simple code will protect you from attacking a server by TriggerServerEvent. Also you can use onPlayerTriggerEventThreshold but I think if player turns off internet and do actions then after turning it on all packets will be send in the same interval. Change some settings to your own! -- client side local ServerCalls ServerCalls = { interval = 1000, maxCallsPerInterval = 20, time = 0, calls = 0, refresh = function(self) if self.time < getTickCount() then self.time = getTickCount() + self.interval self.calls = 0 end end, add = function(self) self:refresh(); self.calls = self.calls + 1 end, } ServerCalls.__index = ServerCalls addDebugHook("preFunction", function() ServerCalls:add(); if ServerCalls.calls >= ServerCalls.maxCallsPerInterval and not ServerCalls.makeLastCall then triggerServerEvent("banPlayer", resourceRoot) ServerCalls.makeLastCall = true end return ServerCalls.makeLastCall and "skip" or true end, {"triggerServerEvent"}) -- basic implenemtation of banPlayer (server side) addEvent("banPlayer", true) addEventHandler("banPlayer", resourceRoot, function() banPlayer(client, true, false, true, "Korea", "Anty ddos") end) Edited May 10 by Korea Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now