Просмотр исходного кода

FiveM XML

Requested here:
https://www.opengamepanel.org/forum/viewthread.php?thread_id=5747

A key is required to run servers, which can be generated at
https://keymaster.fivem.net/

The IP / Port the server binds to is specified in the server.cfg file.
So cfg_text_replace was changed so the IP / Port may be retrieved via
the ip_port key.

The post install script handles the installation of the server. It'll
pull the newest version of the server for the appropriate platform.
Adjokip 8 лет назад
Родитель
Сommit
19e4c2c9ac

+ 132 - 0
modules/config_games/server_configs/fivem_linux32.xml

@@ -0,0 +1,132 @@
+<game_config>
+  <game_key>fivem_linux32</game_key>
+  <protocol>lgsl</protocol>
+  <lgsl_query_name>fivem</lgsl_query_name>
+  <game_name>FiveM</game_name>
+  <server_exec_name>run.sh</server_exec_name>
+  <cli_template>+exec server.cfg</cli_template>
+  <max_user_amount>32</max_user_amount>
+  <mods>
+    <mod key="default">
+      <name>None</name>
+    </mod>
+  </mods>
+  <replace_texts>
+    <text key="home_name">
+      <default>sv_hostname.*</default>
+      <var>sv_hostname</var>
+      <filepath>server.cfg</filepath>
+      <options>sq</options>
+    </text>
+    <text key="control_password">
+      <default>rcon_password.*</default>
+      <var>rcon_password</var>
+      <filepath>server.cfg</filepath>
+      <options>sq</options>
+    </text>
+    <text key="max_players">
+      <default>sv_maxclients.*</default>
+      <var>sv_maxclients</var>
+      <filepath>server.cfg</filepath>
+      <options>s</options>
+    </text>
+    <text key="ip_port">
+      <default>endpoint_add_tcp.*</default>
+      <var>endpoint_add_tcp</var>
+      <filepath>server.cfg</filepath>
+      <options>sq</options>
+    </text>
+    <text key="ip_port">
+      <default>endpoint_add_udp.*</default>
+      <var>endpoint_add_udp</var>
+      <filepath>server.cfg</filepath>
+      <options>sq</options>
+    </text>
+  </replace_texts>
+  <custom_fields>
+    <field key="sv_licenseKey" type="text">
+      <default>sv_licenseKey.*</default>
+      <default_value></default_value>
+      <var>sv_licenseKey</var>
+      <filepath>server.cfg</filepath>
+      <options>s</options>
+      <desc>Sets the license key. A license can be generated at: &lt;a href="https://keymaster.fivem.net/"&gt;https://keymaster.fivem.net/&lt;/a&gt;</desc>
+    </field>
+  </custom_fields>
+  <post_install>
+BASE="https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/"
+
+wget $BASE -Otmp
+
+# Assuming the version schema isn't changed or the url above isn't moved, this will always work.
+LATEST_VERSION=$(grep -Po '(?&lt;=href=")[^"]*' tmp | tail -1)
+
+wget "${BASE}${LATEST_VERSION}/fx.tar.xz"
+wget https://github.com/citizenfx/cfx-server-data/archive/master.zip -Ocfx-server-data.zip
+
+tar -xvf fx.tar.xz -C $PWD
+unzip cfx-server-data.zip -d $PWD/server-data
+mv $PWD/server-data/cfx-server-data-master/resources $PWD/resources
+
+cat > $PWD/server.cfg &lt;&lt;END
+# you probably don't want to change these!
+# only change them if you're using a server with multiple network interfaces
+endpoint_add_tcp "0.0.0.0:30120"
+endpoint_add_udp "0.0.0.0:30120"
+
+start mapmanager
+start chat
+start spawnmanager
+start sessionmanager
+start fivem
+start hardcap
+start rconlog
+start scoreboard
+start playernames
+
+sv_scriptHookAllowed 1
+
+# change this
+rcon_password ogpPassword
+
+sv_hostname "My new FXServer!"
+
+# nested configs!
+# exec server_internal.cfg
+
+# loading a server icon (96x96 PNG file)
+#load_server_icon myLogo.png
+
+# convars for use from script
+# set temp_convar "hey world!"
+
+# disable announcing? clear out the master by uncommenting this
+#sv_master1 ""
+
+# want to only allow players authenticated with a third-party provider like Steam?
+#sv_authMaxVariance 1
+#sv_authMinTrust 5
+
+# add system admins
+# add_ace group.admin command allow # allow all commands
+# add_ace group.admin command.quit deny # but don't allow quit
+# add_principal identifier.steam:110000112345678 group.admin # add the admin to the group
+
+# remove the # to hide player endpoints in external log output
+#sv_endpointprivacy true
+
+# server slots limit (must be between 1 and 31)
+sv_maxclients 30
+
+# license key for server (https://keymaster.fivem.net)
+sv_licenseKey superduperkey
+END
+
+rm tmp fx.tar.xz cfx-server-data.zip
+rm -rf $PWD/server-data
+  </post_install>
+
+  <configuration_files>
+    <file description="Main Config File">server.cfg</file>
+  </configuration_files>
+</game_config>

