Support for the new version of ESX, again...

This commit is contained in:
RikoDEV
2020-03-25 10:11:16 +01:00
parent eef971c08b
commit 71a7f8bf54
3 changed files with 90 additions and 20 deletions
+2 -8
View File
@@ -6,9 +6,6 @@ Citizen.CreateThread(function()
end
end)
-- This Code Was changed to fix error With player spawner as default --
-- Link to the post with the error fix --
-- https://forum.fivem.net/t/release-esx-kashacters-multi-character/251613/316?u=xxfri3ndlyxx --
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
@@ -16,7 +13,7 @@ Citizen.CreateThread(function()
Citizen.Wait(100)
TriggerServerEvent("kashactersS:SetupCharacters")
TriggerEvent("kashactersC:SetupCharacters")
return -- break the loop
return
end
end
end)
@@ -32,8 +29,7 @@ Citizen.CreateThread(function ()
end
end)
local cam = nil
local cam2 = nil
local cam, cam2 = nil, nil
RegisterNetEvent('kashactersC:SetupCharacters')
AddEventHandler('kashactersC:SetupCharacters', function()
@@ -77,8 +73,6 @@ AddEventHandler('kashactersC:SpawnCharacter', function(spawn, isnew)
Citizen.Wait(900)
exports.spawnmanager:setAutoSpawn(false)
cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", pos.x,pos.y,pos.z+200, 300.00,0.00,0.00, 100.00, false, 0)
PointCamAtCoord(cam, pos.x,pos.y,pos.z+2)
SetCamActiveWithInterp(cam, cam2, 3700, true, true)
+64
View File
@@ -0,0 +1,64 @@
# Podziękowania dla KASH oraz XxFri3ndlyxX.
### If you are updating ESX, be sure to update the remaining scripts!
## Required changes:
* es_extended: (`es_extended/client/main.lua`)
### Zamień podany kod:
```lua
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if NetworkIsPlayerActive(PlayerId()) then
TriggerServerEvent('esx:onPlayerJoined')
break
end
end
end)
```
### na:
```lua
RegisterNetEvent('esx:kashloaded')
AddEventHandler('esx:kashloaded', function()
TriggerServerEvent('esx:onPlayerJoined')
end)
```
* es_extended: (`es_extended/server/main.lua`)
### Zamień podany kod:
```lua
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = string.sub(v, 9)
break
end
end
```
### na:
```lua
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = v
break
end
end
```
# Przeczytaj uważnie...
> **Musisz** zwiększyć limit znaków w tabeli `users`dla kolumny `identifier` do **48**.
> **Nie** używaj essentialsmode, mapmanager oraz spawnmanager.
> **Uwaga!** Musisz nazwać skrypt 'esx_kashacters', aby wszystko działało poprawnie.
## Jak to działa?
> Ten skrypt manipuluje ładowaniem postaci przez ESX.
Kiedy więc wybierasz swoją postać, skrypt zmienia twoją **licencje rockstar**, która jest normalnie zapisywana jako **license:** na **Char:**, co zapobiega ładowaniu przez ESX innej postaci, ponieważ szuka on dokładnej licencji.
+24 -12
View File
@@ -1,14 +1,34 @@
# Thanks to KASH and XxFri3ndlyxX
### If you are updating ESX, be sure to update the remaining scripts!
Instrukcja w języku Polskim znajduje się [tutaj](https://github.com/fivem-ex/esx_kashacter/blob/master/readme-pl.md).
## Required changes:
* es_extended: (`es_extended/client/main.lua`)
Replace `AddEventHandler('playerSpawned', function()` (35) with:
### Replace this code:
```lua
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if NetworkIsPlayerActive(PlayerId()) then
TriggerServerEvent('esx:onPlayerJoined')
break
end
end
end)
```
### with:
```lua
RegisterNetEvent('esx:kashloaded')
AddEventHandler('esx:kashloaded', function()
TriggerServerEvent('esx:onPlayerJoined')
end)
```
* es_extended: (`es_extended/server/main.lua`)
@@ -36,19 +56,11 @@ AddEventHandler('esx:kashloaded', function()
end
```
## Using kashacters without esx_ambulancejob (respawn fix)
> Remove `exports.spawnmanager:setAutoSpawn(false)` from `client/main.lua`.
# WARNING!
# Read carefully...
> You **MUST** incerase the character limit in the `users` table for row `identifier` to **48**.
> *Pay ATTENTION: You have to call the resource 'esx_kashacters' in order for the javascript to work!!!**
> Do **not** use essentialsmode, mapmanager and spawnmanager!
> *Pay ATTENTION: You have to call the resource 'esx_kashacters' in order for the javascript to work!**
## How it works
> What this script does it manipulates ESX for loading characters
So when you are choosing your character it changes your **Rockstar license** which is normally **license:** to **Char:** this prevents ESX from loading another character because it is looking for you exact license. So when you choose your character it will change it from Char: to your normal Rockstar license (license:). When creating a new character it will spawn you without an exact license which creates a new database entry for your license.
## Credits
> ESX Framework and **KASH** AND **Onno204** for creating the resource. You can do whatever the f with it what you want but it is nice to give the main man credits ;)