mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2026-11-10 13:57:18 +01:00
Misc fixes (#233)
* fix(spawnmanager): correct native arguments and enable ped model check Signed-off-by: Mathu-lmn <[email protected]> * fix(mapmanager): restrict the gametype command Signed-off-by: Mathu-lmn <[email protected]> * fix(example-loadscreen): handle unknown init types such as INIT_CORE Signed-off-by: Mathu-lmn <[email protected]> --------- Signed-off-by: Mathu-lmn <[email protected]>
This commit is contained in:
@@ -264,7 +264,7 @@ RegisterCommand("gametype", function(source, args)
|
|||||||
end
|
end
|
||||||
changeGameType(args[1])
|
changeGameType(args[1])
|
||||||
print('gametype ' .. args[1] .. "\n")
|
print('gametype ' .. args[1] .. "\n")
|
||||||
end)
|
end, true)
|
||||||
|
|
||||||
function getCurrentGameType()
|
function getCurrentGameType()
|
||||||
return currentGameType
|
return currentGameType
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ AddEventHandler('getMapDirectives', function(add)
|
|||||||
|
|
||||||
-- recalculate the model for storage
|
-- recalculate the model for storage
|
||||||
if not tonumber(model) then
|
if not tonumber(model) then
|
||||||
model = GetHashKey(model, _r)
|
model = GetHashKey(model)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- store the spawn data in the state so we can erase it later on
|
-- 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")
|
error("invalid spawn model")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- is is even a ped?
|
-- is the model a ped?
|
||||||
-- not in V?
|
if not IsModelAPed(model) then
|
||||||
--[[if not IsThisModelAPed(model) then
|
|
||||||
error("this model ain't a ped!")
|
error("this model ain't a ped!")
|
||||||
end]]
|
end
|
||||||
|
|
||||||
-- overwrite the model in case we hashed it
|
-- overwrite the model in case we hashed it
|
||||||
spawn.model = model
|
spawn.model = model
|
||||||
@@ -153,17 +152,17 @@ end
|
|||||||
-- function as existing in original R* scripts
|
-- function as existing in original R* scripts
|
||||||
local function freezePlayer(id, freeze)
|
local function freezePlayer(id, freeze)
|
||||||
local player = id
|
local player = id
|
||||||
SetPlayerControl(player, not freeze, false)
|
SetPlayerControl(player, not freeze, 0)
|
||||||
|
|
||||||
local ped = GetPlayerPed(player)
|
local ped = GetPlayerPed(player)
|
||||||
|
|
||||||
if not freeze then
|
if not freeze then
|
||||||
if not IsEntityVisible(ped) then
|
if not IsEntityVisible(ped) then
|
||||||
SetEntityVisible(ped, true)
|
SetEntityVisible(ped, true, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not IsPedInAnyVehicle(ped) then
|
if not IsPedInAnyVehicle(ped, false) then
|
||||||
SetEntityCollision(ped, true)
|
SetEntityCollision(ped, true, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
FreezeEntityPosition(ped, false)
|
FreezeEntityPosition(ped, false)
|
||||||
@@ -171,14 +170,13 @@ local function freezePlayer(id, freeze)
|
|||||||
SetPlayerInvincible(player, false)
|
SetPlayerInvincible(player, false)
|
||||||
else
|
else
|
||||||
if IsEntityVisible(ped) then
|
if IsEntityVisible(ped) then
|
||||||
SetEntityVisible(ped, false)
|
SetEntityVisible(ped, false, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
SetEntityCollision(ped, false)
|
SetEntityCollision(ped, false, false)
|
||||||
FreezeEntityPosition(ped, true)
|
FreezeEntityPosition(ped, true)
|
||||||
--SetCharNeverTargetted(ped, true)
|
--SetCharNeverTargetted(ped, true)
|
||||||
SetPlayerInvincible(player, true)
|
SetPlayerInvincible(player, true)
|
||||||
--RemovePtfxFromPed(ped)
|
|
||||||
|
|
||||||
if not IsPedFatallyInjured(ped) then
|
if not IsPedFatallyInjured(ped) then
|
||||||
ClearPedTasksImmediately(ped)
|
ClearPedTasksImmediately(ped)
|
||||||
@@ -193,11 +191,7 @@ function loadScene(x, y, z)
|
|||||||
|
|
||||||
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)
|
||||||
|
|
||||||
while IsNewLoadSceneActive() do
|
while IsNewLoadSceneActive() do NetworkUpdateLoadScene() end
|
||||||
networkTimer = GetNetworkTimer()
|
|
||||||
|
|
||||||
NetworkUpdateLoadScene()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- to prevent trying to spawn multiple times
|
-- to prevent trying to spawn multiple times
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var count = 0;
|
|||||||
var thisCount = 0;
|
var thisCount = 0;
|
||||||
|
|
||||||
const emoji = {
|
const emoji = {
|
||||||
|
INIT_CORE: [ '🍇' ],
|
||||||
INIT_BEFORE_MAP_LOADED: [ '🍉' ],
|
INIT_BEFORE_MAP_LOADED: [ '🍉' ],
|
||||||
INIT_AFTER_MAP_LOADED: [ '🍋', '🍊' ],
|
INIT_AFTER_MAP_LOADED: [ '🍋', '🍊' ],
|
||||||
INIT_SESSION: [ '🍐', '🍅', '🍆' ],
|
INIT_SESSION: [ '🍐', '🍅', '🍆' ],
|
||||||
@@ -38,7 +39,7 @@ const handlers = {
|
|||||||
{
|
{
|
||||||
count = data.count;
|
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)
|
initFunctionInvoking(data)
|
||||||
|
|||||||
Reference in New Issue
Block a user