AP Scripts Documentation
  • AP Scripts Documentation
  • Scripts
    • AP Court
    • AP Government
    • AP Documents
    • AP AddonJob
    • AP Questionnaire
  • Recommended Phone
  • Script Snippets
  • Phone Integrations
Powered by GitBook
On this page
  • QBCore INSTALLATION
  • QBCORE DEPENDENCIES
  • STEP BY STEP
  • SQL
  • CONFIGURATION
  • EXPORTS
  • ESX INSTALLATION
  • STEP BY STEP
  • SQL
  • SOCIETY CHANGES
  • EXPORTS
  1. Scripts

AP Government

Documentation & support for AP Government.

PreviousAP CourtNextAP Documents

Last updated 3 months ago

QBCore INSTALLATION

QBCORE DEPENDENCIES

Dependency
Install
Description

Optional if using other target system stated.

For use of using 3rd eye features.

Required

This normally is included in the QBCore install so check if you have before downloading.

Required

This normally is included in the QBCore install so check if you have before downloading.

Required

This normally is included in the QBCore install so check if you have before downloading.

STEP BY STEP

  1. Extract ap-government.zip file.

  2. Inset SQL file into your database.

  3. Setup your config file with how you want it, make sure you enable the target system in the config to the one you use or if you have added another target script in the target.lua make sure the target options are both set to false.

SQL

Please note, there is an SQL file. You will need to import it in order for the script to run. You can open the respective SQL file, copy the queries and execute/run them in your database manually (my personal preferred way) or you can import the file.

