mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2025-01-11 00:03:18 +08:00
15 lines
356 B
Lua
15 lines
356 B
Lua
RegisterNetEvent('runcode:gotSnippet')
|
|
|
|
AddEventHandler('runcode:gotSnippet', function(id, code)
|
|
local res, err = RunCode(code)
|
|
|
|
if not err then
|
|
if type(res) == 'vector3' then
|
|
res = json.encode({ table.unpack(res) })
|
|
elseif type(res) == 'table' then
|
|
res = json.encode(res)
|
|
end
|
|
end
|
|
|
|
TriggerServerEvent('runcode:gotResult', id, res, err)
|
|
end) |