Skip to content

Commit 13a84b3

Browse files
Release 2022-12-12
1 parent a5d8ecf commit 13a84b3

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed

docs-gen/client-cfx.def.lua

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3268,6 +3268,23 @@ function SetVehicleWheelFlags(vehicle, wheelIndex, flags) end
32683268
function ExperimentalLoadCloneCreate(data, objectId, tree) end
32693269

32703270

3271+
--- Replaces the `popgroups` (CPopGroupList) meta file with the file in the specified path.
3272+
--- @usage -- fxmanifest.lua:
3273+
--- file 'popgroups_dlc.xml'
3274+
---
3275+
--- -- client.lua:
3276+
--- OverridePopGroups('popgroups_dlc.xml')
3277+
---
3278+
--- -- restore the original after five minutes
3279+
--- Wait(1000 * 60 * 5)
3280+
--- OverridePopGroups(nil
3281+
--- @hash [0xD3BC438F](https://docs.fivem.net/natives/?_0xD3BC438F)
3282+
--- @param path string (char*)
3283+
--- @return void
3284+
--- @overload fun(path: string): void
3285+
function OverridePopGroups(path) end
3286+
3287+
32713288
--- Enables or disables whether train doors should be forced open whilst a player is inside the train. This is enabled by default in multiplayer.
32723289
---
32733290
--- @hash [0xD4D1BA63](https://docs.fivem.net/natives/?_0xD4D1BA63)

docs-gen/shared-cfx.def.lua

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,28 @@ function GetResourceState(resourceName) end
101101
function GetVehicleHandbrake(vehicle) end
102102

103103

104+
--- Returns the entity handle for the specified state bag name. For use with [ADD_STATE_BAG_CHANGE_HANDLER](?\_0x5BA35AAF).
105+
--- @usage AddStateBagChangeHandler("blockTasks", nil, function(bagName, key, value)
106+
--- local entity = GetEntityFromStateBagName(bagName)
107+
--- -- Whoops, we don't have a valid entity!
108+
--- if entity === 0 then return end
109+
--- -- We don't want to freeze the entity position if the entity collision hasn't loaded yet
110+
--- while not HasCollisionLoadedAroundEntity(entity) do
111+
--- -- The entity went out of our scope before the collision loaded
112+
--- if not DoesEntityExist(entity) then return end
113+
--- Wait(250)
114+
--- end
115+
--- SetEntityInvincible(entity, value)
116+
--- FreezeEntityPosition(entity, value)
117+
--- TaskSetBlockingOfNonTemporaryEvents(entity, value)
118+
--- end
119+
--- @hash [0x4BDF1867](https://docs.fivem.net/natives/?_0x4BDF1867)
120+
--- @param bagName string (char*)
121+
--- @return Entity
122+
--- @overload fun(bagName: string): Entity
123+
function GetEntityFromStateBagName(bagName) end
124+
125+
104126
--- GetInvokingResource
105127
---
106128
--- @hash [0x4D52FE5B](https://docs.fivem.net/natives/?_0x4D52FE5B)
@@ -177,7 +199,23 @@ function WasEventCanceled() end
177199
--- * **replicated**: Whether the set is meant to be replicated.
178200
---
179201
--- At this time, the change handler can't opt to reject changes.
180-
---
202+
---
203+
--- If bagName refers to an entity, use [GET_ENTITY_FROM_STATE_BAG_NAME](?\_0x4BDF1868) to get the entity handle
204+
--- If bagName refers to a player, use [GET_PLAYER_FROM_STATE_BAG_NAME](?\_0xA56135E0) to get the player handle
205+
--- @usage AddStateBagChangeHandler("blockTasks", nil, function(bagName, key, value)
206+
--- local entity = GetEntityFromStateBagName(bagName)
207+
--- -- Whoops, we don't have a valid entity!
208+
--- if entity === 0 then return end
209+
--- -- We don't want to freeze the entity position if the entity collision hasn't loaded yet
210+
--- while not HasCollisionLoadedAroundEntity(entity) do
211+
--- -- The entity went out of our scope before the collision loaded
212+
--- if not DoesEntityExist(entity) then return end
213+
--- Wait(250)
214+
--- end
215+
--- SetEntityInvincible(entity, value)
216+
--- FreezeEntityPosition(entity, value)
217+
--- TaskSetBlockingOfNonTemporaryEvents(entity, value)
218+
--- end
181219
--- @hash [0x5BA35AAF](https://docs.fivem.net/natives/?_0x5BA35AAF)
182220
--- @param keyFilter string (char*)
183221
--- @param bagFilter string (char*)
@@ -423,6 +461,20 @@ function SetResourceKvpFloat(key, value) end
423461
function GetInstanceId() end
424462

425463

464+
--- On the server this will return the players source, on the client it will return the player handle.
465+
--- @usage AddStateBagChangeHandler("isDead", nil, function(bagName, key, value)
466+
--- local ply = GetPlayerFromStateBagName(bagName)
467+
--- -- The player doesn't exist!
468+
--- if ply == 0 then return end
469+
--- print("Player: " .. GetPlayerName(ply) .. value and 'died!' or 'is alive!')
470+
--- end
471+
--- @hash [0xA56135E0](https://docs.fivem.net/natives/?_0xA56135E0)
472+
--- @param bagName string (char*)
473+
--- @return number
474+
--- @overload fun(bagName: string): number
475+
function GetPlayerFromStateBagName(bagName) end
476+
477+
426478
--- EndFindKvp
427479
---
428480
--- @hash [0xB3210203](https://docs.fivem.net/natives/?_0xB3210203)

0 commit comments

Comments
 (0)