mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-01 10:48:52 +00:00
Kashacter
This commit is contained in:
+52
-25
@@ -1,7 +1,7 @@
|
||||
local isPaused, isDead, pickups = false, false, {}
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
while not Config.UseKashacters do
|
||||
Citizen.Wait(0)
|
||||
|
||||
if NetworkIsPlayerActive(PlayerId()) then
|
||||
@@ -12,11 +12,19 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end)
|
||||
|
||||
if Config.UseKashacters then
|
||||
RegisterNetEvent('esx:kashloaded')
|
||||
AddEventHandler('esx:kashloaded', function()
|
||||
TriggerServerEvent('esx:onPlayerJoined')
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterNetEvent('esx:playerLoaded')
|
||||
AddEventHandler('esx:playerLoaded', function(playerData)
|
||||
ESX.PlayerLoaded = true
|
||||
ESX.PlayerData = playerData
|
||||
|
||||
if Config.UseKashacters then
|
||||
-- check if player is coming from loading screen
|
||||
if GetEntityModel(PlayerPedId()) == GetHashKey('PLAYER_ZERO') then
|
||||
local defaultModel = GetHashKey('a_m_y_stbla_02')
|
||||
@@ -30,6 +38,7 @@ AddEventHandler('esx:playerLoaded', function(playerData)
|
||||
SetPedDefaultComponentVariation(PlayerPedId())
|
||||
SetPedRandomComponentVariation(PlayerPedId(), true)
|
||||
SetModelAsNoLongerNeeded(defaultModel)
|
||||
end
|
||||
end
|
||||
|
||||
-- freeze the player
|
||||
@@ -63,24 +72,46 @@ end
|
||||
})
|
||||
end
|
||||
|
||||
ESX.Game.Teleport(PlayerPedId(), {
|
||||
x = playerData.coords.x,
|
||||
y = playerData.coords.y,
|
||||
z = playerData.coords.z + 0.25,
|
||||
heading = playerData.coords.heading
|
||||
}, function()
|
||||
TriggerServerEvent('esx:onPlayerSpawn')
|
||||
TriggerEvent('esx:onPlayerSpawn')
|
||||
TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon
|
||||
TriggerEvent('esx:restoreLoadout')
|
||||
if Config.UseKashacters then
|
||||
--[[
|
||||
ESX.Game.Teleport(PlayerPedId(), {
|
||||
x = playerData.coords.x,
|
||||
y = playerData.coords.y,
|
||||
z = playerData.coords.z + 0.25,
|
||||
heading = playerData.coords.heading
|
||||
}, function()
|
||||
end)
|
||||
]]--
|
||||
TriggerServerEvent('esx:onPlayerSpawn')
|
||||
TriggerEvent('esx:onPlayerSpawn')
|
||||
TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon
|
||||
TriggerEvent('esx:restoreLoadout')
|
||||
|
||||
Citizen.Wait(4000)
|
||||
ShutdownLoadingScreen()
|
||||
ShutdownLoadingScreenNui()
|
||||
FreezeEntityPosition(PlayerPedId(), false)
|
||||
DoScreenFadeIn(10000)
|
||||
StartServerSyncLoops()
|
||||
Citizen.Wait(0)
|
||||
ShutdownLoadingScreen()
|
||||
FreezeEntityPosition(PlayerPedId(), false)
|
||||
DoScreenFadeIn(0)
|
||||
StartServerSyncLoops()
|
||||
else
|
||||
ESX.Game.Teleport(PlayerPedId(), {
|
||||
x = playerData.coords.x,
|
||||
y = playerData.coords.y,
|
||||
z = playerData.coords.z + 0.25,
|
||||
heading = playerData.coords.heading
|
||||
}, function()
|
||||
TriggerServerEvent('esx:onPlayerSpawn')
|
||||
TriggerEvent('esx:onPlayerSpawn')
|
||||
TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon
|
||||
TriggerEvent('esx:restoreLoadout')
|
||||
|
||||
Citizen.Wait(4000)
|
||||
ShutdownLoadingScreen()
|
||||
ShutdownLoadingScreenNui()
|
||||
FreezeEntityPosition(PlayerPedId(), false)
|
||||
DoScreenFadeIn(10000)
|
||||
StartServerSyncLoops()
|
||||
end)
|
||||
end
|
||||
|
||||
TriggerEvent('esx:loadingScreenOff')
|
||||
end)
|
||||
@@ -179,11 +210,6 @@ AddEventHandler('esx:removeInventoryItem', function(item, count, showNotificatio
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:setJob')
|
||||
AddEventHandler('esx:setJob', function(job)
|
||||
ESX.PlayerData.job = job
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:addWeapon')
|
||||
AddEventHandler('esx:addWeapon', function(weaponName, ammo)
|
||||
local playerPed = PlayerPedId()
|
||||
@@ -248,13 +274,14 @@ AddEventHandler('esx:teleport', function(coords)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:setJob')
|
||||
AddEventHandler('esx:setJob', function(job)
|
||||
AddEventHandler('esx:setJob', function(Job)
|
||||
if Config.EnableHud then
|
||||
ESX.UI.HUD.UpdateElement('job', {
|
||||
job_label = job.label,
|
||||
grade_label = job.grade_label
|
||||
job_label = Job.label,
|
||||
grade_label = Job.grade_label
|
||||
})
|
||||
end
|
||||
ESX.SetPlayerData(job, Job)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:spawnVehicle')
|
||||
|
||||
@@ -18,4 +18,5 @@ Config.EnableDefaultInventory = true -- Display the default Inventory ( F2 )
|
||||
Config.EnableWantedLevel = false -- Use Normal GTA wanted Level?
|
||||
Config.DisableSuperadmin = true -- Disable the use of superadmin
|
||||
Config.UseMulticharacter = false -- WIP, ADDS multicharacter features
|
||||
Config.UseKashacters = true
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ CREATE DATABASE IF NOT EXISTS `es_extended`;
|
||||
USE `es_extended`;
|
||||
|
||||
CREATE TABLE `users` (
|
||||
`identifier` VARCHAR(40) NOT NULL,
|
||||
`identifier` VARCHAR(64) NOT NULL,
|
||||
`accounts` LONGTEXT NULL DEFAULT NULL,
|
||||
`group` VARCHAR(50) NULL DEFAULT 'user',
|
||||
`inventory` LONGTEXT NULL DEFAULT NULL,
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ MySQL.ready(function()
|
||||
end)
|
||||
end)
|
||||
|
||||
print('[es_extended] [^2INFO^7] ESX developed by ESX-Org has been initialized')
|
||||
print('[es_extended] [^2INFO^7] ESX Legacy developed by The ESX-Framework Team has been initialized')
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx:clientLog')
|
||||
|
||||
+18
-7
@@ -24,8 +24,13 @@ function onPlayerJoined(playerId)
|
||||
else
|
||||
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
|
||||
if string.match(v, 'license:') then
|
||||
if Config.UseKashacters then
|
||||
identifier = v
|
||||
break
|
||||
else
|
||||
identifier = string.sub(v, 9)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -79,11 +84,17 @@ AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
|
||||
else
|
||||
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
|
||||
if string.match(v, 'license:') then
|
||||
if Config.UseKashacters then
|
||||
identifier = v
|
||||
break
|
||||
else
|
||||
identifier = string.sub(v, 9)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if identifier then
|
||||
if ESX.GetPlayerFromIdentifier(identifier) then
|
||||
deferrals.done(('There was an error loading your character!\nError code: identifier-active\n\nThis error is caused by a player on this server who has the same identifier as you have. Make sure you are not playing on the same Rockstar account.\n\nYour Rockstar identifier: %s'):format(identifier))
|
||||
@@ -538,7 +549,7 @@ Citizen.CreateThread(
|
||||
print(
|
||||
([[
|
||||
|
||||
-------------------------------------------------------
|
||||
^1-------------------------------------------------------
|
||||
URGENT: YOUR ES-EXTENDED IS OUTDATATED!!!
|
||||
COMMIT UPDATE: %s AVAILABLE
|
||||
CHANGELOG: %s
|
||||
@@ -552,12 +563,12 @@ CHANGELOG: %s
|
||||
print(
|
||||
([[
|
||||
|
||||
-------------------------------------------------------
|
||||
Your Es-extended is the latest version!
|
||||
Version: %s
|
||||
COMMIT: %s
|
||||
CHANGELOG: %s
|
||||
-------------------------------------------------------
|
||||
^8-------------------------------------------------------
|
||||
^2Your Es-extended is the latest version!
|
||||
^5Version:^0 %s
|
||||
^5COMMIT:^0 %s
|
||||
^5CHANGELOG:^0 %s
|
||||
^8-------------------------------------------------------
|
||||
]]):format(
|
||||
rv.version
|
||||
rv.commit,
|
||||
|
||||
Reference in New Issue
Block a user