ScriptingExamples/PlayerSetPositionNativeMP: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{DISPLAYTITLE:Set Player Position (GTA IV, Native MP Mode}} == Description == This code sets the position for a player in GTA IV NativeMultiplayer|native MP mode}}. This is necessary because in native MP mode, the server is '''not''' aware of '''ANY''' game elements, including player peds. The server will need to tell a client to set it's own player ped's position. Note: This is not necessary if you're not using native MP mode, or are running the server for another g...") |
(No difference)
|
Latest revision as of 08:22, 1 September 2025
Description
This code sets the position for a player in GTA IV [[NativeMultiplayer|native MP mode}}. This is necessary because in native MP mode, the server is not aware of ANY game elements, including player peds. The server will need to tell a client to set it's own player ped's position.
Note: This is not necessary if you're not using native MP mode, or are running the server for another game.
Code
Server-Side (JavaScript):
triggerNetworkEvent("set-my-position", client, position);
Client-Side (JavaScript):
addNetworkHandler("set-my-position", function(position) {
localPlayer.position = position;
});