This version is using NativeUI_Reloaded
SQL
Run this command at your database
ALTER TABLE `users` ADD COLUMN IF NOT EXISTS `deaths` TINYINT NULL DEFAULT 0;
myMultichar Edits
Go to client.lua
and search for this:
if char.isDead == 1 then
character_sub = NativeUI.CreateItem('~c~' .. char.firstname .. ' ' .. char.lastname, '~b~')
mainMenu:AddItem(character_sub)
character_sub:SetRightBadge(BadgeStyle.Lock)
else
character_sub = _menuPool:AddSubMenu(mainMenu, char.firstname .. ' ' .. char.lastname, '~b~')
end
Then replace it with this:
if char.isDead == 1 then
character_sub = NativeUI.CreateItem('~c~' .. char.firstname .. ' ' .. char.lastname, '~r~Max Deaths reached. Please contact support') -- Maximale Tode erreicht, bitte im Support melden
mainMenu:AddItem(character_sub)
character_sub:SetRightBadge(BadgeStyle.Lock)
else
character_sub = _menuPool:AddSubMenu(mainMenu, char.firstname .. ' ' .. char.lastname, '~g~Your Character died ' .. char.deaths .. ' times') -- Dein Charakter ist bereits ' .. char.deaths .. ' mal gestorben
end
function RemoveItemsAfterRPDeath()
RespawnPed(PlayerPedId(), RespawnCoords, ClosestHospital.heading)
RespawnPed(PlayerPedId(), RespawnCoords, ClosestHospital.heading, true)
function RespawnPed(ped, coords, heading)
function RespawnPed(ped, coords, heading, isDied)
SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false)
NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, heading, true, false)
SetPlayerInvincible(ped, false)
ClearPedBloodDamage(ped)
TriggerServerEvent('esx:onPlayerSpawn')
TriggerEvent('esx:onPlayerSpawn')
TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon
if isDied then
TriggerServerEvent('msk_deathcounter:countDeaths')
end
end