FiveM Player Query – Tutorial

You can now show the status of your FiveM server in your game launchers thanks to this PHP script devised by XPreciousGaming (we love you)!

This is a PHP file that you should create, configure then upload to a webserver (any web server that has PHP). Once you have created, edited and uploaded it you can then point to this PHP file using the QUERY STRING object inside Game Launcher Creator to show a real-time player count of your FiveM server(s).

Step 1 – Copy the PHP Code

Firstly, you need to copy the following PHP code to notepad on your computer…

<?php // Need Any Help Read ReadMe.txt Or Message us at: //
/*———————–[ SETTINGS ]——————————*/
$server_settings[‘ip’] = “your ip here”; // localhost for local servers / IP or domain name for VDS/VPS
$server_settings[‘port’] = “your port here”; // basically 30120
$server_settings[‘max_slots’] = “64”; // maximum slots. By default 24
$url1=$_SERVER[‘REQUEST_URI’]; // Dont Change Any Lines Below
header(“Refresh: 5; URL=$url1”);

$content = json_decode(file_get_contents(“http://”.$server_settings[‘ip’].”:”.$server_settings[‘port’].”/info.json”), true);
$gta5_players = file_get_contents(“http://”.$server_settings[‘ip’].”:”.$server_settings[‘port’].”/players.json”);
$content = json_decode($gta5_players, true);
$pl_count = count($content);
$SRV_STATUS = “<font style=’color: green;’>Online</font>”;
print ” $pl_count / $server_settings[max_slots] “;

Once you have copied, then pasted this into a new notepad file, we will need to modify some of it.

Step 2 – Server Modification

Now you need to modify some of the settings to match your server, to get the correct server information.

The first line to edit is under [ SETTINGS ] and it is:

$server_settings[‘ip’] = “your IP here” – where it says your IP here, replace this inside the speech marks, with your server IP (not port, just IP address)

$server_settings[‘port’] = “your port here” – pop in your server port here, typically 30120

$server_settings[‘max_slots’] = “32” – pop in the maximum slots available for your FiveM Server (default is 24)

Now this is complete, you can save this file. When the Save As dialog pops up, select All Files (*.*) and type in player-query.php

Once you have saved your file, upload it to your web server, it must support PHP (most do, Windows ones don’t, by default).

Once you have uploaded it, write down the URL, typically something like (

Step 3 – Integrating into your FiveM Game Launcher

Now open up Game Launcher Creator, insert a Query String, head over to the properties of that string and put in your URL for the post-url like so

FiveM Player Query String PHP

Insert the full URL in the POST url box, to test this, try inserting this URL into your web browser, it should display how many players are currently active on your FiveM server.

You can write whatever you like in the pre-POST and POST text strings.

You can also change the font settings from this dialog too. You can move and position the query string in the live launcher editor for your game launcher.

Game Launcher Creator Icon

Hey, Gamer / Developer!

Due to COVID-19 lock-downs globally, ByteBox Media have decided to slash the price of GLC V2 to the lowest ever yet! Don’t sit at home twiddling your thumbs, great creative with Game Launcher Creator V2 today!

Discount only applicable for GLC sales from and TGC Store.