+ 133 - 0
modules/config_games/server_configs/fivem_win32.xml

@@ -0,0 +1,133 @@
+<game_config>
+  <game_key>fivem_win32</game_key>
+  <protocol>lgsl</protocol>
+  <lgsl_query_name>fivem</lgsl_query_name>
+  <game_name>FiveM</game_name>
+  <server_exec_name>run.cmd</server_exec_name>
+  <cli_template>+exec server.cfg</cli_template>
+  <console_log>CitizenFX.log</console_log>
+  <max_user_amount>32</max_user_amount>
+  <mods>
+    <mod key="default">
+      <name>None</name>
+    </mod>
+  </mods>
+  <replace_texts>
+    <text key="home_name">
+      <default>sv_hostname.*</default>
+      <var>sv_hostname</var>
+      <filepath>server.cfg</filepath>
+      <options>sq</options>
+    </text>
+    <text key="control_password">
+      <default>rcon_password.*</default>
+      <var>rcon_password</var>
+      <filepath>server.cfg</filepath>
+      <options>sq</options>
+    </text>
+    <text key="max_players">
+      <default>sv_maxclients.*</default>
+      <var>sv_maxclients</var>
+      <filepath>server.cfg</filepath>
+      <options>s</options>
+    </text>
+    <text key="ip_port">
+      <default>endpoint_add_tcp.*</default>
+      <var>endpoint_add_tcp</var>
+      <filepath>server.cfg</filepath>
+      <options>sq</options>
+    </text>
+    <text key="ip_port">
+      <default>endpoint_add_udp.*</default>
+      <var>endpoint_add_udp</var>
+      <filepath>server.cfg</filepath>
+      <options>sq</options>
+    </text>
+  </replace_texts>
+  <custom_fields>
+    <field key="sv_licenseKey" type="text">
+      <default>sv_licenseKey.*</default>
+      <default_value></default_value>
+      <var>sv_licenseKey</var>
+      <filepath>server.cfg</filepath>
+      <options>s</options>
+      <desc>Sets the license key. A license can be generated at: &lt;a href="https://keymaster.fivem.net/"&gt;https://keymaster.fivem.net/&lt;/a&gt;</desc>
+    </field>
+  </custom_fields>
+  <post_install>
+BASE="https://runtime.fivem.net/artifacts/fivem/build_server_windows/master/"
+
+wget $BASE -Otmp
+
+# Assuming the version schema isn't changed or the url above isn't moved, this will always work.
+LATEST_VERSION=$(grep -Po '(?&lt;=href=")[^"]*' tmp | tail -1)
+
+wget "${BASE}${LATEST_VERSION}/server.zip"
+wget https://github.com/citizenfx/cfx-server-data/archive/master.zip -Ocfx-server-data.zip
+
+unzip server.zip
+unzip cfx-server-data.zip -d $PWD/server-data
+mv $PWD/server-data/cfx-server-data-master/resources $PWD/resources
+
+cat > $PWD/server.cfg &lt;&lt;END
+# you probably don't want to change these!
+# only change them if you're using a server with multiple network interfaces
+endpoint_add_tcp "0.0.0.0:30120"
+endpoint_add_udp "0.0.0.0:30120"
+
+start mapmanager
+start chat
+start spawnmanager
+start sessionmanager
+start fivem
+start hardcap
+start rconlog
+start scoreboard
+start playernames
+
+sv_scriptHookAllowed 1
+
+# change this
+rcon_password ogpPassword
+
+sv_hostname "My new FXServer!"
+
+# nested configs!
+# exec server_internal.cfg
+
+# loading a server icon (96x96 PNG file)
+#load_server_icon myLogo.png
+
+# convars for use from script
+# set temp_convar "hey world!"
+
+# disable announcing? clear out the master by uncommenting this
+#sv_master1 ""
+
+# want to only allow players authenticated with a third-party provider like Steam?
+#sv_authMaxVariance 1
+#sv_authMinTrust 5
+
+# add system admins
+# add_ace group.admin command allow # allow all commands
+# add_ace group.admin command.quit deny # but don't allow quit
+# add_principal identifier.steam:110000112345678 group.admin # add the admin to the group
+
+# remove the # to hide player endpoints in external log output
+#sv_endpointprivacy true
+
+# server slots limit (must be between 1 and 31)
+sv_maxclients 30
+
+# license key for server (https://keymaster.fivem.net)
+sv_licenseKey superduperkey
+END
+
+rm tmp server.zip cfx-server-data.zip
+rm -rf $PWD/server-data
+  </post_install>
+  
+  <configuration_files>
+    <file description="Main Config File">server.cfg</file>
+  </configuration_files>
+</game_config>

