mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 17:28:53 +00:00
Merge pull request #1116 from MiddleSkillz/legacy
Change Spawning to Be Handled By Spawn Manager
This commit is contained in:
+17
-24
@@ -10,38 +10,24 @@ end)
|
||||
|
||||
|
||||
RegisterNetEvent('esx:playerLoaded')
|
||||
AddEventHandler('esx:playerLoaded', function(playerData)
|
||||
AddEventHandler('esx:playerLoaded', function(playerData, isNew)
|
||||
ESX.PlayerLoaded = true
|
||||
ESX.PlayerData = playerData
|
||||
|
||||
|
||||
if GetEntityModel(PlayerPedId()) == GetHashKey('PLAYER_ZERO') then
|
||||
local defaultModel = GetHashKey('a_m_y_stbla_02')
|
||||
RequestModel(defaultModel)
|
||||
|
||||
while not HasModelLoaded(defaultModel) do
|
||||
Citizen.Wait(10)
|
||||
end
|
||||
|
||||
SetPlayerModel(PlayerId(), defaultModel)
|
||||
SetPedDefaultComponentVariation(PlayerPedId())
|
||||
SetPedRandomComponentVariation(PlayerPedId(), true)
|
||||
SetModelAsNoLongerNeeded(defaultModel)
|
||||
end
|
||||
|
||||
|
||||
FreezeEntityPosition(PlayerPedId(), true)
|
||||
|
||||
|
||||
-- enable PVP
|
||||
if Config.EnablePVP then
|
||||
SetCanAttackFriendly(PlayerPedId(), true, false)
|
||||
NetworkSetFriendlyFireOption(true)
|
||||
end
|
||||
end
|
||||
|
||||
-- disable wanted level
|
||||
if not Config.EnableWantedLevel then
|
||||
ClearPlayerWantedLevel(PlayerId())
|
||||
SetMaxWantedLevel(0)
|
||||
end
|
||||
if not Config.EnableWantedLevel then
|
||||
ClearPlayerWantedLevel(PlayerId())
|
||||
SetMaxWantedLevel(0)
|
||||
end
|
||||
|
||||
if Config.EnableHud then
|
||||
for k,v in ipairs(playerData.accounts) do
|
||||
@@ -61,11 +47,13 @@ end
|
||||
})
|
||||
end
|
||||
|
||||
ESX.Game.Teleport(PlayerPedId(), {
|
||||
exports.spawnmanager:spawnPlayer({
|
||||
x = playerData.coords.x,
|
||||
y = playerData.coords.y,
|
||||
z = playerData.coords.z + 0.25,
|
||||
heading = playerData.coords.heading
|
||||
heading = playerData.coords.heading,
|
||||
model = `mp_m_freemode_01`,
|
||||
skipFade = false
|
||||
}, function()
|
||||
TriggerServerEvent('esx:onPlayerSpawn')
|
||||
TriggerEvent('esx:onPlayerSpawn')
|
||||
@@ -78,6 +66,11 @@ end
|
||||
FreezeEntityPosition(PlayerPedId(), false)
|
||||
DoScreenFadeIn(10000)
|
||||
StartServerSyncLoops()
|
||||
if isNew then
|
||||
-- Put your code for if you want to do something with new players.
|
||||
else
|
||||
-- If they aren't new put that code here.
|
||||
end
|
||||
end)
|
||||
|
||||
TriggerEvent('esx:loadingScreenOff')
|
||||
|
||||
+4
-4
@@ -12,9 +12,9 @@ Config.StartingAccountMoney = {bank = 50000}
|
||||
Config.EnableSocietyPayouts = false -- pay from the society account that the player is employed at? Requirement: esx_society
|
||||
Config.EnableHud = true -- enable the default hud? Display current job and accounts (black, bank & cash)
|
||||
Config.MaxWeight = 24 -- the max inventory weight without backpack
|
||||
Config.PaycheckInterval = 7 * 60000 -- how often to recieve pay checks in milliseconds
|
||||
Config.EnableDebug = false -- Use Debug options?
|
||||
Config.EnableDefaultInventory = true -- Display the default Inventory ( F2 )
|
||||
Config.PaycheckInterval = 7 * 60000 -- how often to recieve pay checks in milliseconds
|
||||
Config.EnableDebug = false -- Use Debug options?
|
||||
Config.EnableDefaultInventory = true -- Display the default Inventory ( F2 )
|
||||
Config.EnableWantedLevel = false -- Use Normal GTA wanted Level?
|
||||
Config.EnablePVP = true -- Allow Player to player combat
|
||||
Config.EnablePVP = true -- Allow Player to player combat
|
||||
|
||||
|
||||
+4
-4
@@ -29,7 +29,7 @@ function onPlayerJoined(playerId)
|
||||
['@identifier'] = identifier
|
||||
}, function(result)
|
||||
if result then
|
||||
loadESXPlayer(identifier, playerId)
|
||||
loadESXPlayer(identifier, playerId, false)
|
||||
else
|
||||
local accounts = {}
|
||||
|
||||
@@ -49,7 +49,7 @@ function onPlayerJoined(playerId)
|
||||
['@identifier'] = identifier,
|
||||
['@group'] = defaultGroup
|
||||
}, function(rowsChanged)
|
||||
loadESXPlayer(identifier, playerId)
|
||||
loadESXPlayer(identifier, playerId, true)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
@@ -83,7 +83,7 @@ AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
|
||||
end
|
||||
end)
|
||||
|
||||
function loadESXPlayer(identifier, playerId)
|
||||
function loadESXPlayer(identifier, playerId, isNew)
|
||||
local tasks = {}
|
||||
|
||||
local userData = {
|
||||
@@ -235,7 +235,7 @@ function loadESXPlayer(identifier, playerId)
|
||||
loadout = xPlayer.getLoadout(),
|
||||
maxWeight = xPlayer.getMaxWeight(),
|
||||
money = xPlayer.getMoney()
|
||||
})
|
||||
}, isNew)
|
||||
|
||||
xPlayer.triggerEvent('esx:createMissingPickups', ESX.Pickups)
|
||||
xPlayer.triggerEvent('esx:registerSuggestions', ESX.RegisteredCommands)
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "legacy",
|
||||
"commit" : "1.1.7",
|
||||
"changelog": "Performance Improvements; Config Updates; Bug Fixes"
|
||||
"commit" : "1.1.8",
|
||||
"changelog": "Code Improvements; Redundant Code Removal"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user