Symptoms and Fixes
Server wonβt start
Error: Couldn't find resource qb-core
Fix: ensure qb-core folder exists in resources and server.cfg has ensure qb-core.
Players canβt join
Error: Connection refused
Fix: verify firewall ports (default 30120) and that server is running.
FiveM Server Connection Issues
Error: Failed to connect to server or fivem server not responding
Fix:
- Confirm
sv_licenseKeyis set inserver.cfg - Generate a key at keymaster.fivem.netΒ
- Open ports in firewall:
sudo ufw allow 30120/tcp sudo ufw allow 30120/udp - Check
server.cfghasendpoint_add_tcp "0.0.0.0:30120"andendpoint_add_udp "0.0.0.0:30120"
Player Vehicles Table Not Found
Error: player_vehicles doesn't exist or missing vehicle data after restart.
Fix: Run this SQL to create the table in your database:
CREATE TABLE IF NOT EXISTS `player_vehicles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`license` varchar(50) DEFAULT NULL,
`citizenid` varchar(50) DEFAULT NULL,
`vehicle` varchar(50) DEFAULT NULL,
`hash` varchar(50) DEFAULT NULL,
`mods` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`mods`)),
`plate` varchar(12) NOT NULL,
`fakeplate` varchar(12) DEFAULT NULL,
`garage` varchar(50) DEFAULT 'pillboxgarage',
`fuel` int(11) DEFAULT 100,
`engine` float DEFAULT 1000,
`body` float DEFAULT 1000,
`state` int(11) DEFAULT 1,
`depotprice` int(11) DEFAULT 0,
`drivingdistance` int(11) DEFAULT NULL,
`status` text DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `plate` (`plate`),
KEY `citizenid` (`citizenid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;Player Login State Check
Error: attempt to index a nil value when checking LocalPlayer.state
Fix: Use LocalPlayer.state.isLoggedIn to guard client code until the player has fully loaded.
-- Client-side: wait for login before running logic
CreateThread(function()
while true do
Wait(500)
if LocalPlayer.state.isLoggedIn then
print('Player is logged in')
break
end
end
end)NUI GetParentResourceName
Error: GetParentResourceName returns nil in NUI JavaScript.
Fix: GetParentResourceName() is only available on the client Lua side. In NUI JavaScript, you cannot call it directly. Instead, send the resource name from Lua:
-- Client Lua
RegisterNUICallback('getResourceName', function(_, cb)
cb(GetCurrentResourceName())
end)// NUI JavaScript
fetch(`https://${GetParentResourceName()}/callback`, {
method: 'POST',
body: JSON.stringify({})
})In NUI JavaScript, use window.invokeNative('getParentResourceName') as a workaround. The resource name must be sent from the client Lua script via a NUI callback.
Common Database Issues
-- Fix missing tables (run in your MySQL console)
CREATE TABLE IF NOT EXISTS `players` (
`citizenid` varchar(50) NOT NULL,
`license` varchar(50) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`money` longtext DEFAULT NULL,
`charinfo` longtext DEFAULT NULL,
`job` longtext DEFAULT NULL,
`gang` longtext DEFAULT NULL,
`position` longtext DEFAULT NULL,
`metadata` longtext DEFAULT NULL,
`inventory` longtext DEFAULT NULL,
`last_updated` timestamp DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`citizenid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;