NativeMultiplayer
This page only applies to Grand Theft Auto IV.
What is native multiplayer?
Native multiplayer (sometimes referred to as native mp for short) is an alternative server mode for GTA IV. While GTAC (and most other GTA multiplayer mods) provide a sandbox environment and custom-made sync, GTAC also allows the use of "native multiplayer" which is Rockstar's sync, just passed through the server instead of directly peer to peer.
How do I use it?
Players can't turn native multiplayer mode on or off, only a server can. If you are hosting a server, you can set the <iv_nativemultiplayer> tag in the server configuration to true or false.
When should I use it?
If you're using a built-in IV gamemode.
You can script or use a custom gamemode with native multiplayer, as long as it meets the following conditions:
- Does not need to keep track of elements or attach data to them, like a vehicle's owner for example.
- Does not need to manage sessions or needs to keep everybody in the same "world".
Some notes and technical info
- Using native multiplayer mode presents a challenge when trying to script a gamemode that needs to track elements. For example, a roleplay server might provide vehicle ownership but if the server doesn't know the vehicle exists, tying that data to the vehicle would be an issue. You could tell a client to spawn it, then report back with the newly spawned vehicle's ID, but as soon as the session is destroyed and/or another one is created, those ID's are useless. The ID's also change if the element is streamed out for everybody and no client has it in memory anymore. If you need to attach persistent data to an element, you should disable native multiplayer on your server
- Using native multiplayer mode, you can't force players to create or join specific sessions (also called lobbies) with scripting. Each session has a player hosting it. Even if you have the phone disabled, the game might still place some players in different sessions with different hosts, and they won't be able to see players from another session. If you're trying to script a gamemode that needs everybody in the same "world" then you should disable native multiplayer on your server.
- If you want to use elements in the same way as other GTA multiplayer mods, or the older games here on GTA Connected, you'll need to turn off native MP mode in server config. This will force GTAC to use it's own custom sync. Servers will be aware of elements and all can be handled using either GTAC functions or natives, although natives will only exist client-side.
- When native multiplayer mode is disabled, some internal "events" that IV uses are not currently handled or synced. This means things like when a player shoots another player, the damage itself won't be synced.
- The [element.id|element.id] is part of GTAC's own element handling and doesn't not work on native multiplayer mode. If you're using native multiplayer mode, you will need to use natives to get the ID of an element.
- Using native multiplayer mode, the server doesn't know how to read the sync packets, and only passes them along as-is. Any references to elements in this mode is handled by the games themselves.