This guide covers resource development, database setup, admin tools, player management, vehicle and weapon management, and troubleshooting for your alt:V server on Legion Hosting. For initial server setup, server.toml configuration, and connection instructions, see alt:V Server Setup Guide.
Admin Setup
alt:V does not have a built-in admin system. Admin functionality is implemented through resources (scripts) that you create or install. Most gamemodes implement their own admin system with permission levels, roles, and admin commands.
Common Admin Approaches
- Database-backed roles: Most roleplay and gamemode frameworks store admin roles in a database. Admins are assigned roles (e.g., moderator, admin, superadmin) that grant different permission levels.
- Config-based admins: Simpler setups may use a configuration file listing admin Steam IDs or alt:V IDs with their permission levels.
- Console commands: The GPanel server console always has full access. You can write server-side scripts that accept console input for admin operations.
Setting Up an Admin Resource
- Choose or develop an admin resource that fits your gamemode.
- Upload the resource to the
resources/directory via the Files tab or SFTP. - Add the resource name to the
resourcesarray inserver.toml. - Configure the admin resource (set your admin Steam/alt:V IDs, permission levels, etc.).
- Restart the server.
Resource System
Resources are the core building blocks of alt:V servers. Each resource is a self-contained module that can contain server-side code, client-side code, or both. Resources are written in JavaScript, TypeScript, or C#.
Resource Structure
resources/
my-resource/
resource.toml <-- Resource configuration (required)
server/
index.js <-- Server-side entry point
utils.js <-- Additional server-side files
client/
index.js <-- Client-side entry point (runs in player's GTA V)
shared/
config.js <-- Shared code accessible by both server and client
resource.toml Configuration
type = "js"
main = "server/index.js"
client-main = "client/index.js"
client-files = ["client/*"]
deps = ["chat"]
Fields: type (js or csharp), main (server-side entry point), client-main (client-side entry point, runs in player's GTA V), client-files (files to send to client, supports globs), deps (other resources to load first).
Installing Resources
To install a pre-built resource on your server:
- Download the resource files (typically a folder containing
resource.tomland script files). - Stop your server in GPanel.
- Upload the resource folder to
resources/via the Files tab or SFTP. - Add the resource folder name to the
resourcesarray inserver.toml:
resources = ["existing-resource", "new-resource"]
- If the resource has dependencies, ensure those are also installed and listed.
- Configure the resource according to its documentation (config files, database setup, etc.).
- Start the server. Check the console for resource loading messages and any errors.
Removing a Resource
- Stop your server.
- Remove the resource name from the
resourcesarray inserver.toml. - Optionally delete the resource folder from
resources/. - Start the server.
deps field in other resources before removing.
Database Setup
Most alt:V gamemodes require a database to store player data, vehicles, inventories, and other persistent information. The two most common database systems for alt:V are MongoDB and MySQL/MariaDB.
MongoDB
MongoDB is a NoSQL document database commonly used with JavaScript/TypeScript resources. Use a managed service like MongoDB Atlas (free tier available) or a self-hosted instance. Get your connection string (e.g., mongodb+srv://user:[email protected]/mydb) and configure it in your resource's config file. Node.js resources use the mongodb npm package.
MySQL / MariaDB
MySQL is commonly used with C# resources and some JavaScript frameworks. Obtain a database from a managed service or self-hosted instance, configure your resources with the connection details (host, port, username, password, database name), and run any required SQL migration scripts.
Player Management
Player management in alt:V is handled through your resources. Common operations include:
Identifying Players
alt:V provides several identifiers for each connected player:
| Identifier | Description |
|---|---|
player.id |
A temporary numeric ID assigned for the current session. Changes on reconnect. |
player.socialID |
The player's Rockstar Social Club ID. Persistent across sessions. |
player.hwidHash |
A hardware identifier hash. Useful for ban enforcement. |
player.ip |
The player's IP address. |
Kicking and Banning
Implement kick and ban functionality in your resources:
import alt from "alt-server";
// Kick a player
player.kick("Reason for kick");
// Ban check on connect (store bans in database)
alt.on("playerConnect", (player) => {
if (isPlayerBanned(player.socialID)) {
player.kick("You are banned from this server.");
}
});
socialID and hwidHash for reliable enforcement.
Vehicle and Weapon Management
Vehicles and weapons are managed through server-side scripts. alt:V gives you full control over spawning, modifying, and removing vehicles and weapons.
Spawning Vehicles
import alt from "alt-server";
// Spawn a vehicle at a position
const vehicle = new alt.Vehicle(
"sultan", // Vehicle model name
0, 0, 72, // Position (x, y, z)
0, 0, 0 // Rotation (rx, ry, rz)
);
vehicle.numberPlateText = "LEGION";
Giving Weapons
// Give a weapon to a player
player.giveWeapon(alt.hash("weapon_pistol"), 100, true);
// Remove all weapons
player.removeAllWeapons();
Vehicle Persistence
By default, vehicles exist only in server memory and are lost on restart. To persist vehicles across restarts, store their data (model, position, modifications, owner) in a database and recreate them on server start.
Troubleshooting
Resources Not Loading
- Check that the resource name in
server.tomlexactly matches the folder name inresources/. - Verify the resource has a valid
resource.tomlfile with correcttypeandmainfields. - Check the console for error messages during resource loading. Syntax errors in scripts will prevent the resource from starting.
- Ensure all dependencies listed in
depsare installed and loaded. - Verify the correct module is loaded in
server.toml(js-modulefor JavaScript,csharp-modulefor C#).
Players Cannot Connect
- Verify the server is running and showing as online in GPanel.
- Check that players are using the alt:V launcher, not the regular GTA V launcher.
- Ensure the alt:V server branch matches what players have (release, rc, or dev). Mismatched branches prevent connections.
- If password-protected, verify players are entering the correct password.
- Have players try direct connect with the IP and port. See How to Find Your Server IP and Port.
Server Crashes
- Check the console for error messages before the crash.
- Faulty resources are the most common cause of crashes. Disable recently added resources to isolate the problem.
- Ensure your server files are up to date. Trigger a reinstall from the Startup tab if needed.
- Memory leaks in resources can cause the server to run out of RAM over time. Monitor GPanel resource graphs for steadily increasing memory usage.
Database and Voice Issues
- Verify database credentials and connection strings. For MongoDB Atlas, whitelist your server's IP in network access settings.
- Check the console for database connection error messages.
- Voice chat requires the
[voice]section inserver.tomlplus resources that implement voice channel logic. The config alone only sets up infrastructure.
Performance Issues
- Profile your resources for expensive operations (heavy loops, synchronous database calls, excessive entity creation).
- Use
alt.setIntervalandalt.setTimeoutsparingly. Heavy per-tick operations are the most common performance killer. - Monitor GPanel resource graphs for CPU and RAM usage.
- Consider upgrading your server plan for high player counts. Open a support ticket to discuss options.
Related Articles
- alt:V Server Setup Guide — Initial setup, server.toml configuration, voice chat, and connection instructions
- How to Find Your Server IP and Port
- How to Upload Files via SFTP
- Server Startup Guide — General guide for starting any game server on Legion Hosting
Need More Help?
If you are experiencing issues not covered in this guide, our support team is available to assist. Open a ticket at legionhosting.net/submitticket.php with your server details, a description of the problem, and any relevant error messages from the GPanel console.