In this tutorial, you'll learn how to set up a custom ban system on your Garry's Mod server using the VolticHost Game Panel. This system lets you ban or unban players via custom Lua commands, helping you maintain a healthy gaming environment. 🚀
📌 Prerequisites
-
A Garry's Mod server purchased at VolticHost.com
-
Access to the VolticHost Game Panel
-
Basic knowledge of Lua scripting and file management
1️⃣ First Step - Uploading the Custom Ban System Script
-
Log in to VolticHost Game Panel.
-
Navigate to the File Manager from the main dashboard.
-
Go to the
/garrysmod/lua/autorun/server/
directory. -
Create a new file named
custom_ban_system.lua
. -
Open
custom_ban_system.lua
for editing and paste the following script:if SERVER then local bannedPlayers = {} -- Command to ban a player by SteamID concommand.Add("custom_ban", function(ply, cmd, args) if not args[1] then ply:ChatPrint("Usage: custom_ban <SteamID>") return end local steamID = args[1] bannedPlayers[steamID] = true ply:ChatPrint("Player with SteamID " .. steamID .. " has been banned.") end) -- Hook to prevent banned players from joining hook.Add("PlayerInitialSpawn", "CheckCustomBan", function(ply) if bannedPlayers[ply:SteamID()] then ply:Kick("You are banned from this server.") end end) -- Command to unban a player by SteamID concommand.Add("custom_unban", function(ply, cmd, args) if not args[1] then ply:ChatPrint("Usage: custom_unban <SteamID>") return end local steamID = args[1] bannedPlayers[steamID] = nil ply:ChatPrint("Player with SteamID " .. steamID .. " has been unbanned.") end) end
-
Save the file after editing.
-
Restart your server from the VolticHost Game Panel to load the new script.
✅ Custom ban system script uploaded and loaded successfully!
2️⃣ Next Step - Testing and Managing the Ban System
-
Join your server and open the in-game console.
-
Test the ban command by typing:
custom_ban STEAM_0:1:12345678
Replace
STEAM_0:1:12345678
with an actual SteamID for testing. -
Attempt to rejoin the server with a banned SteamID to verify that the player is kicked.
-
Test the unban command by typing:
custom_unban STEAM_0:1:12345678
This should remove the ban and allow the player to join the server again.
-
Verify that chat messages confirm each command's successful execution.
✅ Custom ban system tested and functioning successfully!
🎉 Conclusion
You have now successfully created a custom ban system on your Garry's Mod server using the VolticHost Game Panel! Maintain a controlled gaming environment by easily banning or unbanning players with custom Lua commands. 🚀
For more assistance, contact VolticHost Support.