Installation

CFX Forum Post: https://forum.cfx.re/t/esx-msk-deathcounter-integrated-in-mymultichar/4863428

Installation

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

ESX Ambulancejob

If you set Config.countDeath = false then do the following:

Go to esx_ambulancejob/client/main.lua and search for

function RemoveItemsAfterRPDeath()

In this function search for

RespawnPed(PlayerPedId(), RespawnCoords, ClosestHospital.heading)

and replace it with

RespawnPed(PlayerPedId(), RespawnCoords, ClosestHospital.heading, true)

Below that you will find this function:

function RespawnPed(ped, coords, heading)

Replace it with this:

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

Now restart your server and have fun :)

Last updated