[Release] FiveM-BanSql

FiveM-BanSql v1.2.0

An SQL ban system that preloads data on server start and keeps bans in memory for fast checks without overloading the database.

What’s New in v1.2.0

  • No need to use sqlbanoffline for players who connected since last server restart!
  • Multi-framework support: ESX, QBX, QBOX
  • Automatic update checker with Discord webhook notifications
  • Token support for enhanced security
  • Automatic database initialization (no manual SQL import needed)
  • Improved command registration and player handling
  • Case-insensitive player name search

Requirements

  • mysql-async OR oxmysql
  • One framework: es_extended, qbx_core, or qbox_core

Installation

  1. Download: Latest Release
  2. Extract and copy to your resources folder
  3. Add ensure FiveM-BanSql-1.2.0 to your server.cfg
  4. Configure options in config.lua (language, permissions, webhook, ForceSteam)
  5. Restart your server - database tables will be created automatically!

Commands


Console Commands (RCON)

  • ban <id> <days> <reason> - Ban an online player
  • banoffline <permid> <days> <reason> - Ban an offline player by permid
  • search <name> - Find permid by player name
  • unban <steam name> - Unban a player by name
  • banhistory <steam name|index> - Show ban history
  • banreload - Reload BanList and BanListHistory

In-Game Commands (ESX/QBX/QBOX)

  • sqlban <id> <days> <reason> - Ban an online player
  • sqlbanoffline <permid> <days> <reason> - Ban an offline player by permid
  • sqlsearch <name> - Find permid by player name
  • sqlunban <steam name> - Unban a player by name
  • sqlbanhistory <steam name|index> - Show ban history
  • sqlbanreload - Reload BanList and BanListHistory

Examples:

  • /sqlban 3 1 Troll - Bans player #3 for 1 day for trolling
  • /sqlsearch John - Searches for players named John (case-insensitive)
  • /sqlbanoffline 1 0 Cheating - Permanently bans player with permid 1
  • /sqlunban Alex Garcio - Unbans player named Alex Garcio
  • /sqlbanhistory Alex Garcio - Shows all bans for this player

Important Notes:

  • days set to 0 means permanent ban
  • permid can be found using sqlsearch command
  • NEW: If a player has connected since the last server restart, you can use sqlban with their ID instead of sqlbanoffline - the system remembers recent players!
  • Player names are now searched case-insensitively

Optional Recommendation:
Use BlockVPN to prevent IP changes: [Release] BlockVPN [v1.0.4] [FIXED]

Created by

Source Code | Issues & Support

15 Likes

Moved to #development:releases

What if you are trying to unban a player that has a common steam name. On the note of using steam ids, people can just create new accounts. Might be best to use a combination of steamids and licenses.

Anyways, thanks for releasing this to the community.

2 Likes

@J.Manlet Yes i have this in mind too.

2 Likes

Licenses are the best way to go. Steam Ids as a backup but so many people have vpns there’s days so there is not point in doing IPs

I keep getting this error, any reason why?

@Mercys Try this version V1.0.2

1 Like

possible way to implement in-game commands to executing these commands or is it only via server access?

hey this is a super nice release im going to try it out thanks a lot i appreciate the work

@Detoxz all command are build for in game use.
If you have any problem with post me your full error message on F8 in game or console and i will fix it fast.

1 Like

could you modify this so it checks the database if any bans have been added fresh when someone joins so u dont need to reload after adding someone to it DB wise because i find myself having to try and add someone but not being able to get into the server to use the command to refresh. it would be nice if it would check on its own on a player join request

@Skrubby If i understand well, you and edit the SQL to add one ban right?
And the ressource don’t see the new ban because the list is loaded but not reload after an SQL edit.
If i will make command available in console this can do what you want to do?

1 Like

yea i mean that could do it just as Easy but i think the easier way to handle it for everyone as a whole is to make it so if i go to join the server when i connect it checks the database live to see if theres a ban in there than either does or does not let me in. you know? instead of loading the database in on firstload it checks it every time.

I simply get no return message in game besides the default EssentialsMode invalid command chat return which shouldn’t be an issue, and nothing appears in the client console or server console regarding any type of error.

the game treats it as if it’s non existent. I have the DB setup , i have the resource started with 0 errors, and I get 0 errors in the Client Console or Server console , I’ve even done another fresh install for the same result

@Detoxz Have you the load confirm of the ressource?
In console
The BanList has been loaded successfully.
The BanListHistory has been loaded successfully.
?

1 Like

@Skrubby The “preload” of the banlist is to save sql request on all connect attemp.
But if it’s you realy want i can make the preload as an option too.

1 Like

Yep, that shows up in the server console with 0 errors

Release edited to add this

Make sure FiveM-BanSql start AFTER require resources.
Like This

start baseevents 
start mysql-async 
start essentialmode 
start esplugin_mysql
start async
start FiveM-BanSql
1 Like

i think as a option it would be okay. the database is assessed a lot and i dont think the request to check it would be too bad. i would put it as a option true false some people may not like it.