Added Some More Stuff

This commit is contained in:
MiddleSkillz
2021-05-05 01:18:20 -06:00
parent 77f34b0176
commit 8f91023bd9
3 changed files with 26 additions and 32 deletions
+17 -24
View File
@@ -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 = Config.DefaultPlayerModel,
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')
+5 -4
View File
@@ -12,9 +12,10 @@ 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
Config.DefaultPlayerModel = `mp_m_freemode_01` -- Don't Change this there is absolutely no need
+4 -4
View File
@@ -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)