Skip to content
This repository was archived by the owner on May 10, 2020. It is now read-only.
This repository was archived by the owner on May 10, 2020. It is now read-only.

Autoban based on X amount of explosions #9

Description

@CruelAlpha

Hi there,
Not sure if this would be useful for you but could some sort of auto ban go out if there are X explosions by someone? Code for example can be:

recentExplosions = {}

		AddEventHandler('explosionEvent', function(sender, ev)
		if Components.Explosions and ev.damageScale ~= 0.0 and ev.ownerNetId == 0 then -- make sure component is enabled, damage isnt 0 and owner is the sender
			ev.time = os.time()
			table.insert(recentExplosions, {sender = sender, data=ev})
		end
	end)
end)

Citizen.CreateThread(function()
	while true do 
		Wait(2000)
		clientExplosionCount = {}
		for i, expl in ipairs(recentExplosions) do 
			if not clientExplosionCount[expl.sender] then clientExplosionCount[expl.sender] = 0 end
			clientExplosionCount[expl.sender] = clientExplosionCount[expl.sender]+1
			table.remove(recentExplosions,i)
		end 
		recentExplosions = {}
		for c, count in pairs(clientExplosionCount) do 
			if count > 5 then
				local license, steam = GetPlayerNeededIdentifiers(c)
				local name = GetPlayerName(c)
(SEND AUTO BAN FUNCTION HERE)

			end
		end
	end
end)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions