-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathserver.lua
30 lines (25 loc) · 881 Bytes
/
server.lua
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
local scenes = {}
RegisterNetEvent('nh-scenes:fetch', function()
local src = source
TriggerClientEvent('nh-scenes:send', src, scenes)
end)
RegisterNetEvent('nh-scenes:add', function(coords, message, color, distance)
table.insert(scenes, {
message = message,
color = color,
distance = distance,
coords = coords
})
TriggerClientEvent('nh-scenes:send', -1, scenes)
TriggerEvent('nh-scenes:log', source, message, coords)
end)
RegisterNetEvent('nh-scenes:delete', function(key)
table.remove(scenes, key)
TriggerClientEvent('nh-scenes:send', -1, scenes)
end)
RegisterNetEvent('nh-scenes:log', function(id, text, coords)
local f, err = io.open('sceneLogging.txt', 'a')
if not f then return print(err) end
f:write('Player: ['..id..'] Placed Scene: ['..text..'] At Coords = '..coords..'\n')
f:close()
end)