In this tutorial, you'll learn how to create a custom ban system for your FiveM server using the Pterodactyl panel (VolticHost Game Panel). This system allows you to ban or unban players by their identifiers (e.g., SteamIDs) via in-game commands, helping you maintain a secure and controlled roleplay environment. 🚀
📌 Prerequisites
-
A FiveM server purchased at VolticHost.com
-
Access to the Pterodactyl panel (a.k.a. VolticHost Game Panel)
-
Basic knowledge of Lua scripting and file management
-
Familiarity with FiveM resource structure and server commands
1️⃣ First Step - Creating the Ban System Resource
-
Log in to VolticHost Game Panel.
-
Navigate to the File Manager from the main dashboard.
-
Go to the
/resources/
directory. -
Create a new folder named
custom_ban_system
. -
Inside the
custom_ban_system
folder, create a file namedfxmanifest.lua
and add the following content:fx_version 'cerulean' game 'gta5' author 'YourName' description 'Custom Ban System' version '1.0.0' server_script 'ban_system.lua'
-
Save the file.
✅ Ban system resource folder and manifest created successfully!
2️⃣ Next Step - Uploading the Ban System Script
-
In the
custom_ban_system
folder, create a new file namedban_system.lua
. -
Open
ban_system.lua
for editing and paste the following code:if SERVER then -- Table to hold banned identifiers (e.g., SteamIDs, license IDs) local bannedPlayers = {} -- Command to ban a player by their identifier RegisterCommand("banplayer", function(source, args, rawCommand) if #args < 1 then TriggerClientEvent("chat:addMessage", source, { args = { "Ban System", "Usage: /banplayer [identifier]" } }) return end local identifier = args[1] bannedPlayers[identifier] = true TriggerClientEvent("chat:addMessage", source, { args = { "Ban System", "Player with identifier " .. identifier .. " has been banned." } }) end, true) -- Command to unban a player by their identifier RegisterCommand("unbanplayer", function(source, args, rawCommand) if #args < 1 then TriggerClientEvent("chat:addMessage", source, { args = { "Ban System", "Usage: /unbanplayer [identifier]" } }) return end local identifier = args[1] bannedPlayers[identifier] = nil TriggerClientEvent("chat:addMessage", source, { args = { "Ban System", "Player with identifier " .. identifier .. " has been unbanned." } }) end, true) -- Check incoming connections to enforce bans AddEventHandler('playerConnecting', function(name, setKickReason, deferrals) deferrals.defer() local src = source local identifiers = GetPlayerIdentifiers(src) for _, id in ipairs(identifiers) do if bannedPlayers[id] then deferrals.done("You are banned from this server.") return end end deferrals.done() end) end
-
Save the file.
✅ Custom ban system script uploaded and configured successfully!
3️⃣ Next Step - Activating the Ban System Resource
-
In the Pterodactyl panel, open your
server.cfg
file located in the root directory of your FiveM server. -
Add the following line to ensure your ban system resource starts with the server:
start custom_ban_system
-
Save your changes.
✅ Ban system resource added to server configuration successfully!
4️⃣ Next Step - Testing and Verifying the Ban System
-
Restart your server from the Pterodactyl panel to load the new resource.
-
Join your server and test the ban functionality:
-
Open the in-game console and type:
/banplayer steam:110000100000000
(Replace
steam:110000100000000
with a test identifier.) -
Disconnect and try reconnecting with the banned identifier. You should receive a kick message stating "You are banned from this server."
-
To unban, type:
/unbanplayer steam:110000100000000
-
Verify that the player can now connect successfully.
-
✅ Custom ban system tested and verified successfully!
🎉 Conclusion
You have now successfully created and implemented a custom ban system on your FiveM server using the Pterodactyl (VolticHost Game) panel! This system allows you to manage bans easily via in-game commands, ensuring a secure and controlled environment for your roleplay community. 🚀
For more assistance, contact VolticHost Support.