Files
GTA4RP/scripts/server/economy.js
Vortrex 9c87ff950c Lots of fixes + clans
* Added clans
* Fixed interior exit labels
* Disabled nametags on games without 3D label support
* Fixed mouse cursor toggle command
* Fixed SA fight-style not being applied
* Added manageRanks clan permission bitflag
* Added interior lights toggle
* Fixed clan chat
* Added real-time support with optional timezone offset
* Added lots of JSDoc stuff
* Added command for managers to set server GUI colour
* Added GeoIP command for admins
* Added command for admins to force an immediate payday
* Added admins gotospawn command
* Added return player command for teleported players
* Added pizza delivery job const
* Fixed biz/house set pickup & interior type
* Fixed inventory showing ammo count for melee weapons
* Fixed SA using wrong pickup types
* Fixed char select screen breaking when in a clan
* Added +/- symbol util for number display
* Added get current timestamp for timezone offset util
* Fixed vehicle owner ID being set wrong for job veh
2021-09-09 01:37:04 -05:00

81 lines
2.6 KiB
JavaScript

// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: economy.js
// DESC: Provides economy/financial utils, functions and usage
// TYPE: Server (JavaScript)
// ===========================================================================
function initEconomyScript() {
logToConsole(LOG_INFO, "[VRR.Economy]: Initializing economy script ...");
logToConsole(LOG_INFO, "[VRR.Economy]: Economy script initialized successfully!");
}
// ===========================================================================
function getTimeDisplayUntilPlayerPayDay(client) {
return getTimeDifferenceDisplay(sdl.ticks-getPlayerData(client).payDayTickStart);
}
// ===========================================================================
function applyServerInflationMultiplier(value) {
return toInteger(Math.round(value*getServerConfig().inflationMultiplier))
}
// ===========================================================================
function playerPayDay(client) {
let wealth = calculateWealth(client);
let taxAmount = calculateTax(wealth);
let grossIncome = getPlayerData(client).payDayAmount;
// Public Beta Bonus
taxAmount = 0;
grossIncome = grossIncome*2;
grossIncome = grossIncome + 2000;
let netIncome = grossIncome-taxAmount;
messagePlayerAlert(client, "== Payday! =============================");
messagePlayerInfo(client, `Paycheck: ${getInlineChatColourByName("lightGrey")}$${grossIncome}`);
messagePlayerInfo(client, `Taxes: ${getInlineChatColourByName("lightGrey")}$${taxAmount}`);
messagePlayerInfo(client, `You receive: ${getInlineChatColourByName("lightGrey")}$${netIncome}`);
givePlayerCash(client, netIncome);
}
// ===========================================================================
function calculateWealth(client) {
// To-do
return 0;
}
// ===========================================================================
function calculateTax(client) {
// To-do
return 0;
}
// ===========================================================================
function forcePlayerPayDayCommand(command, params, client) {
if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let targetClient = getPlayerFromParams(params);
if(!targetClient) {
messagePlayerError(client, "That player is not connected!");
return false;
}
messageAdmins(`${client.name} gave ${targetClient.name} an instant payday`);
playerPayDay(targetClient);
}
// ===========================================================================