mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2026-11-10 13:57:18 +01:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6afa3909c | ||
|
|
39b91b14ce | ||
|
|
2935a6ba1d | ||
|
|
478ba4a47d |
@@ -10,5 +10,5 @@ resource_type 'map' { gameTypes = { ['basic-gamemode'] = true } }
|
||||
|
||||
map 'map.lua'
|
||||
|
||||
fx_version 'adamant'
|
||||
fx_version 'cerulean'
|
||||
games { 'gta5', 'gta5enhanced' }
|
||||
|
||||
@@ -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_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 }
|
||||
|
||||
--
|
||||
|
||||
@@ -10,5 +10,5 @@ resource_type 'map' { gameTypes = { ['basic-gamemode'] = true } }
|
||||
|
||||
map 'map.lua'
|
||||
|
||||
fx_version 'adamant'
|
||||
fx_version 'cerulean'
|
||||
games { 'gta5', 'gta5enhanced' }
|
||||
|
||||
@@ -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_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 }
|
||||
|
||||
--
|
||||
@@ -10,7 +10,7 @@ resource_type 'map' { gameTypes = { ['basic-gamemode'] = true } }
|
||||
|
||||
map 'map.lua'
|
||||
|
||||
fx_version 'adamant'
|
||||
fx_version 'cerulean'
|
||||
game 'rdr3'
|
||||
|
||||
rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.'
|
||||
|
||||
@@ -11,4 +11,4 @@ resource_type 'gametype' { name = 'Freeroam' }
|
||||
client_script 'basic_client.lua'
|
||||
|
||||
game 'common'
|
||||
fx_version 'adamant'
|
||||
fx_version 'cerulean'
|
||||
|
||||
@@ -6,7 +6,7 @@ description 'An example money system client containing a money fountain.'
|
||||
repository 'https://github.com/citizenfx/cfx-server-data'
|
||||
author 'Cfx.re <[email protected]>'
|
||||
|
||||
fx_version 'bodacious'
|
||||
fx_version 'cerulean'
|
||||
game 'gta5'
|
||||
|
||||
client_script 'client.lua'
|
||||
|
||||
@@ -80,14 +80,12 @@ local function handleFountainStuff(source, id, pickup)
|
||||
end
|
||||
|
||||
-- event for picking up fountain->player
|
||||
RegisterNetEvent('money_fountain:tryPickup')
|
||||
AddEventHandler('money_fountain:tryPickup', function(id)
|
||||
RegisterNetEvent('money_fountain:tryPickup', function(id)
|
||||
handleFountainStuff(source, id, true)
|
||||
end)
|
||||
|
||||
-- event for donating player->fountain
|
||||
RegisterNetEvent('money_fountain:tryPlace')
|
||||
AddEventHandler('money_fountain:tryPlace', function(id)
|
||||
RegisterNetEvent('money_fountain:tryPlace', function(id)
|
||||
handleFountainStuff(source, id, false)
|
||||
end)
|
||||
|
||||
|
||||
@@ -3,9 +3,7 @@ local moneyTypes = {
|
||||
bank = `BANK_BALANCE`,
|
||||
}
|
||||
|
||||
RegisterNetEvent('money:displayUpdate')
|
||||
|
||||
AddEventHandler('money:displayUpdate', function(type, money)
|
||||
RegisterNetEvent('money:displayUpdate', function(type, money)
|
||||
local stat = moneyTypes[type]
|
||||
if not stat then return end
|
||||
StatSetInt(stat, math.floor(money))
|
||||
|
||||
@@ -6,11 +6,12 @@ description 'An example money system using KVS.'
|
||||
repository 'https://github.com/citizenfx/cfx-server-data'
|
||||
author 'Cfx.re <[email protected]>'
|
||||
|
||||
fx_version 'bodacious'
|
||||
fx_version 'cerulean'
|
||||
game 'gta5'
|
||||
|
||||
client_script 'client.lua'
|
||||
server_script 'server.lua'
|
||||
|
||||
--dependency 'cfx.re/playerData.v1alpha1'
|
||||
lua54 'yes'
|
||||
|
||||
dependency 'player-data'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local playerData = exports['cfx.re/playerData.v1alpha1']
|
||||
local playerData = exports['player-data']
|
||||
|
||||
local validMoneyTypes = {
|
||||
bank = true,
|
||||
@@ -88,9 +88,7 @@ AddEventHandler('money:updated', function(data)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('money:requestDisplay')
|
||||
|
||||
AddEventHandler('money:requestDisplay', function()
|
||||
RegisterNetEvent('money:requestDisplay', function()
|
||||
local source = source
|
||||
local playerId = playerData:getPlayerId(source)
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
AddEventHandler('gameEventTriggered', function(eventName, args)
|
||||
if eventName == 'CEventNetworkEntityDamage' then
|
||||
local victim = args[1]
|
||||
local culprit = args[2]
|
||||
local isDead = args[6] == 1
|
||||
|
||||
if isDead then
|
||||
|
||||
@@ -6,7 +6,7 @@ description 'An example money system client.'
|
||||
author 'Cfx.re <[email protected]>'
|
||||
repository 'https://github.com/citizenfx/cfx-server-data'
|
||||
|
||||
fx_version 'bodacious'
|
||||
fx_version 'cerulean'
|
||||
game 'gta5'
|
||||
|
||||
client_script 'client.lua'
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
local safePositions = {}
|
||||
|
||||
RegisterNetEvent('money:allowPickupNear')
|
||||
|
||||
AddEventHandler('money:allowPickupNear', function(pedId)
|
||||
RegisterNetEvent('money:allowPickupNear', function(pedId)
|
||||
local entity = NetworkGetEntityFromNetworkId(pedId)
|
||||
|
||||
Wait(250)
|
||||
@@ -19,9 +17,7 @@ AddEventHandler('money:allowPickupNear', function(pedId)
|
||||
safePositions[pedId] = coords
|
||||
end)
|
||||
|
||||
RegisterNetEvent('money:tryPickup')
|
||||
|
||||
AddEventHandler('money:tryPickup', function(entity)
|
||||
RegisterNetEvent('money:tryPickup', function(entity)
|
||||
if not safePositions[entity] then
|
||||
return
|
||||
end
|
||||
@@ -38,5 +34,5 @@ AddEventHandler('money:tryPickup', function(entity)
|
||||
end)
|
||||
|
||||
AddEventHandler('entityRemoved', function(entity)
|
||||
safePositions[entity] = nil
|
||||
safePositions[NetworkGetNetworkIdFromEntity(entity)] = nil
|
||||
end)
|
||||
@@ -6,11 +6,7 @@ description 'A basic resource for storing player identifiers.'
|
||||
author 'Cfx.re <[email protected]>'
|
||||
repository 'https://github.com/citizenfx/cfx-server-data'
|
||||
|
||||
fx_version 'bodacious'
|
||||
fx_version 'cerulean'
|
||||
game 'common'
|
||||
|
||||
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
|
||||
-- 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)
|
||||
-- - getPlayerById(dbId: string)
|
||||
-- - getPlayerIdFromIdentifier(identifier: string)
|
||||
@@ -130,8 +130,6 @@ AddEventHandler('playerConnecting', function()
|
||||
end)
|
||||
|
||||
-- and migrate them to a 'joining' ID where possible
|
||||
RegisterNetEvent('playerJoining')
|
||||
|
||||
AddEventHandler('playerJoining', function(oldIdx)
|
||||
-- resource restart race condition
|
||||
local oldPlayer = players[tostring(oldIdx)]
|
||||
@@ -189,25 +187,10 @@ RegisterCommand('playerData', function(source, args)
|
||||
end
|
||||
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
|
||||
AddExport('getPlayerIdFromIdentifier', getPlayerIdFromIdentifier)
|
||||
exports('getPlayerIdFromIdentifier', getPlayerIdFromIdentifier)
|
||||
|
||||
AddExport('getPlayerId', function(playerIdx)
|
||||
exports('getPlayerId', function(playerIdx)
|
||||
local player = players[tostring(playerIdx)]
|
||||
|
||||
if not player then
|
||||
@@ -217,6 +200,6 @@ AddExport('getPlayerId', function(playerIdx)
|
||||
return player.dbId
|
||||
end)
|
||||
|
||||
AddExport('getPlayerById', function(playerId)
|
||||
exports('getPlayerById', function(playerId)
|
||||
return playersById[tostring(playerId)]
|
||||
end)
|
||||
@@ -13,24 +13,11 @@ server_script 'playernames_api.lua'
|
||||
client_script 'playernames_cl.lua'
|
||||
server_script 'playernames_sv.lua'
|
||||
|
||||
-- make exports
|
||||
local exportList = {
|
||||
'setComponentColor',
|
||||
'setComponentAlpha',
|
||||
'setComponentVisibility',
|
||||
'setWantedLevel',
|
||||
'setHealthBarColor',
|
||||
'setNameTemplate'
|
||||
}
|
||||
|
||||
exports(exportList)
|
||||
server_exports(exportList)
|
||||
|
||||
-- add files
|
||||
files {
|
||||
'template/template.lua'
|
||||
}
|
||||
|
||||
-- support the latest resource manifest
|
||||
fx_version 'adamant'
|
||||
fx_version 'cerulean'
|
||||
game 'gta5'
|
||||
|
||||
@@ -42,6 +42,13 @@ setHealthBarColor = getTriggerFunction('sehc')
|
||||
setNameTemplate = getTriggerFunction('tpl')
|
||||
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
|
||||
io = { write = nil, open = nil }
|
||||
end
|
||||
|
||||
@@ -142,9 +142,7 @@ local function getSettings(id)
|
||||
return mpGamerTagSettings[i]
|
||||
end
|
||||
|
||||
RegisterNetEvent('playernames:configure')
|
||||
|
||||
AddEventHandler('playernames:configure', function(id, key, ...)
|
||||
RegisterNetEvent('playernames:configure', function(id, key, ...)
|
||||
local args = table.pack(...)
|
||||
|
||||
if key == 'tglc' then
|
||||
@@ -183,7 +181,7 @@ AddEventHandler('onResourceStop', function(name)
|
||||
end
|
||||
end)
|
||||
|
||||
SetTimeout(0, function()
|
||||
CreateThread(function()
|
||||
TriggerServerEvent('playernames:init')
|
||||
end)
|
||||
|
||||
|
||||
@@ -37,8 +37,7 @@ AddEventHandler('playerDropped', function()
|
||||
activePlayers[source] = nil
|
||||
end)
|
||||
|
||||
RegisterNetEvent('playernames:init')
|
||||
AddEventHandler('playernames:init', function()
|
||||
RegisterNetEvent('playernames:init', function()
|
||||
reconfigure(source)
|
||||
activePlayers[source] = true
|
||||
end)
|
||||
|
||||
@@ -6,25 +6,13 @@ author 'Cfx.re <[email protected]>'
|
||||
description 'A flexible handler for game type/map association.'
|
||||
repository 'https://github.com/citizenfx/cfx-server-data'
|
||||
|
||||
client_scripts {
|
||||
"mapmanager_shared.lua",
|
||||
"mapmanager_client.lua"
|
||||
}
|
||||
client_script 'mapmanager_client.lua'
|
||||
|
||||
server_scripts {
|
||||
"mapmanager_shared.lua",
|
||||
"mapmanager_server.lua"
|
||||
}
|
||||
server_script 'mapmanager_server.lua'
|
||||
|
||||
fx_version 'adamant'
|
||||
shared_script 'mapmanager_shared.lua'
|
||||
|
||||
fx_version 'cerulean'
|
||||
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.'
|
||||
|
||||
@@ -40,8 +40,8 @@ AddEventHandler('onClientResourceStart', function(res)
|
||||
loadMap(res)
|
||||
|
||||
-- defer this to the next game tick to work around a lack of dependencies
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(15)
|
||||
CreateThread(function()
|
||||
Wait(15)
|
||||
|
||||
if maps[res] then
|
||||
TriggerEvent('onClientMapStart', res)
|
||||
|
||||
@@ -264,7 +264,7 @@ RegisterCommand("gametype", function(source, args)
|
||||
end
|
||||
changeGameType(args[1])
|
||||
print('gametype ' .. args[1] .. "\n")
|
||||
end)
|
||||
end, true)
|
||||
|
||||
function getCurrentGameType()
|
||||
return currentGameType
|
||||
@@ -313,3 +313,11 @@ function doesMapSupportGameType(gameType, map)
|
||||
|
||||
return maps[map].gameTypes[gameType]
|
||||
end
|
||||
|
||||
exports('getCurrentGameType', getCurrentGameType)
|
||||
exports('getCurrentMap', getCurrentMap)
|
||||
exports('changeGameType', changeGameType)
|
||||
exports('changeMap', changeMap)
|
||||
exports('doesMapSupportGameType', doesMapSupportGameType)
|
||||
exports('getMaps', getMaps)
|
||||
exports('roundEnded', roundEnded)
|
||||
|
||||
@@ -8,7 +8,7 @@ repository 'https://github.com/citizenfx/cfx-server-data'
|
||||
|
||||
client_script 'spawnmanager.lua'
|
||||
|
||||
fx_version 'adamant'
|
||||
fx_version 'cerulean'
|
||||
games { 'rdr3', 'gta5' }
|
||||
|
||||
rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.'
|
||||
|
||||
@@ -41,7 +41,7 @@ AddEventHandler('getMapDirectives', function(add)
|
||||
|
||||
-- recalculate the model for storage
|
||||
if not tonumber(model) then
|
||||
model = GetHashKey(model, _r)
|
||||
model = GetHashKey(model)
|
||||
end
|
||||
|
||||
-- store the spawn data in the state so we can erase it later on
|
||||
@@ -110,11 +110,10 @@ function addSpawnPoint(spawn)
|
||||
error("invalid spawn model")
|
||||
end
|
||||
|
||||
-- is is even a ped?
|
||||
-- not in V?
|
||||
--[[if not IsThisModelAPed(model) then
|
||||
-- is the model a ped?
|
||||
if not IsModelAPed(model) then
|
||||
error("this model ain't a ped!")
|
||||
end]]
|
||||
end
|
||||
|
||||
-- overwrite the model in case we hashed it
|
||||
spawn.model = model
|
||||
@@ -153,17 +152,17 @@ end
|
||||
-- function as existing in original R* scripts
|
||||
local function freezePlayer(id, freeze)
|
||||
local player = id
|
||||
SetPlayerControl(player, not freeze, false)
|
||||
SetPlayerControl(player, not freeze, 0)
|
||||
|
||||
local ped = GetPlayerPed(player)
|
||||
|
||||
if not freeze then
|
||||
if not IsEntityVisible(ped) then
|
||||
SetEntityVisible(ped, true)
|
||||
SetEntityVisible(ped, true, false)
|
||||
end
|
||||
|
||||
if not IsPedInAnyVehicle(ped) then
|
||||
SetEntityCollision(ped, true)
|
||||
if not IsPedInAnyVehicle(ped, false) then
|
||||
SetEntityCollision(ped, true, true)
|
||||
end
|
||||
|
||||
FreezeEntityPosition(ped, false)
|
||||
@@ -171,14 +170,13 @@ local function freezePlayer(id, freeze)
|
||||
SetPlayerInvincible(player, false)
|
||||
else
|
||||
if IsEntityVisible(ped) then
|
||||
SetEntityVisible(ped, false)
|
||||
SetEntityVisible(ped, false, false)
|
||||
end
|
||||
|
||||
SetEntityCollision(ped, false)
|
||||
SetEntityCollision(ped, false, false)
|
||||
FreezeEntityPosition(ped, true)
|
||||
--SetCharNeverTargetted(ped, true)
|
||||
SetPlayerInvincible(player, true)
|
||||
--RemovePtfxFromPed(ped)
|
||||
|
||||
if not IsPedFatallyInjured(ped) then
|
||||
ClearPedTasksImmediately(ped)
|
||||
@@ -187,17 +185,11 @@ local function freezePlayer(id, freeze)
|
||||
end
|
||||
|
||||
function loadScene(x, y, z)
|
||||
if not NewLoadSceneStart then
|
||||
return
|
||||
end
|
||||
if not NewLoadSceneStart then return end
|
||||
|
||||
NewLoadSceneStart(x, y, z, 0.0, 0.0, 0.0, 20.0, 0)
|
||||
|
||||
while IsNewLoadSceneActive() do
|
||||
networkTimer = GetNetworkTimer()
|
||||
|
||||
NetworkUpdateLoadScene()
|
||||
end
|
||||
while IsNewLoadSceneActive() do NetworkUpdateLoadScene() end
|
||||
end
|
||||
|
||||
-- to prevent trying to spawn multiple times
|
||||
@@ -205,13 +197,11 @@ local spawnLock = false
|
||||
|
||||
-- spawns the current player at a certain spawn point index (or a random one, for that matter)
|
||||
function spawnPlayer(spawnIdx, cb)
|
||||
if spawnLock then
|
||||
return
|
||||
end
|
||||
if spawnLock then return end
|
||||
|
||||
spawnLock = true
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
-- if the spawn isn't set, select a random one
|
||||
if not spawnIdx then
|
||||
spawnIdx = GetRandomIntInRange(1, #spawnPoints + 1)
|
||||
@@ -237,7 +227,7 @@ function spawnPlayer(spawnIdx, cb)
|
||||
DoScreenFadeOut(500)
|
||||
|
||||
while not IsScreenFadedOut() do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -308,7 +298,7 @@ function spawnPlayer(spawnIdx, cb)
|
||||
local time = GetGameTimer()
|
||||
|
||||
while (not HasCollisionLoadedAroundEntity(ped) and (GetGameTimer() - time) < 5000) do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
ShutdownLoadingScreen()
|
||||
@@ -317,7 +307,7 @@ function spawnPlayer(spawnIdx, cb)
|
||||
DoScreenFadeIn(500)
|
||||
|
||||
while not IsScreenFadedIn() do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -338,10 +328,10 @@ end
|
||||
local respawnForced
|
||||
local diedAt
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
-- main loop thing
|
||||
while true do
|
||||
Citizen.Wait(50)
|
||||
Wait(50)
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
|
||||
@@ -10,5 +10,5 @@ client_script 'deathevents.lua'
|
||||
client_script 'vehiclechecker.lua'
|
||||
server_script 'server.lua'
|
||||
|
||||
fx_version 'adamant'
|
||||
fx_version 'cerulean'
|
||||
game 'gta5'
|
||||
@@ -1,19 +1,7 @@
|
||||
RegisterServerEvent('baseevents:onPlayerDied')
|
||||
RegisterServerEvent('baseevents:onPlayerKilled')
|
||||
RegisterServerEvent('baseevents:onPlayerWasted')
|
||||
RegisterServerEvent('baseevents:enteringVehicle')
|
||||
RegisterServerEvent('baseevents:enteringAborted')
|
||||
RegisterServerEvent('baseevents:enteredVehicle')
|
||||
RegisterServerEvent('baseevents:leftVehicle')
|
||||
|
||||
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)
|
||||
RegisterNetEvent('baseevents:onPlayerWasted')
|
||||
RegisterNetEvent('baseevents:enteringVehicle')
|
||||
RegisterNetEvent('baseevents:enteringAborted')
|
||||
RegisterNetEvent('baseevents:enteredVehicle')
|
||||
RegisterNetEvent('baseevents:leftVehicle')
|
||||
RegisterNetEvent('baseevents:onPlayerKilled')
|
||||
RegisterNetEvent('baseevents:onPlayerDied')
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
RegisterNetEvent('runcode:gotSnippet')
|
||||
|
||||
AddEventHandler('runcode:gotSnippet', function(id, lang, code)
|
||||
RegisterNetEvent('runcode:gotSnippet', function(id, lang, code)
|
||||
local res, err = RunCode(lang, code)
|
||||
|
||||
if not err then
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
local openData
|
||||
|
||||
RegisterNetEvent('runcode:openUi')
|
||||
|
||||
AddEventHandler('runcode:openUi', function(options)
|
||||
RegisterNetEvent('runcode:openUi', function(options)
|
||||
openData = {
|
||||
type = 'open',
|
||||
options = options,
|
||||
@@ -48,9 +46,7 @@ RegisterNUICallback('runCodeInBand', function(args, cb)
|
||||
TriggerServerEvent('runcode:runInBand', id, args)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('runcode:inBandResult')
|
||||
|
||||
AddEventHandler('runcode:inBandResult', function(id, result)
|
||||
RegisterNetEvent('runcode:inBandResult', function(id, result)
|
||||
if rcCbs[id] then
|
||||
local cb = rcCbs[id]
|
||||
rcCbs[id] = nil
|
||||
|
||||
@@ -50,9 +50,7 @@ local function handleRunCode(data, res)
|
||||
end
|
||||
end
|
||||
|
||||
RegisterNetEvent('runcode:runInBand')
|
||||
|
||||
AddEventHandler('runcode:runInBand', function(id, data)
|
||||
RegisterNetEvent('runcode:runInBand', function(id, data)
|
||||
local s = source
|
||||
local privs = GetPrivs(s)
|
||||
|
||||
@@ -146,7 +144,7 @@ CreateThread(function()
|
||||
while true do
|
||||
Wait(100)
|
||||
|
||||
for k, v in ipairs(codes) do
|
||||
for k, v in pairs(codes) do
|
||||
if GetGameTimer() > v.timeout then
|
||||
source = nil
|
||||
returnCode(k, '', 'Timed out waiting on the target client.')
|
||||
@@ -155,8 +153,7 @@ CreateThread(function()
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('runcode:gotResult')
|
||||
AddEventHandler('runcode:gotResult', returnCode)
|
||||
RegisterNetEvent('runcode:gotResult', returnCode)
|
||||
|
||||
SetHttpHandler(function(req, res)
|
||||
local path = req.path
|
||||
|
||||
@@ -28,6 +28,7 @@ var count = 0;
|
||||
var thisCount = 0;
|
||||
|
||||
const emoji = {
|
||||
INIT_CORE: [ '🍇' ],
|
||||
INIT_BEFORE_MAP_LOADED: [ '🍉' ],
|
||||
INIT_AFTER_MAP_LOADED: [ '🍋', '🍊' ],
|
||||
INIT_SESSION: [ '🍐', '🍅', '🍆' ],
|
||||
@@ -38,7 +39,7 @@ const handlers = {
|
||||
{
|
||||
count = data.count;
|
||||
|
||||
document.querySelector('.letni h3').innerHTML += emoji[data.type][data.order - 1] || '';
|
||||
document.querySelector('.letni h3').innerHTML += (emoji[data.type] || [])[data.order - 1] || '';
|
||||
},
|
||||
|
||||
initFunctionInvoking(data)
|
||||
|
||||
Reference in New Issue
Block a user