Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document N_0x45f35c0edc33b03b #909

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions NETWORK/N_0x45f35c0edc33b03b.md

This file was deleted.

45 changes: 45 additions & 0 deletions NetworkAddMapEntityToSynchronisedScene.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
ns: NETWORK
aliases: ["0x45F35C0EDC33B03B"]
---
## NETWORK_ADD_MAP_ENTITY_TO_SYNCHRONISED_SCENE

```c
// 0x45F35C0EDC33B03B
void NETWORK_ADD_MAP_ENTITY_TO_SYNCHRONISED_SCENE(int netScene, Hash modelHash, float x, float y, float z, cs_type(float) char* animDict, char* animName, float blendInSpeed, float blendOutSpeed, int flags);
```

Adds a map object/entity to a synchronised scene.

## Parameters
* **netScene**: The net scene's ID, which is returned by NetworkCreateSynchronisedScene
* **modelHash**: The object model's hash
* **x**: x coordinate
* **y**: y coordinate
* **z**: z coordinate
* **animDict**: The animation dictionary to play on this object
* **animName**: The animation name to play on this object
* **blendInSpeed**: How quickly the object blends into the animation (default is 8.0)
* **blendOutSpeed**: How quickly the object blends out of the animation (default is 8.0)
* **flags**: Animation flags (See TaskPlayAnim)

## Examples
```lua
local slotMachineCoords = vector3(1106.67, 230.59, -50.09) -- Where to look for the slot machine
local slotMachineObjectHash = `vw_prop_casino_slot_02a` -- Which slot machine to look for
local slotMachineObjectID = GetClosestObjectOfType(slotMachineCoords, 1.0, slotMachineObjectHash, false, false, false) -- ID of the found slot machine
local slotMachineObjectCoords = GetEntityCoords(slotMachineObjectID, false) -- Coords of the slot machine, this is where we'll create a synchronized scene
local animDict = 'anim_casino_a@amb@casino@games@slots@male' -- Animation dictionary to use

-- Create the synchronised scene
local netSceneID = NetworkCreateSynchronisedScene(slotMachineObjectCoords, 0.0, 0.0, GetEntityHeading(slotMachineObjectID), 2, true, false, 1.0, 0.0, 1.0)
-- Play the pull_spin_a_slotmachine animation on the slot machine object
NetworkAddMapEntityToSynchronisedScene(netSceneID, slotMachineObjectHash, slotMachineObjectCoords, animDict, 'pull_spin_a_slotmachine', 2.0, -1.5, 13)
NetworkStartSynchronisedScene(netSceneID) -- Start the synchronised scene

print('Lever pull animation started!')

while GetSynchronizedScenePhase(NetworkGetLocalSceneFromNetworkId(netSceneID)) < 1.0 do Wait(0) end -- Wait for the lever pull animation to finish

print('Lever pull animation finished!')
```
Loading