+ 4 - 1
modules/gamemanager/cfg_text_replace.php

@@ -26,6 +26,9 @@ if (empty($server_home["ip"]))
 	$server_home["ip"] = $ip;
 if (empty($server_home["port"]))
 	$server_home["port"] = $port;
+
+$server_home['ip_port'] = $server_home['ip'] . ':' . $server_home['port'];
+
 $server_home["true"] = "";
 $last_param = json_decode($db->getLastParam($server_home["home_id"]), True);		
 $server_home["max_players"] = isset($cli_param_data['PLAYERS']) ? $cli_param_data['PLAYERS'] : $last_param['players'];
@@ -252,4 +255,4 @@ foreach($file_replacements as $filepath => $replacements)
 	//echo "<xmp>".$file_content."</xmp>";
 	$remote->remote_writefile($server_home['home_path'] . "/" . $filepath, $file_content);
 }
-?>
+?>

+ 60 - 1
protocol/lgsl/lgsl_protocol.php

@@ -62,6 +62,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
 		"egs"			=> "Empyrion - Galactic Survival",
 		"farcry"		=> "Far Cry",
 		"fear"			=> "F.E.A.R.",
+		"fivem"			=>	"GTA FiveM",
 		"flashpoint"	=> "Operation Flashpoint",
 		"freelancer"	=> "Freelancer",
 		"frontlines"	=> "Frontlines: Fuel Of War",
@@ -210,6 +211,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
 		"ivmp"			=> "39",
 		"farcry"		=> "08",
 		"fear"			=> "09",
+		"fivem"			=> "41",
 		"flashpoint"	=> "03",
 		"freelancer"	=> "14",
 		"frontlines"	=> "20",
@@ -354,6 +356,7 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
 		"egs"			=> "steam://connect/{IP}:{Q_PORT}",
 		"farcry"		=> "qtracker://{IP}:{S_PORT}?game=FarCry&action=show",
 		"fear"			=> "qtracker://{IP}:{S_PORT}?game=FEAR&action=show",
+		"fivem"			=> "http://fivem.net/",
 		"flashpoint"	=> "qtracker://{IP}:{S_PORT}?game=OperationFlashpoint&action=show",
 		"freelancer"	=> "http://en.wikipedia.org/wiki/Freelancer_(computer_game)",
 		"frontlines"	=> "http://en.wikipedia.org/wiki/Frontlines:_Fuel_of_War",
@@ -4228,6 +4231,62 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
 		return TRUE;
 	}
 //------------------------------------------------------------------------------------------------------------+
+//------------------------------------------------------------------------------------------------------------+
+	function lgsl_query_41(&$server, &$lgsl_need, &$lgsl_fp)
+	{
+		fwrite($lgsl_fp, "\xFF\xFF\xFF\xFFgetinfo xxx");
+		$buffer = fread($lgsl_fp, 4096);
+
+		if (!$buffer) {
+			return false;
+		}
+
+		lgsl_cut_byte($buffer, 18);
+
+		$data = explode('\\', $buffer);
+
+		for ($i = 0; $i < count($data); $i += 2) {
+			if ($data[$i] == 'sv_maxclients') {
+				$server['s']['playersmax'] = $data[$i + 1];
+			}
+
+			if ($data[$i] == 'clients') {
+				$server['s']['players'] = $data[$i + 1];
+			}
+
+			if ($data[$i] == 'challenge') {
+				$server['e']['challenge'] = $data[$i + 1];
+			}
+
+			if ($data[$i] == 'gamename') {
+				$server['e']['gamename'] = $data[$i + 1];
+			}
+
+			if ($data[$i] == 'protocol') {
+				$server['e']['protocol'] = $data[$i + 1];
+			}
+
+			if ($data[$i] == 'hostname') {
+				$server['s']['name'] = $data[$i + 1];
+			}
+
+			if ($data[$i] == 'gametype') {
+				$server['s']['game'] = $data[$i + 1];
+			}
+
+			if ($data[$i] == 'mapname') {
+				$server['s']['map'] = $data[$i + 1];
+			}
+
+			if ($data[$i] == 'iv') {
+				$server['e']['iv'] = $data[$i + 1];
+			}
+
+		}
+
+		return true;
+	}
+//------------------------------------------------------------------------------------------------------------+
 //------------------------------------------------------------------------------------------------------------+
 	function lgsl_query_feed(&$server, $request, $lgsl_feed_method, $lgsl_feed_url, $home_info = False)
 	{
@@ -4700,4 +4759,4 @@ if (!function_exists('lgsl_version')) { // START OF DOUBLE LOAD PROTECTION
 //------------------------------------------------------------------------------------------------------------+
 //------------------------------------------------------------------------------------------------------------+
 
-?>
+?>