Manual SQL Entries
CREATE TABLE IF NOT EXISTS `ap_appointments` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `identifier` varchar(100) DEFAULT NULL,
  `name` tinytext DEFAULT NULL,
  `appData` longtext DEFAULT NULL,
  `type` varchar(60) DEFAULT NULL,
  `state` int(11) DEFAULT 0,
  KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `ap_dlcsettings` (
  `script` varchar(60) DEFAULT 'SCRIPT',
  `settings` longtext DEFAULT '{}',
  `other` longtext DEFAULT '{}',
  `id_storage` longtext DEFAULT '{}'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

INSERT INTO `ap_dlcsettings` (`script`, `settings`, `other`, `id_storage`) VALUES
	('ap_voting', '{"currentType":0,"voteState":0,"funds":10000}', '{"Item":0.7,"Vehicle":0.2,"Business":0.15,"Housing":0.2,"Income":0.15}', '{}');
	
CREATE TABLE IF NOT EXISTS `ap_tax` (
  `business` varchar(60) DEFAULT 'JOB NAME',
  `label` varchar(60) DEFAULT 'JOB LABEL',
  `amount_owed` int(11) DEFAULT 0,
  `total_tax_paid` int(11) DEFAULT 0,
  `owner` varchar(60) DEFAULT 'COMPANY OWNER',
  `base_tax` int(11) DEFAULT NULL,
  `grants` longtext DEFAULT 'nil'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

CREATE TABLE IF NOT EXISTS `ap_voting` (
  `identifier` varchar(100) DEFAULT NULL,
  `name` varchar(70) DEFAULT NULL,
  `age` text DEFAULT NULL,
  `shortDescription` mediumtext DEFAULT NULL,
  `whyDoYouWantToBeACandidate` longtext DEFAULT NULL,
  `WhatYoullBringToTheCity` longtext DEFAULT NULL,
  `denied` longtext DEFAULT 'N/A',
  `votes` int(10) DEFAULT NULL,
  `state` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;lua

CONFIGURATION

CLICK THE TABS TO SEE OPTIONS

This example shows how to add the trigger to qb-core\server\functions.lua for income tax support.

TriggerEvent('ap-government:server:systemTax', Player.PlayerData.source, "Player", payment)

This example shows how to add the export for item tax defined in the config.

exports['ap-government']:chargeCityTax(Player.PlayerData.source, "Item", price, "bank")

EXPORTS

These are available exports in the resource - use them as you please and find necessary.

This export can be used in your scripts that you want to include tax on in which you have added in the config.

exports['ap-government']:chargeCityTax(source, label, amount, type)
-- source; source of the player the tax will be deducted from.
-- label; this is the key of the type of tax you have added in the Config.Tax.MayorControl.
-- amount; this would be the amount of which the item/housing/vehicle cost.
-- type; this is for the type of money to be deducted e.g "cash" or "bank".

This export can be used in your scripts to get the amount of tax in percentage.

local tax = "Item"
exports['ap-government']:TaxAmounts(tax)

This export can be used in your scripts to add funds to the cityhall.

local tax, amount = "Item", 200 
exports['ap-government']:addCityhallFunds(tax, amount)

ESX INSTALLATION

STEP BY STEP

  1. Extract ap-government.zip file.

  2. Inset SQL file into your database.

  3. Setup your config file with how you want it, make sure you enable the target system in the config to the one you use or if you have added another target script in the target.lua make sure the target options are both set to false.

SQL

Please note, there is an SQL file. You will need to import it in order for the script to run. You can open the respective SQL file, copy the queries and execute/run them in your database manually (my personal preferred way) or you can import the file.

Manual SQL Entries
CREATE TABLE IF NOT EXISTS `ap_appointments` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `identifier` varchar(46) DEFAULT NULL,
  `name` tinytext DEFAULT NULL,
  `appData` longtext DEFAULT NULL,
  `type` varchar(60) DEFAULT NULL,
  `state` int(11) DEFAULT 0,
  KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `ap_dlcsettings` (
  `script` varchar(60) DEFAULT 'SCRIPT',
  `settings` longtext DEFAULT '{}',
  `other` longtext DEFAULT '{}',
  `id_storage` longtext NOT NULL DEFAULT '[]'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO `ap_dlcsettings` (`script`, `settings`, `other`, `id_storage`) VALUES
('ap_voting', '{"funds":10000,"voteState":0,"currentType":0}', '{"Item":0.7,"Vehicle":0.2,"Business":0.15,"Housing":0.2,"Income":0.15}', '[]');

CREATE TABLE IF NOT EXISTS `ap_tax` (
  `business` varchar(60) DEFAULT 'JOB NAME',
  `society` varchar(60) DEFAULT 'SOCIETY',
  `label` varchar(60) DEFAULT 'JOB LABEL',
  `amount_owed` int(11) DEFAULT 0,
  `total_tax_paid` int(11) DEFAULT 0,
  `owner` varchar(46) DEFAULT NULL,
  `base_tax` int(11) DEFAULT NULL,
  `grants` longtext DEFAULT 'nil'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ap_voting` (
  `identifier` varchar(46) DEFAULT NULL,
  `name` varchar(70) DEFAULT NULL,
  `age` text DEFAULT NULL,
  `shortDescription` mediumtext DEFAULT NULL,
  `whyDoYouWantToBeACandidate` longtext DEFAULT NULL,
  `WhatYoullBringToTheCity` longtext DEFAULT NULL,
  `denied` longtext DEFAULT 'N/A',
  `votes` int(10) DEFAULT NULL,
  `state` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

SOCIETY CHANGES

  1. // Open esx society folder and edit fxmanifest.lua
  2. -- add this at the bottem of the manifest.
    
    server_exports {
      'GetSociety'
    }

EXAMPLE BELOW

This example shows how to add the trigger to es_extended\server\paycheck.lua for income tax support.

TriggerEvent('ap-government:server:systemTax', xPlayer.source, "Player", salary)

This example shows how to add the export for item tax defined in the config, this example is for esx_shops.

exports['ap-government']:chargeCityTax(xPlayer.source, "Item", price)

This example shows how to add the export for item tax defined in the config.

exports['ap-government']:chargeCityTax(source, "Item", price)

EXPORTS

These are available exports in the resource - use them as you please and find necessary.

This export can be used in your scripts that you want to include tax on in which you have added in the config.

exports['ap-government']:chargeCityTax(source, label, amount)
-- source; source of the player the tax will be deducted from.
-- label; this is the key of the type of tax you have added in the Config.Tax.MayorControl.
-- amount: this would be the amount of which the item/housing/vehicle cost.

Install and ensure for the resource.

qb-core\server\functions.lua
qb-inventory\server\main.lua
This is where you would find the label that you would be defining in the export from the new tax type you added.

Install and ensure for the resource.

Make changes to esx society, for instructions.

fxmanifest.lua
dependencies
dependencies
click here
QB-Target
QB-MENU
QB-INPUT
QB-MANAGEMENT
ox_inventory\modules\shops\server.lua
This is where you would find the label that you would be defining in the export from the new tax type you added.
| Script Showcase
Tebex Link