NetworkAddMapEntityToSynchronisedScene
DocsNetworkAddMapEntityToSynchronisedScene(netScene, modelHash, x, y, z, animDict, animName, blendInSpeed, blendOutSpeed, flags)Description
Introduced in build 1734
Adds a map entity to a network synchronized scene. This native function is utilized only once as of game build 2944 within the casino_slots script.
Please note that it's only possible to add a single map entity to synchronised scenes.
It's advisable to initially locate the object and retrieve its actual coordinates using <code>GET_CLOSEST_OBJECT_OF_TYPE</code>.
Parameters
| Name | Type | Description |
|---|---|---|
netScene | int | Net scene ID returned by [`NETWORK_CREATE_SYNCHRONISED_SCENE`](#\_0x7CD6BC4C2BBDD526) |
modelHash | Hash | Model hash of the object the script should look for. |
x | float | Object X coord. |
y | float | Object Y coord. |
z | float | Object Z coord. |
animDict | char* | Anim dictionary to play on this object. |
animName | char* | Anim name to play on this object. |
blendInSpeed | float | Float representing how quickly the animation should be blended into. Default is `8.0`. |
blendOutSpeed | float | Float representing how quickly the animation should be blended out of. Default is `-8.0` |
flags | int | See [`NETWORK_ADD_PED_TO_SYNCHRONISED_SCENE`](#\_0x742A637471BCECD9). |
Quick Snippet: Get Coordinatesxyz
xyzAdd this command to your client script to retrieve precise locations in-game.
-- Add this to your client.lua. Type /pos in-game to copy coords.
RegisterCommand('pos', function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local heading = GetEntityHeading(ped)
local output = string.format("vector4(%.2f, %.2f, %.2f, %.2f)", coords.x, coords.y, coords.z, heading)
print(output)
TriggerEvent('chat:addMessage', { args = { '^4[COORD]^0', output } })
end)Quick Snippet: Load Model HashmodelHash
modelHashModels must be loaded before use. This snippet handles requesting and releasing properly.
-- Properly load a model before spawning/using it
local modelName = "prop_barrel_01a" -- change to your model
local modelHash = GetHashKey(modelName)
RequestModel(modelHash)
while not HasModelLoaded(modelHash) do
Wait(0)
end
print("Model loaded: " .. modelName .. " (" .. modelHash .. ")")
-- Release when done:
-- SetModelAsNoLongerNeeded(modelHash)Returns
voidThis native does not return a value.