mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2026-11-10 13:57:18 +01:00
Code modernize (#234)
* refactor: declare exports at runtime and drop the player-data provides alias Signed-off-by: Mathu-lmn <[email protected]> * refactor: pass handlers directly to RegisterNetEvent Signed-off-by: Mathu-lmn <[email protected]> * refactor: use CreateThread/Wait without the Citizen prefix Signed-off-by: Mathu-lmn <[email protected]> * chore: remove trailing whitespace, stray lines and unused locals Signed-off-by: Mathu-lmn <[email protected]> --------- Signed-off-by: Mathu-lmn <[email protected]>
This commit is contained in:
@@ -59,5 +59,3 @@ spawnpoint 'a_m_y_hipster_01' { x = 714.109, y = 4151.15, z = 35.7792 }
|
|||||||
spawnpoint 'a_m_y_hipster_02' { x = -103.651, y = -967.93, z = 296.52 }
|
spawnpoint 'a_m_y_hipster_02' { x = -103.651, y = -967.93, z = 296.52 }
|
||||||
spawnpoint 'a_m_y_hipster_01' { x = -265.333, y = -2419.35, z = 122.366 }
|
spawnpoint 'a_m_y_hipster_01' { x = -265.333, y = -2419.35, z = 122.366 }
|
||||||
spawnpoint 'a_m_y_hipster_02' { x = 1788.25, y = 3890.34, z = 34.3849 }
|
spawnpoint 'a_m_y_hipster_02' { x = 1788.25, y = 3890.34, z = 34.3849 }
|
||||||
|
|
||||||
--
|
|
||||||
|
|||||||
@@ -58,5 +58,3 @@ spawnpoint 'a_m_y_skater_01' { x = 714.109, y = 4151.15, z = 35.7792 }
|
|||||||
spawnpoint 'a_m_y_skater_02' { x = -103.651, y = -967.93, z = 296.52 }
|
spawnpoint 'a_m_y_skater_02' { x = -103.651, y = -967.93, z = 296.52 }
|
||||||
spawnpoint 'a_m_y_skater_01' { x = -265.333, y = -2419.35, z = 122.366 }
|
spawnpoint 'a_m_y_skater_01' { x = -265.333, y = -2419.35, z = 122.366 }
|
||||||
spawnpoint 'a_m_y_skater_02' { x = 1788.25, y = 3890.34, z = 34.3849 }
|
spawnpoint 'a_m_y_skater_02' { x = 1788.25, y = 3890.34, z = 34.3849 }
|
||||||
|
|
||||||
--
|
|
||||||
@@ -80,14 +80,12 @@ local function handleFountainStuff(source, id, pickup)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- event for picking up fountain->player
|
-- event for picking up fountain->player
|
||||||
RegisterNetEvent('money_fountain:tryPickup')
|
RegisterNetEvent('money_fountain:tryPickup', function(id)
|
||||||
AddEventHandler('money_fountain:tryPickup', function(id)
|
|
||||||
handleFountainStuff(source, id, true)
|
handleFountainStuff(source, id, true)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- event for donating player->fountain
|
-- event for donating player->fountain
|
||||||
RegisterNetEvent('money_fountain:tryPlace')
|
RegisterNetEvent('money_fountain:tryPlace', function(id)
|
||||||
AddEventHandler('money_fountain:tryPlace', function(id)
|
|
||||||
handleFountainStuff(source, id, false)
|
handleFountainStuff(source, id, false)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ local moneyTypes = {
|
|||||||
bank = `BANK_BALANCE`,
|
bank = `BANK_BALANCE`,
|
||||||
}
|
}
|
||||||
|
|
||||||
RegisterNetEvent('money:displayUpdate')
|
RegisterNetEvent('money:displayUpdate', function(type, money)
|
||||||
|
|
||||||
AddEventHandler('money:displayUpdate', function(type, money)
|
|
||||||
local stat = moneyTypes[type]
|
local stat = moneyTypes[type]
|
||||||
if not stat then return end
|
if not stat then return end
|
||||||
StatSetInt(stat, math.floor(money))
|
StatSetInt(stat, math.floor(money))
|
||||||
|
|||||||
@@ -12,5 +12,6 @@ game 'gta5'
|
|||||||
client_script 'client.lua'
|
client_script 'client.lua'
|
||||||
server_script 'server.lua'
|
server_script 'server.lua'
|
||||||
|
|
||||||
--dependency 'cfx.re/playerData.v1alpha1'
|
|
||||||
lua54 'yes'
|
lua54 'yes'
|
||||||
|
|
||||||
|
dependency 'player-data'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
local playerData = exports['cfx.re/playerData.v1alpha1']
|
local playerData = exports['player-data']
|
||||||
|
|
||||||
local validMoneyTypes = {
|
local validMoneyTypes = {
|
||||||
bank = true,
|
bank = true,
|
||||||
@@ -88,9 +88,7 @@ AddEventHandler('money:updated', function(data)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('money:requestDisplay')
|
RegisterNetEvent('money:requestDisplay', function()
|
||||||
|
|
||||||
AddEventHandler('money:requestDisplay', function()
|
|
||||||
local source = source
|
local source = source
|
||||||
local playerId = playerData:getPlayerId(source)
|
local playerId = playerData:getPlayerId(source)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
AddEventHandler('gameEventTriggered', function(eventName, args)
|
AddEventHandler('gameEventTriggered', function(eventName, args)
|
||||||
if eventName == 'CEventNetworkEntityDamage' then
|
if eventName == 'CEventNetworkEntityDamage' then
|
||||||
local victim = args[1]
|
local victim = args[1]
|
||||||
local culprit = args[2]
|
|
||||||
local isDead = args[6] == 1
|
local isDead = args[6] == 1
|
||||||
|
|
||||||
if isDead then
|
if isDead then
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
local safePositions = {}
|
local safePositions = {}
|
||||||
|
|
||||||
RegisterNetEvent('money:allowPickupNear')
|
RegisterNetEvent('money:allowPickupNear', function(pedId)
|
||||||
|
|
||||||
AddEventHandler('money:allowPickupNear', function(pedId)
|
|
||||||
local entity = NetworkGetEntityFromNetworkId(pedId)
|
local entity = NetworkGetEntityFromNetworkId(pedId)
|
||||||
|
|
||||||
Wait(250)
|
Wait(250)
|
||||||
@@ -19,9 +17,7 @@ AddEventHandler('money:allowPickupNear', function(pedId)
|
|||||||
safePositions[pedId] = coords
|
safePositions[pedId] = coords
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('money:tryPickup')
|
RegisterNetEvent('money:tryPickup', function(entity)
|
||||||
|
|
||||||
AddEventHandler('money:tryPickup', function(entity)
|
|
||||||
if not safePositions[entity] then
|
if not safePositions[entity] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,7 +10,3 @@ fx_version 'cerulean'
|
|||||||
game 'common'
|
game 'common'
|
||||||
|
|
||||||
server_script 'server.lua'
|
server_script 'server.lua'
|
||||||
|
|
||||||
provides {
|
|
||||||
'cfx.re/playerData.v1alpha1'
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
-- it works in a fairly simple way: a set of identifiers is assigned to an account ID, and said
|
-- it works in a fairly simple way: a set of identifiers is assigned to an account ID, and said
|
||||||
-- account ID is then returned/added as state bag
|
-- account ID is then returned/added as state bag
|
||||||
--
|
--
|
||||||
-- it also implements the `cfx.re/playerData.v1alpha1` spec, which is exposed through the following:
|
-- it also implements the `player-data` spec, which is exposed through the following:
|
||||||
-- - getPlayerId(source: string)
|
-- - getPlayerId(source: string)
|
||||||
-- - getPlayerById(dbId: string)
|
-- - getPlayerById(dbId: string)
|
||||||
-- - getPlayerIdFromIdentifier(identifier: string)
|
-- - getPlayerIdFromIdentifier(identifier: string)
|
||||||
@@ -130,8 +130,6 @@ AddEventHandler('playerConnecting', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- and migrate them to a 'joining' ID where possible
|
-- and migrate them to a 'joining' ID where possible
|
||||||
RegisterNetEvent('playerJoining')
|
|
||||||
|
|
||||||
AddEventHandler('playerJoining', function(oldIdx)
|
AddEventHandler('playerJoining', function(oldIdx)
|
||||||
-- resource restart race condition
|
-- resource restart race condition
|
||||||
local oldPlayer = players[tostring(oldIdx)]
|
local oldPlayer = players[tostring(oldIdx)]
|
||||||
@@ -189,25 +187,10 @@ RegisterCommand('playerData', function(source, args)
|
|||||||
end
|
end
|
||||||
end, true)
|
end, true)
|
||||||
|
|
||||||
-- COMPATIBILITY for server versions that don't export provide
|
|
||||||
local function getExportEventName(resource, name)
|
|
||||||
return string.format('__cfx_export_%s_%s', resource, name)
|
|
||||||
end
|
|
||||||
|
|
||||||
function AddExport(name, fn)
|
|
||||||
if not Citizen.Traits or not Citizen.Traits.ProvidesExports then
|
|
||||||
AddEventHandler(getExportEventName('cfx.re/playerData.v1alpha1', name), function(setCB)
|
|
||||||
setCB(fn)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
exports(name, fn)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- exports
|
-- exports
|
||||||
AddExport('getPlayerIdFromIdentifier', getPlayerIdFromIdentifier)
|
exports('getPlayerIdFromIdentifier', getPlayerIdFromIdentifier)
|
||||||
|
|
||||||
AddExport('getPlayerId', function(playerIdx)
|
exports('getPlayerId', function(playerIdx)
|
||||||
local player = players[tostring(playerIdx)]
|
local player = players[tostring(playerIdx)]
|
||||||
|
|
||||||
if not player then
|
if not player then
|
||||||
@@ -217,6 +200,6 @@ AddExport('getPlayerId', function(playerIdx)
|
|||||||
return player.dbId
|
return player.dbId
|
||||||
end)
|
end)
|
||||||
|
|
||||||
AddExport('getPlayerById', function(playerId)
|
exports('getPlayerById', function(playerId)
|
||||||
return playersById[tostring(playerId)]
|
return playersById[tostring(playerId)]
|
||||||
end)
|
end)
|
||||||
@@ -13,19 +13,6 @@ server_script 'playernames_api.lua'
|
|||||||
client_script 'playernames_cl.lua'
|
client_script 'playernames_cl.lua'
|
||||||
server_script 'playernames_sv.lua'
|
server_script 'playernames_sv.lua'
|
||||||
|
|
||||||
-- make exports
|
|
||||||
local exportList = {
|
|
||||||
'setComponentColor',
|
|
||||||
'setComponentAlpha',
|
|
||||||
'setComponentVisibility',
|
|
||||||
'setWantedLevel',
|
|
||||||
'setHealthBarColor',
|
|
||||||
'setNameTemplate'
|
|
||||||
}
|
|
||||||
|
|
||||||
exports(exportList)
|
|
||||||
server_exports(exportList)
|
|
||||||
|
|
||||||
-- add files
|
-- add files
|
||||||
files {
|
files {
|
||||||
'template/template.lua'
|
'template/template.lua'
|
||||||
|
|||||||
@@ -42,6 +42,13 @@ setHealthBarColor = getTriggerFunction('sehc')
|
|||||||
setNameTemplate = getTriggerFunction('tpl')
|
setNameTemplate = getTriggerFunction('tpl')
|
||||||
setName = getTriggerFunction('name')
|
setName = getTriggerFunction('name')
|
||||||
|
|
||||||
|
exports('setComponentColor', setComponentColor)
|
||||||
|
exports('setComponentAlpha', setComponentAlpha)
|
||||||
|
exports('setComponentVisibility', setComponentVisibility)
|
||||||
|
exports('setWantedLevel', setWantedLevel)
|
||||||
|
exports('setHealthBarColor', setHealthBarColor)
|
||||||
|
exports('setNameTemplate', setNameTemplate)
|
||||||
|
|
||||||
if not io then
|
if not io then
|
||||||
io = { write = nil, open = nil }
|
io = { write = nil, open = nil }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -142,9 +142,7 @@ local function getSettings(id)
|
|||||||
return mpGamerTagSettings[i]
|
return mpGamerTagSettings[i]
|
||||||
end
|
end
|
||||||
|
|
||||||
RegisterNetEvent('playernames:configure')
|
RegisterNetEvent('playernames:configure', function(id, key, ...)
|
||||||
|
|
||||||
AddEventHandler('playernames:configure', function(id, key, ...)
|
|
||||||
local args = table.pack(...)
|
local args = table.pack(...)
|
||||||
|
|
||||||
if key == 'tglc' then
|
if key == 'tglc' then
|
||||||
@@ -183,7 +181,7 @@ AddEventHandler('onResourceStop', function(name)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
SetTimeout(0, function()
|
CreateThread(function()
|
||||||
TriggerServerEvent('playernames:init')
|
TriggerServerEvent('playernames:init')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ AddEventHandler('playerDropped', function()
|
|||||||
activePlayers[source] = nil
|
activePlayers[source] = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('playernames:init')
|
RegisterNetEvent('playernames:init', function()
|
||||||
AddEventHandler('playernames:init', function()
|
|
||||||
reconfigure(source)
|
reconfigure(source)
|
||||||
activePlayers[source] = true
|
activePlayers[source] = true
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -6,25 +6,13 @@ author 'Cfx.re <[email protected]>'
|
|||||||
description 'A flexible handler for game type/map association.'
|
description 'A flexible handler for game type/map association.'
|
||||||
repository 'https://github.com/citizenfx/cfx-server-data'
|
repository 'https://github.com/citizenfx/cfx-server-data'
|
||||||
|
|
||||||
client_scripts {
|
client_script 'mapmanager_client.lua'
|
||||||
"mapmanager_shared.lua",
|
|
||||||
"mapmanager_client.lua"
|
|
||||||
}
|
|
||||||
|
|
||||||
server_scripts {
|
server_script 'mapmanager_server.lua'
|
||||||
"mapmanager_shared.lua",
|
|
||||||
"mapmanager_server.lua"
|
shared_script 'mapmanager_shared.lua'
|
||||||
}
|
|
||||||
|
|
||||||
fx_version 'cerulean'
|
fx_version 'cerulean'
|
||||||
games { 'gta5', 'rdr3' }
|
games { 'gta5', 'rdr3' }
|
||||||
|
|
||||||
server_export "getCurrentGameType"
|
|
||||||
server_export "getCurrentMap"
|
|
||||||
server_export "changeGameType"
|
|
||||||
server_export "changeMap"
|
|
||||||
server_export "doesMapSupportGameType"
|
|
||||||
server_export "getMaps"
|
|
||||||
server_export "roundEnded"
|
|
||||||
|
|
||||||
rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.'
|
rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.'
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ AddEventHandler('onClientResourceStart', function(res)
|
|||||||
loadMap(res)
|
loadMap(res)
|
||||||
|
|
||||||
-- defer this to the next game tick to work around a lack of dependencies
|
-- defer this to the next game tick to work around a lack of dependencies
|
||||||
Citizen.CreateThread(function()
|
CreateThread(function()
|
||||||
Citizen.Wait(15)
|
Wait(15)
|
||||||
|
|
||||||
if maps[res] then
|
if maps[res] then
|
||||||
TriggerEvent('onClientMapStart', res)
|
TriggerEvent('onClientMapStart', res)
|
||||||
|
|||||||
@@ -313,3 +313,11 @@ function doesMapSupportGameType(gameType, map)
|
|||||||
|
|
||||||
return maps[map].gameTypes[gameType]
|
return maps[map].gameTypes[gameType]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
exports('getCurrentGameType', getCurrentGameType)
|
||||||
|
exports('getCurrentMap', getCurrentMap)
|
||||||
|
exports('changeGameType', changeGameType)
|
||||||
|
exports('changeMap', changeMap)
|
||||||
|
exports('doesMapSupportGameType', doesMapSupportGameType)
|
||||||
|
exports('getMaps', getMaps)
|
||||||
|
exports('roundEnded', roundEnded)
|
||||||
|
|||||||
@@ -185,9 +185,7 @@ local function freezePlayer(id, freeze)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function loadScene(x, y, z)
|
function loadScene(x, y, z)
|
||||||
if not NewLoadSceneStart then
|
if not NewLoadSceneStart then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
NewLoadSceneStart(x, y, z, 0.0, 0.0, 0.0, 20.0, 0)
|
NewLoadSceneStart(x, y, z, 0.0, 0.0, 0.0, 20.0, 0)
|
||||||
|
|
||||||
@@ -199,13 +197,11 @@ local spawnLock = false
|
|||||||
|
|
||||||
-- spawns the current player at a certain spawn point index (or a random one, for that matter)
|
-- spawns the current player at a certain spawn point index (or a random one, for that matter)
|
||||||
function spawnPlayer(spawnIdx, cb)
|
function spawnPlayer(spawnIdx, cb)
|
||||||
if spawnLock then
|
if spawnLock then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
spawnLock = true
|
spawnLock = true
|
||||||
|
|
||||||
Citizen.CreateThread(function()
|
CreateThread(function()
|
||||||
-- if the spawn isn't set, select a random one
|
-- if the spawn isn't set, select a random one
|
||||||
if not spawnIdx then
|
if not spawnIdx then
|
||||||
spawnIdx = GetRandomIntInRange(1, #spawnPoints + 1)
|
spawnIdx = GetRandomIntInRange(1, #spawnPoints + 1)
|
||||||
@@ -231,7 +227,7 @@ function spawnPlayer(spawnIdx, cb)
|
|||||||
DoScreenFadeOut(500)
|
DoScreenFadeOut(500)
|
||||||
|
|
||||||
while not IsScreenFadedOut() do
|
while not IsScreenFadedOut() do
|
||||||
Citizen.Wait(0)
|
Wait(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -302,7 +298,7 @@ function spawnPlayer(spawnIdx, cb)
|
|||||||
local time = GetGameTimer()
|
local time = GetGameTimer()
|
||||||
|
|
||||||
while (not HasCollisionLoadedAroundEntity(ped) and (GetGameTimer() - time) < 5000) do
|
while (not HasCollisionLoadedAroundEntity(ped) and (GetGameTimer() - time) < 5000) do
|
||||||
Citizen.Wait(0)
|
Wait(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
ShutdownLoadingScreen()
|
ShutdownLoadingScreen()
|
||||||
@@ -311,7 +307,7 @@ function spawnPlayer(spawnIdx, cb)
|
|||||||
DoScreenFadeIn(500)
|
DoScreenFadeIn(500)
|
||||||
|
|
||||||
while not IsScreenFadedIn() do
|
while not IsScreenFadedIn() do
|
||||||
Citizen.Wait(0)
|
Wait(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -332,10 +328,10 @@ end
|
|||||||
local respawnForced
|
local respawnForced
|
||||||
local diedAt
|
local diedAt
|
||||||
|
|
||||||
Citizen.CreateThread(function()
|
CreateThread(function()
|
||||||
-- main loop thing
|
-- main loop thing
|
||||||
while true do
|
while true do
|
||||||
Citizen.Wait(50)
|
Wait(50)
|
||||||
|
|
||||||
local playerPed = PlayerPedId()
|
local playerPed = PlayerPedId()
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,7 @@
|
|||||||
RegisterServerEvent('baseevents:onPlayerDied')
|
RegisterNetEvent('baseevents:onPlayerWasted')
|
||||||
RegisterServerEvent('baseevents:onPlayerKilled')
|
RegisterNetEvent('baseevents:enteringVehicle')
|
||||||
RegisterServerEvent('baseevents:onPlayerWasted')
|
RegisterNetEvent('baseevents:enteringAborted')
|
||||||
RegisterServerEvent('baseevents:enteringVehicle')
|
RegisterNetEvent('baseevents:enteredVehicle')
|
||||||
RegisterServerEvent('baseevents:enteringAborted')
|
RegisterNetEvent('baseevents:leftVehicle')
|
||||||
RegisterServerEvent('baseevents:enteredVehicle')
|
RegisterNetEvent('baseevents:onPlayerKilled')
|
||||||
RegisterServerEvent('baseevents:leftVehicle')
|
RegisterNetEvent('baseevents:onPlayerDied')
|
||||||
|
|
||||||
AddEventHandler('baseevents:onPlayerKilled', function(killedBy, data)
|
|
||||||
local victim = source
|
|
||||||
|
|
||||||
RconLog({msgType = 'playerKilled', victim = victim, attacker = killedBy, data = data})
|
|
||||||
end)
|
|
||||||
|
|
||||||
AddEventHandler('baseevents:onPlayerDied', function(killedBy, pos)
|
|
||||||
local victim = source
|
|
||||||
|
|
||||||
RconLog({msgType = 'playerDied', victim = victim, attackerType = killedBy, pos = pos})
|
|
||||||
end)
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
RegisterNetEvent('runcode:gotSnippet')
|
RegisterNetEvent('runcode:gotSnippet', function(id, lang, code)
|
||||||
|
|
||||||
AddEventHandler('runcode:gotSnippet', function(id, lang, code)
|
|
||||||
local res, err = RunCode(lang, code)
|
local res, err = RunCode(lang, code)
|
||||||
|
|
||||||
if not err then
|
if not err then
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
local openData
|
local openData
|
||||||
|
|
||||||
RegisterNetEvent('runcode:openUi')
|
RegisterNetEvent('runcode:openUi', function(options)
|
||||||
|
|
||||||
AddEventHandler('runcode:openUi', function(options)
|
|
||||||
openData = {
|
openData = {
|
||||||
type = 'open',
|
type = 'open',
|
||||||
options = options,
|
options = options,
|
||||||
@@ -48,9 +46,7 @@ RegisterNUICallback('runCodeInBand', function(args, cb)
|
|||||||
TriggerServerEvent('runcode:runInBand', id, args)
|
TriggerServerEvent('runcode:runInBand', id, args)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('runcode:inBandResult')
|
RegisterNetEvent('runcode:inBandResult', function(id, result)
|
||||||
|
|
||||||
AddEventHandler('runcode:inBandResult', function(id, result)
|
|
||||||
if rcCbs[id] then
|
if rcCbs[id] then
|
||||||
local cb = rcCbs[id]
|
local cb = rcCbs[id]
|
||||||
rcCbs[id] = nil
|
rcCbs[id] = nil
|
||||||
|
|||||||
@@ -50,9 +50,7 @@ local function handleRunCode(data, res)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
RegisterNetEvent('runcode:runInBand')
|
RegisterNetEvent('runcode:runInBand', function(id, data)
|
||||||
|
|
||||||
AddEventHandler('runcode:runInBand', function(id, data)
|
|
||||||
local s = source
|
local s = source
|
||||||
local privs = GetPrivs(s)
|
local privs = GetPrivs(s)
|
||||||
|
|
||||||
@@ -155,8 +153,7 @@ CreateThread(function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('runcode:gotResult')
|
RegisterNetEvent('runcode:gotResult', returnCode)
|
||||||
AddEventHandler('runcode:gotResult', returnCode)
|
|
||||||
|
|
||||||
SetHttpHandler(function(req, res)
|
SetHttpHandler(function(req, res)
|
||||||
local path = req.path
|
local path = req.path
|
||||||
|
|||||||
Reference in New Issue
Block a user