1
0
mirror of https://github.com/citizenfx/cfx-server-data.git synced 2025-01-09 23:02:56 +08:00
cfx-server-data/resources/runcode/runcode_cl.lua
2019-10-21 15:04:55 +02:00

15 lines
368 B
Lua

RegisterNetEvent('runcode:gotSnippet')
AddEventHandler('runcode:gotSnippet', function(id, lang, code)
local res, err = RunCode(lang, 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)