-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsh-data-example.lua
More file actions
42 lines (35 loc) · 1.19 KB
/
Copy pathsh-data-example.lua
File metadata and controls
42 lines (35 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
local HOUSES_CONTENT_TYPE <const> = 'houses'
Grid.Content.registerContentType(HOUSES_CONTENT_TYPE, {
POLICIES.LOGIC.SERVER,
POLICIES.HANDLE.SERVER_ONLY,
POLICIES.PERSISTENCE.TEMPORARY
})
if IsDuplicityVersion() then
Grid.Content.setContentLoadLogic(HOUSES_CONTENT_TYPE, function(gridId, contentType, content, playerId)
local house = Houses[content.houseId]
TriggerClientEvent('houses:loadHouseData', playerId, house)
return true
end)
Grid.Content.setContentUnloadLogic(HOUSES_CONTENT_TYPE, function(gridId, contentType, content, playerId)
TriggerClientEvent('houses:unloadHouseData', playerId, content.houseId)
return true
end)
Houses = {}
function Houses.addHouse()
-- internal house script logic
-- ...
local house = {
id = 'house_1',
coords = vector4(1614.0234, 2912.5281, 55.2463, 72.3476),
}
TriggerEvent(
'maku_grid:addContent',
Grid.getGridIdFromPosition(house.coords.x, house.coords.y),
HOUSES_CONTENT_TYPE,
{
houseId = house.id,
coords = house.coords
}
)
end
end