Ban System with JSON & Time

I recently checked the ban systems and I couldn’t find much JSON-related data, so I wanted to spend a few hours and code the most accurate version, there may be errors, so we can update against your feedback.

Since it is JSON, there is no need for an extra setup, it will save the data in {}, install and run QBCore tests have been done No test for ESX, but 95% standalone-based anyway

Example Trigger:

RegisterServerEvent('eyes-ban')
AddEventHandler('eyes-ban', function(source, reason, time)
     banPlayer(source, "Your ban reason", 1)
end)

The data 1 means 1 hour, when that time comes, the ban will be lifted automatically

4 Likes

Nice example, also exploitable by cheaters to ban anyone

5 Likes

good point xD

For this, I closed the 1, 1000 ids duplicated with -1 and invalid source ie for, i, but I still don’t think there is a clear solution, I can code a tokenizer for this or send the trigger secretly because I guess there is no clear blocking possible.

or just add a permission system using ace permissions

How about not registering it as net event, so only server scripts can call it.

5 Likes

Things like banlist and unban will come, we will reflect the updates today, it can be actively used with trigger already now

that’s the problem, anyone can use that event now.