Investment AFK

Keep your players connected in order to attract other players.

See the preview of this asset https://www.youtube.com/watch?v=bt9-sdw0LqY

Do you want to buy this script ?

This script is available for QBCore, ESX & Standalone Framework.

Step 1 - Dependencies

Resource name
Available

oxmysql

PolyZone

Step 2 - Extracting the files

Extract the downloaded resource from https://keymaster.fivem.net/ into your resources folder.

Step 3 - Setup the script

Open the afk.lua file from qb-smallresources/client folder and add this code inside the ignoredGroups table.

afk.lua
local ignoredGroups = {
    ['canAFK'] = true, -- Add this line here
    ['mod'] = true,
    ['admin'] = true,
    ['god'] = true
}

Step 4 - Database

Execute this sql request, otherwise it will not work.

CREATE TABLE IF NOT EXISTS `player_investments` (
	`id` int(11) NOT NULL AUTO_INCREMENT,
	`citizenid` varchar(250) DEFAULT NULL,
	`amount` bigint(255) NOT NULL DEFAULT 0,
	`investid` int(11) NOT NULL DEFAULT 0,
	`tickleft` bigint(255) NOT NULL DEFAULT 0,
	`active` int(11) NOT NULL DEFAULT 1,
	`starts_at` timestamp NULL DEFAULT current_timestamp(),
	`ends_at` timestamp NULL DEFAULT NULL,
	PRIMARY KEY (`id`),
	KEY `citizenid` (`citizenid`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;

Step 5 - Running the script

Add ensure tp-investafk to your server's configuration file server.cfg

server.cfg
ensure tp-investafk

If you've followed every single step thoroughly, the script should work perfectly. If is still doesn't work, open a support ticket on our discord.

Last updated