mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2025-12-12 06:14:09 +01:00
add runcode resource
This commit is contained in:
15
resources/runcode/runcode_cl.lua
Normal file
15
resources/runcode/runcode_cl.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user