Installation

Steps how to setup our Limited Life(s) script, if the script has any issues and you did the installation correctly please create a modmail on our discord.

Installing Dependencies

Make sure you install the latest versions and follow the documentation of the scripts, the Limited Life(s) script needs to start after all the dependencies start!

Config

Default config file.

Config = {}

Config.Debug = true

Config.AmountOfLives = 5 -- amount of lives a playter has, when they reach 5 their character gets deleted
Config.AdminPerms = 'group.admin' -- Perms needed to execute /addlifes and /checklifes

Add SQL

Add the sql from lifes.sql to your database or just copy this snippet below

CREATE TABLE IF NOT EXISTS `player_lives` (
  `citizenid` varchar(50) NOT NULL DEFAULT 'none',
  `lives_spent` int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (`citizenid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

Event placement

This is where you should put the server side event to remove a life, below is a example to put in qbx_medical. You can choose where to place the event (server side) to remove a life, so it's up to you when you want to remove them, snippet below removes lifes when a player respawns (qbx only).

-- Replace the function
-- qbx_medical/server/main.lua - line 40

---@param player table|number
local function revivePlayer(player)
	if type(player) == 'number' then
		player = exports.qbx_core:GetPlayer(player)
	end

	TriggerEvent('yettiLives:server:removeLife', player.PlayerData.source)
	TriggerClientEvent('qbx_medical:client:playerRevived', player.PlayerData.source)
end

Last updated