diff --git a/esx_kashacters/client/main.lua b/esx_kashacters/client/main.lua index d8740535..54521b33 100644 --- a/esx_kashacters/client/main.lua +++ b/esx_kashacters/client/main.lua @@ -6,17 +6,20 @@ Citizen.CreateThread(function() end end) -Citizen.CreateThread(function() - while true do - Citizen.Wait(0) - if NetworkIsSessionStarted() then - Citizen.Wait(100) - TriggerServerEvent("kashactersS:SetupCharacters") - TriggerEvent("kashactersC:SetupCharacters") - return - end - 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) +-- if NetworkIsSessionStarted() then +-- Citizen.Wait(100) +-- TriggerServerEvent("kashactersS:SetupCharacters") +-- TriggerEvent("kashactersC:SetupCharacters") +-- return -- break the loop +-- end +-- end +--end) local IsChoosing = true Citizen.CreateThread(function () @@ -56,48 +59,56 @@ AddEventHandler('kashactersC:SetupUI', function(Characters) end) RegisterNetEvent('kashactersC:SpawnCharacter') -AddEventHandler('kashactersC:SpawnCharacter', function(spawn, isnew) - - SetTimecycleModifier('default') - - local pos = spawn - - SetEntityCoords(GetPlayerPed(-1), pos.x, pos.y, pos.z) - DoScreenFadeIn(500) - - Citizen.Wait(500) - - cam2 = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -1355.93,-1487.78,520.75, 300.00,0.00,0.00, 100.00, false, 0) - PointCamAtCoord(cam2, pos.x,pos.y,pos.z+200) - SetCamActiveWithInterp(cam2, cam, 900, true, true) - - Citizen.Wait(900) - - 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) - - Citizen.Wait(3700) - - PlaySoundFrontend(-1, "Zoom_Out", "DLC_HEIST_PLANNING_BOARD_SOUNDS", 1) - RenderScriptCams(false, true, 500, true, true) - PlaySoundFrontend(-1, "CAR_BIKE_WHOOSH", "MP_LOBBY_SOUNDS", 1) - FreezeEntityPosition(GetPlayerPed(-1), false) - - Citizen.Wait(500) - - SetCamActive(cam, false) - DestroyCam(cam, true) - IsChoosing = false - DisplayHud(true) - DisplayRadar(true) - - TriggerEvent('esx:kashloaded') - +AddEventHandler('kashactersC:SpawnCharacter', function(isnew) if isnew == true then - TriggerEvent('esx_identity:showRegisterIdentity') - end + SetTimecycleModifier('default') + + local pos = { x = -1044.73, y = -2749.13, z = 21.3634 } -- DEFAULT SPAWN POSITION + RequestCollisionAtCoord(pos.x, pos.y, pos.z) + SetEntityCoords(GetPlayerPed(-1), pos.x, pos.y, pos.z) + DoScreenFadeIn(500) + Citizen.Wait(500) + + cam2 = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -1355.93,-1487.78,520.75, 300.00,0.00,0.00, 100.00, false, 0) + PointCamAtCoord(cam2, pos.x,pos.y,pos.z+200) + SetCamActiveWithInterp(cam2, cam, 900, true, true) + + Citizen.Wait(900) + 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) + + Citizen.Wait(3700) + + PlaySoundFrontend(-1, "Zoom_Out", "DLC_HEIST_PLANNING_BOARD_SOUNDS", 1) + RenderScriptCams(false, true, 500, true, true) + PlaySoundFrontend(-1, "CAR_BIKE_WHOOSH", "MP_LOBBY_SOUNDS", 1) + FreezeEntityPosition(GetPlayerPed(-1), false) + Citizen.Wait(500) + SetPlayerInvincible(GetPlayerPed(-1), false); + SetEntityCollision(GetPlayerPed(-1), true, true) + SetCamActive(cam, false) + DestroyCam(cam, true) + IsChoosing = false + + SetEntityVisible(GetPlayerPed(-1), true, false) + + TriggerEvent('esx:kashloaded') + TriggerEvent('esx_identity:showRegisterIdentity') + else + SetTimecycleModifier('default') + DoScreenFadeIn(500) + Citizen.Wait(500) + RenderScriptCams(false, true, 500, true, true) + SetCamActive(cam, false) + DestroyCam(cam, true) + IsChoosing = false + DisplayHud(true) + DisplayRadar(true) + TriggerEvent('esx:kashloaded') + TriggerEvent("madrp-spawn") + end end) RegisterNetEvent('kashactersC:ReloadCharacters') diff --git a/esx_kashacters/html/css/main.css b/esx_kashacters/html/css/main.css index caf796c7..1093ac5a 100644 --- a/esx_kashacters/html/css/main.css +++ b/esx_kashacters/html/css/main.css @@ -48,7 +48,7 @@ p { .btn-play { background: #43A047; color: #FFFFFF; - float:left; + margin-right: 10px; } @@ -59,7 +59,6 @@ p { .btn-delete { background: #930b0b; color: #FFFFFF; - float:left; } .btn-delete:hover { diff --git a/esx_kashacters/html/js/app.js b/esx_kashacters/html/js/app.js index ef552424..841b5fad 100644 --- a/esx_kashacters/html/js/app.js +++ b/esx_kashacters/html/js/app.js @@ -24,7 +24,7 @@ $(".character-box").click(function () { }); $("#play-char").click(function () { - $.post("http://esx_kashacter/CharacterChosen", JSON.stringify({ + $.post("http://esx_kashacters/CharacterChosen", JSON.stringify({ charid: $('.active-char').attr("data-charid"), ischar: $('.active-char').attr("data-ischar"), })); @@ -32,7 +32,7 @@ $("#play-char").click(function () { }); $("#deletechar").click(function () { - $.post("http://esx_kashacter/DeleteCharacter", JSON.stringify({ + $.post("http://esx_kashacters/DeleteCharacter", JSON.stringify({ charid: $('.active-char').attr("data-charid"), })); Kashacter.CloseUI(); @@ -47,7 +47,7 @@ $("#deletechar").click(function () { $.each(data.characters, function (index, char) { if (char.charid !== 0) { var charid = char.identifier.charAt(4); - $('[data-charid=' + charid + ']').html('

'+ char.firstname +' '+ char.lastname +'

' + `${translate.job}: ` + ''+ char.job +' '+ char.job_grade +'

' + `${translate.money}: ` + ''+ char.money +'

' + `${translate.bank}: ` + ''+ char.bank +'

' + `${translate.dob}: ` + ''+ char.dateofbirth +'

' + `${translate.gender}: ` + ''+ char.sex +'

').attr("data-ischar", "true"); + $('[data-charid=' + charid + ']').html('

'+ char.firstname +' '+ char.lastname +'

Work: '+ char.job +' '+ char.job_grade +'

Cash: '+ char.money +'

Bank: '+ char.bank +'

Date of birth: '+ char.dateofbirth +'

Gender: '+ char.sex +'

').attr("data-ischar", "true"); } }); } @@ -57,7 +57,7 @@ $("#deletechar").click(function () { $('.main-container').css({"display":"none"}); $(".character-box").removeClass('active-char'); $("#delete").css({"display":"none"}); - $(".character-box").html('

' + `${translate.new}` + '

').attr("data-ischar", "false"); + $(".character-box").html('

Create new character

').attr("data-ischar", "false"); }; window.onload = function(e) { window.addEventListener('message', function(event) { @@ -69,4 +69,4 @@ $("#deletechar").click(function () { }) } -})(); +})(); \ No newline at end of file diff --git a/esx_kashacters/html/ui.html b/esx_kashacters/html/ui.html index 2c631072..d8c481d5 100644 --- a/esx_kashacters/html/ui.html +++ b/esx_kashacters/html/ui.html @@ -7,44 +7,58 @@ - -
+
+
-

+

Empty Slot

-

+

Create new character

-

+

Empty Slot

Create new character

-

+

Empty Slot

Create new character

-

+

Empty Slot

+
+

Create new character

+
+
+
+

Empty Slot

+
+

Create new character

+
+
+
+

Empty Slot

Create new character

-
+
+
+
+
-
- +