1
0
mirror of https://github.com/citizenfx/cfx-server-data.git synced 2025-01-11 08:25:08 +08:00
cfx-server-data/resources/[system]/runcode/runcode_cl.lua

15 lines
368 B
Lua
Raw Normal View History

2017-09-05 17:58:39 +08:00
RegisterNetEvent('runcode:gotSnippet')
AddEventHandler('runcode:gotSnippet', function(id, lang, code)
local res, err = RunCode(lang, code)
2017-09-05 17:58:39 +08:00
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)