Restructure (unfinished)

This commit is contained in:
Vortrex
2022-03-12 05:20:14 -06:00
parent 2dc6d65a50
commit ef4a2877d0
51 changed files with 2314 additions and 2524 deletions

View File

@@ -15,7 +15,6 @@
<script src="scripts/client/native/connected.js" type="client" language="javascript" /> <script src="scripts/client/native/connected.js" type="client" language="javascript" />
<!-- Server Scripts --> <!-- Server Scripts -->
<script src="scripts/server/class.js" type="server" language="javascript" />
<script src="scripts/server/accent.js" type="server" language="javascript" /> <script src="scripts/server/accent.js" type="server" language="javascript" />
<script src="scripts/server/account.js" type="server" language="javascript" /> <script src="scripts/server/account.js" type="server" language="javascript" />
<script src="scripts/server/animation.js" type="server" language="javascript" /> <script src="scripts/server/animation.js" type="server" language="javascript" />
@@ -26,7 +25,7 @@
<script src="scripts/server/chat.js" type="server" language="javascript" /> <script src="scripts/server/chat.js" type="server" language="javascript" />
<script src="scripts/server/clan.js" type="server" language="javascript" /> <script src="scripts/server/clan.js" type="server" language="javascript" />
<script src="scripts/server/client.js" type="server" language="javascript" /> <script src="scripts/server/client.js" type="server" language="javascript" />
<script src="scripts/server/const.js" type="server" language="javascript" /> <script src="scripts/server/crime.js" type="server" language="javascript" />
<script src="scripts/server/database.js" type="server" language="javascript" /> <script src="scripts/server/database.js" type="server" language="javascript" />
<script src="scripts/server/developer.js" type="server" language="javascript" /> <script src="scripts/server/developer.js" type="server" language="javascript" />
<script src="scripts/server/discord.js" type="server" language="javascript" /> <script src="scripts/server/discord.js" type="server" language="javascript" />
@@ -34,9 +33,13 @@
<script src="scripts/server/email.js" type="server" language="javascript" /> <script src="scripts/server/email.js" type="server" language="javascript" />
<script src="scripts/server/event.js" type="server" language="javascript" /> <script src="scripts/server/event.js" type="server" language="javascript" />
<script src="scripts/server/fishing.js" type="server" language="javascript" /> <script src="scripts/server/fishing.js" type="server" language="javascript" />
<script src="scripts/server/forensics.js" type="server" language="javascript" />
<script src="scripts/server/gate.js" type="server" language="javascript" />
<script src="scripts/server/gps.js" type="server" language="javascript" />
<script src="scripts/server/gui.js" type="server" language="javascript" /> <script src="scripts/server/gui.js" type="server" language="javascript" />
<script src="scripts/server/help.js" type="server" language="javascript" /> <script src="scripts/server/help.js" type="server" language="javascript" />
<script src="scripts/server/house.js" type="server" language="javascript" /> <script src="scripts/server/house.js" type="server" language="javascript" />
<script src="scripts/server/insurance.js" type="server" language="javascript" />
<script src="scripts/server/item.js" type="server" language="javascript" /> <script src="scripts/server/item.js" type="server" language="javascript" />
<script src="scripts/server/job.js" type="server" language="javascript" /> <script src="scripts/server/job.js" type="server" language="javascript" />
<script src="scripts/server/keybind.js" type="server" language="javascript" /> <script src="scripts/server/keybind.js" type="server" language="javascript" />
@@ -56,19 +59,6 @@
<script src="scripts/server/core.js" type="server" language="javascript" /> <script src="scripts/server/core.js" type="server" language="javascript" />
<script src="scripts/server/command.js" type="server" language="javascript" /> <script src="scripts/server/command.js" type="server" language="javascript" />
<!-- Server Business Scripts -->
<script src="scripts/server/business/bakery.js" type="server" language="javascript" />
<script src="scripts/server/business/bar.js" type="server" language="javascript" />
<script src="scripts/server/business/burger.js" type="server" language="javascript" />
<script src="scripts/server/business/clothing.js" type="server" language="javascript" />
<script src="scripts/server/business/club.js" type="server" language="javascript" />
<script src="scripts/server/business/fuel.js" type="server" language="javascript" />
<script src="scripts/server/business/mechanic.js" type="server" language="javascript" />
<script src="scripts/server/business/pizza.js" type="server" language="javascript" />
<script src="scripts/server/business/restaurant.js" type="server" language="javascript" />
<script src="scripts/server/business/vehicle.js" type="server" language="javascript" />
<script src="scripts/server/business/weapon.js" type="server" language="javascript" />
<!-- Server Job Scripts --> <!-- Server Job Scripts -->
<script src="scripts/server/job/bus.js" type="server" language="javascript" /> <script src="scripts/server/job/bus.js" type="server" language="javascript" />
<script src="scripts/server/job/drug.js" type="server" language="javascript" /> <script src="scripts/server/job/drug.js" type="server" language="javascript" />
@@ -92,25 +82,25 @@
<file type="client" src="files/fonts/roboto-regular.ttf" /> <file type="client" src="files/fonts/roboto-regular.ttf" />
<file type="client" src="files/fonts/pricedown.ttf" /> <file type="client" src="files/fonts/pricedown.ttf" />
<file type="client" src="files/images/skins/none.png" /> <file type="client" src="files/images/skins/none.png" />
<file type="client" src="files/images/mafiac-logo.png" /> <!--<file type="client" src="files/images/mafiac-logo.png" />-->
<file type="client" src="files/images/gtac-logo.png" /> <!--<file type="client" src="files/images/gtac-logo.png" />-->
<file type="client" src="files/images/server-logo.png" /> <file type="client" src="files/images/server-logo.png" />
<!-- GUI --> <!-- GUI -->
<script src="scripts/client/gui/login.js" type="client" language="javascript" />
<script src="scripts/client/gui/newchar.js" type="client" language="javascript" />
<script src="scripts/client/gui/charselect.js" type="client" language="javascript" />
<script src="scripts/client/gui/error.js" type="client" language="javascript" />
<script src="scripts/client/gui/info.js" type="client" language="javascript" />
<script src="scripts/client/gui/yesno.js" type="client" language="javascript" />
<script src="scripts/client/gui/register.js" type="client" language="javascript" />
<script src="scripts/client/gui/resetpass.js" type="client" language="javascript" />
<script src="scripts/client/gui/changepass.js" type="client" language="javascript" />
<script src="scripts/client/gui/clanmgr.js" type="client" language="javascript" />
<script src="scripts/client/gui/housemgr.js" type="client" language="javascript" />
<script src="scripts/client/gui/bizmgr.js" type="client" language="javascript" />
<script src="scripts/client/gui/2fa.js" type="client" language="javascript" /> <script src="scripts/client/gui/2fa.js" type="client" language="javascript" />
<script src="scripts/client/gui/bizmgr.js" type="client" language="javascript" />
<script src="scripts/client/gui/changepass.js" type="client" language="javascript" />
<script src="scripts/client/gui/charselect.js" type="client" language="javascript" />
<script src="scripts/client/gui/clanmgr.js" type="client" language="javascript" />
<script src="scripts/client/gui/error.js" type="client" language="javascript" />
<script src="scripts/client/gui/housemgr.js" type="client" language="javascript" />
<script src="scripts/client/gui/info.js" type="client" language="javascript" />
<script src="scripts/client/gui/login.js" type="client" language="javascript" />
<script src="scripts/client/gui/list.js" type="client" language="javascript" /> <script src="scripts/client/gui/list.js" type="client" language="javascript" />
<script src="scripts/client/gui/newchar.js" type="client" language="javascript" />
<script src="scripts/client/gui/register.js" type="client" language="javascript" />
<script src="scripts/client/gui/resetpass.js" type="client" language="javascript" />
<script src="scripts/client/gui/yesno.js" type="client" language="javascript" />
<!-- Client Scripts --> <!-- Client Scripts -->
<script src="scripts/client/afk.js" type="client" language="javascript" /> <script src="scripts/client/afk.js" type="client" language="javascript" />

View File

@@ -160,11 +160,13 @@ function onLocalPlayerEnteredVehicle(event, vehicle, seat) {
sendNetworkEventToServer("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat); sendNetworkEventToServer("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
if(inVehicleSeat == 0) { if(areServerElementsSupported()) {
inVehicle.engine = false; if(inVehicleSeat == 0) {
if(!inVehicle.engine) { inVehicle.engine = false;
parkedVehiclePosition = inVehicle.position; if(!inVehicle.engine) {
parkedVehicleHeading = inVehicle.heading; parkedVehiclePosition = inVehicle.position;
parkedVehicleHeading = inVehicle.heading;
}
} }
} }
} }

View File

@@ -3,6 +3,16 @@
<title>Connected RP: Login</title> <title>Connected RP: Login</title>
<style type="text/css" rel="stylesheet"> <style type="text/css" rel="stylesheet">
.input-box .input-box
{
font-family: 'Roboto';
font-size: 14px;
border-style: solid;
border-colour: #0066AA;
border-radius: 2px;
color: #0066AA;
}
.button
{ {
font-family: "Roboto"; font-family: "Roboto";
font-size: 14px; font-size: 14px;
@@ -14,5 +24,8 @@
</style> </style>
</head> </head>
<body> <body>
<img src="server-logo.png" />
<input type="password" placeholder="Password" id="login_input_password" />
<button class="button" id="login_input_submit">LOGIN</button>
</body> </body>
</html> </html>

View File

@@ -7,6 +7,191 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
// Account Contact Types
const VRR_CONTACT_NONE = 0;
const VRR_CONTACT_NEUTRAL = 1; // Contact is neutral. Used for general contacts with no special additional features
const VRR_CONTACT_FRIEND = 2; // Contact is a friend. Shows when they're online.
const VRR_CONTACT_BLOCKED = 3; // Contact is blocked. Prevents all communication to/from them except for RP
// ===========================================================================
// Account Authentication Methods
const VRR_ACCT_AUTHMETHOD_NONE = 0; // None
const VRR_ACCT_AUTHMETHOD_EMAIL = 1; // Email
const VRR_ACCT_AUTHMETHOD_PHONENUM = 2; // Phone number
const VRR_ACCT_AUTHMETHOD_2FA = 3; // Two factor authentication app (authy, google authenticator, etc)
const VRR_ACCT_AUTHMETHOD_PEBBLE = 4; // Pebble watch (this one's for Vortrex but anybody with a Pebble can use)
const VRR_ACCT_AUTHMETHOD_PHONEAPP = 5; // The Android/iOS companion app (will initially be a web based thing until I can get the apps created)
// ===========================================================================
// Two-Factor Authentication States
const VRR_2FA_STATE_NONE = 0; // None
const VRR_2FA_STATE_CODEINPUT = 1; // Waiting on player to enter code to play
const VRR_2FA_STATE_SETUP_CODETOAPP = 2; // Providing player with a code to put in their auth app
const VRR_2FA_STATE_SETUP_CODEFROMAPP = 3; // Waiting on player to enter code from auth app to set up
// ===========================================================================
// Reset Password States
const VRR_RESETPASS_STATE_NONE = 0; // None
const VRR_RESETPASS_STATE_CODEINPUT = 1; // Waiting on player to enter code sent via email
const VRR_RESETPASS_STATE_SETPASS = 2; // Waiting on player to enter new password
// ===========================================================================
/**
* @class Representing an account, loaded/saved in the database
*/
class AccountData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.password = "";
this.registerDate = 0;
this.flags = {
moderation: 0,
admin: 0,
};
this.staffTitle = "";
this.ircAccount = "";
this.discordAccount = 0,
this.settings = 0,
this.emailAddress = "";
this.ipAddress = 0,
this.notes = [];
this.messages = [];
this.contacts = [];
this.subAccounts = [];
this.emailVerificationCode = "";
this.twoFactorAuthVerificationCode = "";
this.chatScrollLines = 1;
this.streamingRadioVolume = 20;
this.locale = 0;
if(dbAssoc) {
this.databaseId = dbAssoc["acct_id"];
this.name = dbAssoc["acct_name"];
this.password = dbAssoc["acct_pass"];
this.registerDate = dbAssoc["acct_when_made"];
this.flags = {
moderation: dbAssoc["acct_svr_mod_flags"],
admin: dbAssoc["acct_svr_staff_flags"],
};
this.staffTitle = dbAssoc["acct_svr_staff_title"];
this.ircAccount = dbAssoc["acct_irc"];
this.discordAccount = dbAssoc["acct_discord"];
this.settings = dbAssoc["acct_svr_settings"];
this.emailAddress = dbAssoc["acct_email"];
this.whenRegistered = dbAssoc["acct_when_registered"];
this.ipAddress = dbAssoc["acct_ip"];
this.notes = [];
this.messages = [];
this.contacts = [];
this.subAccounts = [];
this.emailVerificationCode = dbAssoc["acct_code_verifyemail"];
this.twoFactorAuthVerificationCode = dbAssoc["acct_code_2fa"];
this.chatScrollLines = toInteger(dbAssoc["acct_svr_chat_scroll_lines"]);
this.streamingRadioVolume = toInteger(dbAssoc["acct_streaming_radio_volume"]);
this.locale = toInteger(dbAssoc["acct_locale"]);
}
}
};
// ===========================================================================
/**
* @class Representing an account's contact list, loaded/saved in the database
*/
class AccountContactData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.accountId = 0;
this.contactAccountId = 0;
this.type = 0;
this.whenAdded = 0;
this.needsSaved = false;
if(dbAssoc) {
this.databaseId = dbAssoc["acct_contact_id"];
this.accountId = dbAssoc["acct_contact_acct"];
this.contactAccountId = dbAssoc["acct_contact_contact"];
this.type = dbAssoc["acct_contact_type"];
this.whenAdded = dbAssoc["acct_contact_when_added"];
}
}
};
// ===========================================================================
/**
* @class Representing an account's messages, loaded/saved in the database
*/
class AccountMessageData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.account = 0;
this.whoSent = 0;
this.whenSent = 0;
this.whenRead = 0;
this.deleted = false;
this.whenDeleted = 0;
this.folder = 0;
this.message = "";
this.needsSaved = false;
if(dbAssoc) {
this.databaseId = dbAssoc["acct_msg_id"];
this.account = dbAssoc["acct_msg_acct"];
this.whoSent = dbAssoc["acct_msg_who_sent"];
this.whenSent = dbAssoc["acct_msg_when_sent"];
this.whenRead = dbAssoc["acct_msg_when_read"];
this.deleted = intToBool(dbAssoc["acct_msg_deleted"]);
this.whenDeleted = dbAssoc["acct_msg_when_deleted"];
this.folder = dbAssoc["acct_msg_folder"];
this.message = dbAssoc["acct_msg_message"];
}
}
};
// ===========================================================================
/**
* @class Representing an account's staff notes. Visible only to staff and loaded/saved in the database
*/
class AccountStaffNoteData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.account = 0;
this.whoAdded = 0;
this.whenAdded = 0;
this.deleted = false;
this.whenDeleted = 0;
this.serverId = 0;
this.note = "";
this.needsSaved = false;
if(dbAssoc) {
this.databaseId = dbAssoc["acct_note_id"];
this.account = dbAssoc["acct_note_acct"];
this.whoAdded = dbAssoc["acct_note_who_added"];
this.whenAdded = dbAssoc["acct_note_when_added"];
this.deleted = intToBool(dbAssoc["acct_note_deleted"]);
this.whenDeleted = dbAssoc["acct_note_when_deleted"];
this.serverId = dbAssoc["acct_note_server"];
this.note = dbAssoc["acct_note_message"];
}
}
};
// ===========================================================================
function initAccountScript() { function initAccountScript() {
logToConsole(LOG_DEBUG, "[VRR.Account]: Initializing account script ..."); logToConsole(LOG_DEBUG, "[VRR.Account]: Initializing account script ...");
logToConsole(LOG_DEBUG, "[VRR.Account]: Account script initialized!"); logToConsole(LOG_DEBUG, "[VRR.Account]: Account script initialized!");

View File

@@ -7,6 +7,34 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
// Ban Types
const VRR_BANTYPE_NONE = 0;
const VRR_BANTYPE_ACCOUNT = 1;
const VRR_BANTYPE_SUBACCOUNT = 2;
const VRR_BANTYPE_IPADDRESS = 3;
const VRR_BANTYPE_SUBNET = 4;
// ===========================================================================
class BanData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.type = VRR_BANTYPE_NONE;
this.detail = "";
this.ipAddress = "";
this.name = "";
this.reason = "";
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["ban_id"]);
this.type = dbAssoc["ban_type"];
this.detail = toInteger(dbAssoc["ban_detail"]);
this.ipAddress = toInteger(dbAssoc["ban_ip"]);
this.reason = toInteger(dbAssoc["ban_reason"]);
}
}
}
// =========================================================================== // ===========================================================================
function initBanScript() { function initBanScript() {

View File

@@ -7,12 +7,173 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
// Business Types
const VRR_BIZ_TYPE_NONE = 0; // None (invalid)
const VRR_BIZ_TYPE_NORMAL = 1; // Normal business (sells items)
const VRR_BIZ_TYPE_BANK = 2; // Bank
const VRR_BIZ_TYPE_PUBLIC = 3; // Public business (Government, public service, etc)
// ===========================================================================
// Business Location Types
const VRR_BIZLOC_NONE = 0; // None
const VRR_BIZLOC_GATE = 1; // Center of any moveable gate that belongs to the biz
const VRR_BIZLOC_GARAGE = 2; // Location for attached garage (pos1 = outside, pos2 = inside). Use pos to teleport or spawn veh/ped
const VRR_BIZLOC_FUEL = 3; // Fuel pump
const VRR_BIZLOC_DRIVETHRU = 4; // Drivethrough
const VRR_BIZLOC_VENDMACHINE = 5; // Vending machine
// ===========================================================================
// Business Owner Types
const VRR_BIZOWNER_NONE = 0; // Not owned
const VRR_BIZOWNER_PLAYER = 1; // Owned by a player (character/subaccount)
const VRR_BIZOWNER_JOB = 2; // Owned by a job
const VRR_BIZOWNER_CLAN = 3; // Owned by a clan
const VRR_BIZOWNER_FACTION = 4; // Owned by a faction (not used at the moment)
const VRR_BIZOWNER_PUBLIC = 5; // Public Business. Used for goverment/official places like police, fire, city hall, DMV, etc
// ===========================================================================
/**
* @class Representing a businesses' data. Loaded and saved in the database
*/
class BusinessData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.ownerType = VRR_BIZOWNER_NONE;
this.ownerId = 0;
this.buyPrice = 0;
this.locked = false;
this.hasInterior = false;
this.index = -1;
this.needsSaved = false;
this.interiorLights = true;
this.floorItemCache = [];
this.storageItemCache = [];
this.locations = [];
this.gameScripts = [];
this.entrancePosition = false;
this.entranceRotation = 0.0;
this.entranceInterior = 0;
this.entranceDimension = 0;
this.entrancePickupModel = -1;
this.entranceBlipModel = -1;
this.entrancePickup = null;
this.entranceBlip = null;
this.exitPosition = false;
this.exitRotation = 0.0;
this.exitInterior = 0;
this.exitDimension = 0;
this.exitPickupModel = -1;
this.exitBlipModel = -1;
this.exitPickup = null;
this.exitBlip = null;
this.entranceFee = 0;
this.till = 0;
this.streamingRadioStation = -1;
this.labelHelpType = VRR_PROPLABEL_INFO_NONE;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["biz_id"]);
this.name = toString(dbAssoc["biz_name"]);
this.ownerType = toInteger(dbAssoc["biz_owner_type"]);
this.ownerId = toInteger(dbAssoc["biz_owner_id"]);
this.buyPrice = toInteger(dbAssoc["biz_buy_price"]);
this.locked = intToBool(toInteger(dbAssoc["biz_locked"]));
this.hasInterior = intToBool(toInteger(dbAssoc["biz_has_interior"]));
this.interiorLights = intToBool(toInteger(dbAssoc["biz_interior_lights"]));
this.entrancePosition = toVector3(toFloat(dbAssoc["biz_entrance_pos_x"]), toFloat(dbAssoc["biz_entrance_pos_y"]), toFloat(dbAssoc["biz_entrance_pos_z"]));
this.entranceRotation = toInteger(dbAssoc["biz_entrance_rot_z"]);
this.entranceInterior = toInteger(dbAssoc["biz_entrance_int"]);
this.entranceDimension = toInteger(dbAssoc["biz_entrance_vw"]);
this.entrancePickupModel = toInteger(dbAssoc["biz_entrance_pickup"]);
this.entranceBlipModel = toInteger(dbAssoc["biz_entrance_blip"]);
this.exitPosition = toVector3(dbAssoc["biz_exit_pos_x"], dbAssoc["biz_exit_pos_y"], dbAssoc["biz_exit_pos_z"]);
this.exitRotation = toInteger(dbAssoc["biz_exit_rot_z"]);
this.exitInterior = toInteger(dbAssoc["biz_exit_int"]);
this.exitDimension = toInteger(dbAssoc["biz_exit_vw"]);
this.exitPickupModel = toInteger(dbAssoc["biz_exit_pickup"]);
this.exitBlipModel = toInteger(dbAssoc["biz_exit_blip"]);
this.entranceFee = toInteger(dbAssoc["biz_entrance_fee"]);
this.till = toInteger(dbAssoc["biz_till"]);
this.labelHelpType = toInteger(dbAssoc["biz_label_help_type"]);
this.streamingRadioStation = toInteger(dbAssoc["biz_radiostation"]);
}
};
};
/**
* @class Representing a business's location data. Multiple can be used for a single business. Used for things like doors, fuel pumps, drive thru positions, etc. Loaded and saved in the database
*/
class BusinessLocationData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.type = 0;
this.business = 0;
this.enabled = false;
this.index = -1;
this.businessIndex = -1;
this.needsSaved = false;
this.position = toVector3(0.0, 0.0, 0.0);
this.interior = 0;
this.dimension = 0;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["biz_loc_id"]);
this.name = toString(dbAssoc["biz_loc_name"]);
this.type = toInteger(dbAssoc["biz_loc_type"]);
this.business = toInteger(dbAssoc["biz_loc_biz"]);
this.enabled = intToBool(toInteger(dbAssoc["biz_loc_enabled"]));
this.position = toVector3(toFloat(dbAssoc["biz_loc_pos_x"]), toFloat(dbAssoc["biz_loc_pos_y"]), toFloat(dbAssoc["biz_loc_pos_z"]));
this.interior = toInteger(dbAssoc["biz_loc_int"]);
this.dimension = toInteger(dbAssoc["biz_loc_vw"]);
}
}
};
/**
* @class Representing a business's game scripts. Multiple can be used for a single business. Used for things like bar and club NPCs and other actions
*/
class BusinessGameScriptData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.business = 0;
this.enabled = false;
this.index = -1;
this.businessIndex = -1;
this.needsSaved = false;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["biz_script_id"]);
this.name = toString(dbAssoc["biz_script_name"]);
this.state = toInteger(dbAssoc["biz_script_state"]);
this.business = toInteger(dbAssoc["biz_script_biz"]);
}
}
};
// ===========================================================================
function initBusinessScript() { function initBusinessScript() {
logToConsole(LOG_INFO, "[VRR.Business]: Initializing business script ..."); logToConsole(LOG_INFO, "[VRR.Business]: Initializing business script ...");
getServerData().businesses = loadBusinessesFromDatabase(); getServerData().businesses = loadBusinessesFromDatabase();
createAllBusinessPickups(); createAllBusinessPickups();
createAllBusinessBlips(); createAllBusinessBlips();

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: bakery.js
// DESC: Provides bakery business functions and usage
// TYPE: Business (JavaScript)
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: bar.js
// DESC: Provides bar/pub business functions and usage
// TYPE: Business (JavaScript)
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: burger.js
// DESC: Provides burger joint (McDonalds?) business functions and usage
// TYPE: Business (JavaScript)
// ===========================================================================

View File

@@ -1,67 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: casino.js
// DESC: Provides casino business functions and usage
// TYPE: Business (JavaScript)
// ===========================================================================
let deckCards = [
DeckCardData("deckCardSpadeAce", VRR_DECKCARD_SUIT_SPADE, 1),
DeckCardData("deckCardSpade2", VRR_DECKCARD_SUIT_SPADE, 2),
DeckCardData("deckCardSpade3", VRR_DECKCARD_SUIT_SPADE, 3),
DeckCardData("deckCardSpade4", VRR_DECKCARD_SUIT_SPADE, 4),
DeckCardData("deckCardSpade5", VRR_DECKCARD_SUIT_SPADE, 5),
DeckCardData("deckCardSpade6", VRR_DECKCARD_SUIT_SPADE, 6),
DeckCardData("deckCardSpade7", VRR_DECKCARD_SUIT_SPADE, 7),
DeckCardData("deckCardSpade8", VRR_DECKCARD_SUIT_SPADE, 8),
DeckCardData("deckCardSpade9", VRR_DECKCARD_SUIT_SPADE, 9),
DeckCardData("deckCardSpade10", VRR_DECKCARD_SUIT_SPADE, 10),
DeckCardData("deckCardSpadeJack", VRR_DECKCARD_SUIT_SPADE, 11),
DeckCardData("deckCardSpadeQueen", VRR_DECKCARD_SUIT_SPADE, 12),
DeckCardData("deckCardSpadeKing", VRR_DECKCARD_SUIT_SPADE, 13),
DeckCardData("deckCardClubAce", VRR_DECKCARD_SUIT_CLUB, 1),
DeckCardData("deckCardClub2", VRR_DECKCARD_SUIT_CLUB, 2),
DeckCardData("deckCardClub3", VRR_DECKCARD_SUIT_CLUB, 3),
DeckCardData("deckCardClub4", VRR_DECKCARD_SUIT_CLUB, 4),
DeckCardData("deckCardClub5", VRR_DECKCARD_SUIT_CLUB, 5),
DeckCardData("deckCardClub6", VRR_DECKCARD_SUIT_CLUB, 6),
DeckCardData("deckCardClub7", VRR_DECKCARD_SUIT_CLUB, 7),
DeckCardData("deckCardClub8", VRR_DECKCARD_SUIT_CLUB, 8),
DeckCardData("deckCardClub9", VRR_DECKCARD_SUIT_CLUB, 9),
DeckCardData("deckCardClub10", VRR_DECKCARD_SUIT_CLUB, 10),
DeckCardData("deckCardClubJack", VRR_DECKCARD_SUIT_CLUB, 11),
DeckCardData("deckCardClubQueen", VRR_DECKCARD_SUIT_CLUB, 12),
DeckCardData("deckCardClubKing", VRR_DECKCARD_SUIT_CLUB, 13),
DeckCardData("deckCardHeartAce", VRR_DECKCARD_SUIT_HEART, 1),
DeckCardData("deckCardHeart2", VRR_DECKCARD_SUIT_HEART, 2),
DeckCardData("deckCardHeart3", VRR_DECKCARD_SUIT_HEART, 3),
DeckCardData("deckCardHeart4", VRR_DECKCARD_SUIT_HEART, 4),
DeckCardData("deckCardHeart5", VRR_DECKCARD_SUIT_HEART, 5),
DeckCardData("deckCardHeart6", VRR_DECKCARD_SUIT_HEART, 6),
DeckCardData("deckCardHeart7", VRR_DECKCARD_SUIT_HEART, 7),
DeckCardData("deckCardHeart8", VRR_DECKCARD_SUIT_HEART, 8),
DeckCardData("deckCardHeart9", VRR_DECKCARD_SUIT_HEART, 9),
DeckCardData("deckCardHeart10", VRR_DECKCARD_SUIT_HEART, 10),
DeckCardData("deckCardHeartJack", VRR_DECKCARD_SUIT_HEART, 11),
DeckCardData("deckCardHeartQueen", VRR_DECKCARD_SUIT_HEART, 12),
DeckCardData("deckCardHeartKing", VRR_DECKCARD_SUIT_HEART, 13),
DeckCardData("deckCardDiamondAce", VRR_DECKCARD_SUIT_DIAMOND, 1),
DeckCardData("deckCardDiamond2", VRR_DECKCARD_SUIT_DIAMOND, 2),
DeckCardData("deckCardDiamond3", VRR_DECKCARD_SUIT_DIAMOND, 3),
DeckCardData("deckCardDiamond4", VRR_DECKCARD_SUIT_DIAMOND, 4),
DeckCardData("deckCardDiamond5", VRR_DECKCARD_SUIT_DIAMOND, 5),
DeckCardData("deckCardDiamond6", VRR_DECKCARD_SUIT_DIAMOND, 6),
DeckCardData("deckCardDiamond7", VRR_DECKCARD_SUIT_DIAMOND, 7),
DeckCardData("deckCardDiamond8", VRR_DECKCARD_SUIT_DIAMOND, 8),
DeckCardData("deckCardDiamond9", VRR_DECKCARD_SUIT_DIAMOND, 9),
DeckCardData( "deckCardDiamond10", VRR_DECKCARD_SUIT_DIAMOND, 10),
DeckCardData("deckCardDiamondJack", VRR_DECKCARD_SUIT_DIAMOND, 11),
DeckCardData("deckCardDiamondQueen", VRR_DECKCARD_SUIT_DIAMOND, 12),
DeckCardData("deckCardDiamondKing", VRR_DECKCARD_SUIT_DIAMOND, 13),
];
let deckCardBacks = [
]

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: clothing.js
// DESC: Provides clothing (skin) business functions and usage
// TYPE: Business (JavaScript)
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: club.js
// DESC: Provides club/nightclub business functions and usage
// TYPE: Business (JavaScript)
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: fuel.js
// DESC: Provides fuel/petrol business functions and usage
// TYPE: Business (JavaScript)
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: mechanic.js
// DESC: Provides mechanic/vehicle repair business functions and usage
// TYPE: Business (JavaScript)
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: pizza.js
// DESC: Provides pizza restaurant business functions and usage
// TYPE: Business (JavaScript)
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: restaurant.js
// DESC: Provides generic restaurant business functions and usage
// TYPE: Business (JavaScript)
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: vehicle.js
// DESC: Provides vehicle dealership business functions and usage
// TYPE: Business (JavaScript)
// ===========================================================================

View File

@@ -1,9 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: weapon.js
// DESC: Provides weapon (ammunations & illegal gunshops) business usage
// TYPE: Business (JavaScript)
// ===========================================================================

View File

@@ -7,6 +7,103 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
/**
* @class Representing a clan's data. Loaded and saved in the database
*/
class ClanData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.ownerId = 0;
this.tag = "";
this.enabled = false;
this.index = -1;
this.colour = COLOUR_WHITE;
this.colours = [];
this.initialRank = 0;
this.members = [];
this.ranks = [];
this.needsSaved = false;
this.motd = false;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["clan_id"]);
this.name = dbAssoc["clan_name"];
this.owner = toInteger(dbAssoc["clan_owner"]);
this.tag = dbAssoc["clan_tag"];
this.enabled = intToBool(toInteger(dbAssoc["clan_enabled"]));
this.colour = toColour(toInteger(dbAssoc["clan_col_r"]), toInteger(dbAssoc["clan_col_g"]), toInteger(dbAssoc["clan_col_b"]));
this.colours = [toInteger(dbAssoc["clan_col_r"]), toInteger(dbAssoc["clan_col_g"]), toInteger(dbAssoc["clan_col_b"])];
this.motd = dbAssoc["clan_motd"];
}
}
};
// ===========================================================================
/**
* @class Representing a clan rank's data. Loaded and saved in the database
*/
class ClanRankData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.clan = 0;
this.name = "";
this.level = 0;
this.flags = 0;
this.customTag = "";
this.enabled = true;
this.index = -1;
this.clanIndex = -1;
this.needsSaved = false;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["clan_rank_id"]);
this.clan = toInteger(dbAssoc["clan_rank_clan"]);
this.name = dbAssoc["clan_rank_name"];
this.level = toInteger(dbAssoc["clan_rank_level"]);
this.flags = toInteger(dbAssoc["clan_rank_flags"]);
this.tag = dbAssoc["clan_rank_tag"];
this.enabled = intToBool(toInteger(dbAssoc["clan_rank_enabled"]));
}
}
};
// ===========================================================================
/**
* @class Representing a clan member's data. Loaded and saved in the database
*/
class ClanMemberData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.clan = 0;
this.subAccount = 0;
this.flags = 0;
this.customTitle = "";
this.customTag = "";
this.rank = 0;
this.enabled = false;
this.index = -1;
this.clanIndex = -1;
this.rankIndex = -1;
this.needsSaved = false;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["clan_member_id"]);
this.subAccount = toInteger(dbAssoc["clan_member_sacct"]);
this.clan = toInteger(dbAssoc["clan_member_clan"]);
this.name = dbAssoc["clan_member_name"];
this.rank = toInteger(dbAssoc["clan_member_rank"]);
this.flags = toInteger(dbAssoc["clan_member_flags"]);
this.customTag = dbAssoc["clan_member_tag"];
this.customTitle = dbAssoc["clan_member_title"];
}
}
};
// ===========================================================================
function initClanScript() { function initClanScript() {
logToConsole(LOG_INFO, "[VRR.Clan]: Initializing clans script ..."); logToConsole(LOG_INFO, "[VRR.Clan]: Initializing clans script ...");
getServerData().clans = loadClansFromDatabase(); getServerData().clans = loadClansFromDatabase();

File diff suppressed because it is too large Load Diff

View File

@@ -7,6 +7,120 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
// Return-To types (for when a player is teleported)
const VRR_RETURNTO_TYPE_NONE = 0; // "Return to" data is invalid
const VRR_RETURNTO_TYPE_ADMINGET = 1; // "Return to" data is from admin teleporting
const VRR_RETURNTO_TYPE_SKINSELECT = 2; // "Return to" data is from skin select
/**
* @class Representing extra data for a client
*/
class ClientData {
constructor(client, accountData, subAccounts) {
this.accountData = accountData;
this.subAccounts = subAccounts; // Characters
this.client = client;
this.currentSubAccount = -1;
this.loggedIn = false;
this.index = -1;
this.connectTime = 0;
this.clientVersion = "0.0.0";
this.loginAttemptsRemaining = 3;
this.afk = false;
this.jobRoute = -1;
this.jobRouteLocation = -1;
this.jobRouteVehicle = false;
this.spawned = false;
this.rentingVehicle = false;
this.buyingVehicle = false;
this.lastVehicle = false;
this.returnToJobVehicleTick = 0;
this.returnToJobVehicleTimer = null;
this.switchingCharacter = false;
this.tutorialStep = -1;
this.tutorialItem = null;
this.tutorialVehicle = null;
this.hotBarItems = new Array(9).fill(-1);
this.activeHotBarSlot = -1;
this.toggleUseItem = false;
this.jobLockerCache = new Array(9).fill(-1);
this.jobEquipmentCache = [];
this.jobUniform = 0;
this.itemActionState = VRR_ITEM_ACTION_NONE;
this.itemActionItem = -1;
this.alcoholLevel = 0;
this.pedState = VRR_PEDSTATE_NONE;
this.promptType = VRR_PROMPT_NONE;
this.businessOrderAmount = 0;
this.businessOrderBusiness = -1;
this.businessOrderItem = -1;
this.businessOrderValue = -1;
this.syncPosition = null;
this.syncHeading = null;
this.syncVehicle = null;
this.syncVehicleSeat = null;
this.twoFactorAuthenticationState = VRR_2FA_STATE_NONE;
this.twoFactorAuthenticationCode = 0;
this.payDayAmount = 0;
this.payDayTickStart = 0;
this.creatingCharacter = false;
this.creatingCharacterSkin = -1;
this.streamingRadioStation = -1;
this.streamingRadioElement = false;
this.returnToPosition = null;
this.returnToHeading = null;
this.returnToInterior = null;
this.returnToDimension = null;
this.returnToHouse = null;
this.returnToBusiness = null;
this.returnToType = VRR_RETURNTO_TYPE_NONE;
this.changingCharacterName = false;
this.currentPickup = false;
this.usingSkinSelect = false;
this.keyBinds = [];
this.sessionId = 0;
this.incomingDamageMultiplier = 1;
this.weaponDamageEvent = VRR_WEAPON_DAMAGE_EVENT_NORMAL;
this.currentAnimation = -1;
this.currentAnimationPositionOffset = false;
this.currentAnimationPositionReturnTo = false;
this.animationStart = 0;
this.animationForced = false;
this.passwordResetState = VRR_RESETPASS_STATE_NONE;
this.passwordResetCode = "";
this.lastJobVehicle = null;
this.health = 100;
this.locale = 0;
this.enteringVehicle = null;
}
};
// ===========================================================================
function initClientScript() { function initClientScript() {
logToConsole(LOG_DEBUG, "[VRR.Client]: Initializing client script ..."); logToConsole(LOG_DEBUG, "[VRR.Client]: Initializing client script ...");
addAllNetworkHandlers(); addAllNetworkHandlers();

View File

@@ -7,6 +7,38 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
/**
* @class Representing a command's data. Loaded and saved in the database
*/
class CommandData {
enable() {
this.enabled = true;
}
disable() {
this.enabled = false;
}
toggleEnabled() {
this.enabled = !this.enabled;
}
constructor(command, handlerFunction, syntaxString, requiredStaffFlags, requireLogin, allowOnDiscord, helpDescription) {
this.command = command;
this.handlerFunction = handlerFunction;
this.syntaxString = syntaxString;
this.requiredStaffFlags = requiredStaffFlags;
this.enabled = true;
this.requireLogin = requireLogin;
this.allowOnDiscord = allowOnDiscord;
this.helpDescription = helpDescription;
this.aliases = [];
}
};
// ===========================================================================
let serverCommands = []; let serverCommands = [];
// =========================================================================== // ===========================================================================

View File

@@ -7,6 +7,125 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
/**
* @class Representing data for server configuration
*/
class ServerData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.needsSaved = false;
this.newCharacter = {
spawnPosition: toVector3(0.0, 0.0, 0.0),
spawnHeading: 0.0,
spawnInterior: 0,
spawnDimension: 0,
money: 0,
bank: 0,
skin: 0,
};
this.connectCameraPosition = toVector3(0.0, 0.0, 0.0);
this.connectCameraLookAt = toVector3(0.0, 0.0, 0.0);
this.characterSelectCameraPosition = toVector3(0.0, 0.0, 0.0);
this.characterSelectCameraLookAt = toVector3(0.0, 0.0, 0.0);
this.characterSelectPedPosition = toVector3(0.0, 0.0, 0.0);
this.characterSelectPedHeading = 0.0;
this.characterSelectInterior = 0;
this.characterSelectDimension = 0;
this.hour = 0;
this.minute = 0
this.minuteDuration = 1000;
this.weather = 0
this.fallingSnow = false;
this.groundSnow = false;
this.useGUI = true;
this.guiColourPrimary = [200, 200, 200];
this.guiColourSecondary = [200, 200, 200];
this.guiTextColourPrimary = [0, 0, 0];
this.guiTextColourSecondary = [0, 0, 0];
this.showLogo = true;
this.inflationMultiplier = 1;
this.testerOnly = false;
this.settings = 0;
this.antiCheat = {
enabled: false,
//checkGameScripts: false,
//gameScriptWhiteListEnabled: false,
//gameScriptBlackListEnabled: false,
//gameScriptWhiteList: [],
//gameScriptBlackList: [],
};
this.discordBotToken = "";
this.discordEnabled = false;
this.createJobPickups = false;
this.createBusinessPickups = false;
this.createHousePickups = false;
this.createJobBlips = false;
this.createBusinessBlips = false;
this.createHouseBlips = false;
this.introMusicURL = "";
this.pauseSavingToDatabase = false;
this.useRealTime = false;
this.realTimeZone = 0;
this.discordConfig = {
eventChannelWebHookURL: "",
chatChannelWebHookURL: "",
adminChannelWebHookURL: "",
sendEvents: true,
sendChat: true,
sendAdminEvents: true,
};
if(dbAssoc) {
this.databaseId = dbAssoc["svr_id"];
this.newCharacter = {
spawnPosition: toVector3(dbAssoc["svr_newchar_pos_x"], dbAssoc["svr_newchar_pos_y"], dbAssoc["svr_newchar_pos_z"]),
spawnHeading: dbAssoc["svr_newchar_rot_z"],
money: dbAssoc["svr_newchar_money"],
bank: dbAssoc["svr_newchar_bank"],
skin: dbAssoc["svr_newchar_skin"],
},
this.settings = toInteger(dbAssoc["svr_settings"]);
this.connectCameraPosition = toVector3(dbAssoc["svr_connectcam_pos_x"], dbAssoc["svr_connectcam_pos_y"], dbAssoc["svr_connectcam_pos_z"]);
this.connectCameraLookAt = toVector3(dbAssoc["svr_connectcam_lookat_x"], dbAssoc["svr_connectcam_lookat_y"], dbAssoc["svr_connectcam_lookat_z"]);
this.hour = toInteger(dbAssoc["svr_start_time_hour"]);
this.minute = toInteger(dbAssoc["svr_start_time_min"]);
this.minuteDuration = toInteger(dbAssoc["svr_time_min_duration"]);
this.weather = toInteger(dbAssoc["svr_start_weather"]);
this.guiColourPrimary = [toInteger(dbAssoc["svr_gui_col1_r"]), toInteger(dbAssoc["svr_gui_col1_g"]), toInteger(dbAssoc["svr_gui_col1_b"])];
this.guiColourSecondary = [toInteger(dbAssoc["svr_gui_col2_r"]), toInteger(dbAssoc["svr_gui_col2_g"]), toInteger(dbAssoc["svr_gui_col2_b"])];
this.guiTextColourPrimary = [toInteger(dbAssoc["svr_gui_textcol1_r"]), toInteger(dbAssoc["svr_gui_textcol1_g"]), toInteger(dbAssoc["svr_gui_textcol1_b"])];
//this.guiTextColourSecondary = [toInteger(dbAssoc["svr_gui_textcol2_r"]), toInteger(dbAssoc["svr_gui_textcol2_g"]), toInteger(dbAssoc["svr_gui_textcol2_b"])];
this.inflationMultiplier = toFloat(dbAssoc["svr_inflation_multiplier"]);
this.discordBotToken = intToBool(dbAssoc["svr_discord_bot_token"]);
this.introMusicURL = dbAssoc["svr_intro_music"];
this.realTimeZone = dbAssoc["svr_time_realtime_timezone"];
this.discordConfig = {
eventChannelWebHookURL: dbAssoc["svr_discord_event_webhook"],
chatChannelWebHookURL: dbAssoc["svr_discord_chat_webhook"],
adminChannelWebHookURL: dbAssoc["svr_discord_admin_webhook"],
sendEvents: true,
sendChat: true,
sendAdminEvents: true,
};
}
}
};
let serverConfig = false; let serverConfig = false;
let databaseConfig = false; let databaseConfig = false;
let emailConfig = false; let emailConfig = false;
@@ -84,20 +203,20 @@ function initConfigScript() {
serverConfig = loadServerConfigFromGameAndPort(server.game, server.port, getMultiplayerMod()); serverConfig = loadServerConfigFromGameAndPort(server.game, server.port, getMultiplayerMod());
logToConsole(LOG_INFO, "[VRR.Config]: Applying server config ..."); logToConsole(LOG_INFO, "[VRR.Config]: Applying server config ...");
getServerConfig().fallingSnow = intToBool(toInteger(server.getCVar("fallingsnow"))); getServerConfig().fallingSnow = intToBool(toInteger(server.getCVar("vrr_fallingsnow")));
getServerConfig().groundSnow = intToBool(toInteger(server.getCVar("groundsnow"))); getServerConfig().groundSnow = intToBool(toInteger(server.getCVar("vrr_groundsnow")));
getServerConfig().useGUI = intToBool(toInteger(server.getCVar("gui"))); getServerConfig().useGUI = intToBool(toInteger(server.getCVar("vrr_gui")));
getServerConfig().showLogo = false; getServerConfig().showLogo = false;
getServerConfig().testerOnly = intToBool(toInteger(server.getCVar("testeronly"))); getServerConfig().testerOnly = intToBool(toInteger(server.getCVar("vrr_testeronly")));
getServerConfig().discordEnabled = false; getServerConfig().discordEnabled = false;
getServerConfig().createJobPickups = intToBool(toInteger(server.getCVar("jobpickups"))); getServerConfig().createJobPickups = intToBool(toInteger(server.getCVar("vrr_jobpickups")));
getServerConfig().createBusinessPickups = intToBool(toInteger(server.getCVar("businesspickups"))); getServerConfig().createBusinessPickups = intToBool(toInteger(server.getCVar("vrr_businesspickups")));
getServerConfig().createHousePickups = intToBool(toInteger(server.getCVar("housepickups"))); getServerConfig().createHousePickups = intToBool(toInteger(server.getCVar("vrr_housepickups")));
getServerConfig().createJobBlips = intToBool(toInteger(server.getCVar("jobblips"))); getServerConfig().createJobBlips = intToBool(toInteger(server.getCVar("vrr_jobblips")));
getServerConfig().createBusinessBlips = intToBool(toInteger(server.getCVar("businessblips"))); getServerConfig().createBusinessBlips = intToBool(toInteger(server.getCVar("vrr_businessblips")));
getServerConfig().createHouseBlips = intToBool(toInteger(server.getCVar("houseblips"))); getServerConfig().createHouseBlips = intToBool(toInteger(server.getCVar("vrr_houseblips")));
getServerConfig().useRealTime = intToBool(toInteger(server.getCVar("realtime"))); getServerConfig().useRealTime = intToBool(toInteger(server.getCVar("vrr_realtime")));
getServerConfig().antiCheat.enabled = intToBool(toInteger(server.getCVar("anticheat"))); getServerConfig().antiCheat.enabled = intToBool(toInteger(server.getCVar("vrr_anticheat")));
applyConfigToServer(serverConfig); applyConfigToServer(serverConfig);
logToConsole(LOG_DEBUG, "[VRR.Config]: Server config applied successfully!"); logToConsole(LOG_DEBUG, "[VRR.Config]: Server config applied successfully!");

View File

@@ -1,349 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: const.js
// DESC: Provides constants
// TYPE: Server (JavaScript)
// ===========================================================================
// Prompts (used for client GUI prompt responses)
const VRR_PROMPT_NONE = 0;
const VRR_PROMPT_CREATEFIRSTCHAR = 1;
const VRR_PROMPT_BIZORDER = 2;
// Job Types
const VRR_JOB_NONE = 0;
const VRR_JOB_POLICE = 1;
const VRR_JOB_MEDICAL = 2;
const VRR_JOB_FIRE = 3;
const VRR_JOB_BUS = 4;
const VRR_JOB_TAXI = 5;
const VRR_JOB_GARBAGE = 6;
const VRR_JOB_WEAPON = 7;
const VRR_JOB_DRUG = 8;
const VRR_JOB_PIZZA = 9;
const VRR_JOB_GENERIC = 10;
// Pickup Types
const VRR_PICKUP_NONE = 0;
const VRR_PICKUP_JOB = 1;
const VRR_PICKUP_BUSINESS_ENTRANCE = 2;
const VRR_PICKUP_BUSINESS_EXIT = 3;
const VRR_PICKUP_HOUSE_ENTRANCE = 4;
const VRR_PICKUP_HOUSE_EXIT = 5;
const VRR_PICKUP_EXIT = 6;
// Vehicle Owner Types
const VRR_VEHOWNER_NONE = 0; // Not owned
const VRR_VEHOWNER_PLAYER = 1; // Owned by a player (character/subaccount)
const VRR_VEHOWNER_JOB = 2; // Owned by a job
const VRR_VEHOWNER_CLAN = 3; // Owned by a clan
const VRR_VEHOWNER_FACTION = 4; // Owned by a faction (not used at the moment)
const VRR_VEHOWNER_PUBLIC = 5; // Public vehicle. Anybody can drive it.
const VRR_VEHOWNER_BIZ = 6; // Owned by a business (also includes dealerships since they're businesses)
// Business Owner Types
const VRR_BIZOWNER_NONE = 0; // Not owned
const VRR_BIZOWNER_PLAYER = 1; // Owned by a player (character/subaccount)
const VRR_BIZOWNER_JOB = 2; // Owned by a job
const VRR_BIZOWNER_CLAN = 3; // Owned by a clan
const VRR_BIZOWNER_FACTION = 4; // Owned by a faction (not used at the moment)
const VRR_BIZOWNER_PUBLIC = 5; // Public Business. Used for goverment/official places like police, fire, city hall, DMV, etc
// House Owner Types
const VRR_HOUSEOWNER_NONE = 0; // Not owned
const VRR_HOUSEOWNER_PLAYER = 1; // Owner is a player (character/subaccount)
const VRR_HOUSEOWNER_JOB = 2; // Owned by a job
const VRR_HOUSEOWNER_CLAN = 3; // Owned by a clan
const VRR_HOUSEOWNER_FACTION = 4; // Owned by a faction
const VRR_HOUSEOWNER_PUBLIC = 5; // Is a public house. Technically not owned. This probably won't be used.
// Gate Owner Types
const VRR_GATEOWNER_NONE = 0; // Not owned
const VRR_GATEOWNER_PLAYER = 1; // Owner is a player (character/subaccount)
const VRR_GATEOWNER_JOB = 2; // Owned by a job
const VRR_GATEOWNER_CLAN = 3; // Owned by a clan
const VRR_GATEOWNER_FACTION = 4; // Owned by a faction
const VRR_GATEOWNER_PUBLIC = 5; // Public gate. Technically not owned. This probably won't be used.
const VRR_GATEOWNER_BUSINESS = 6; // Owned by a business. Back lots, unloading areas, and other stuff like that
const VRR_GATEOWNER_HOUSE = 7; // Owned by a house. Like for mansions with closed private areas.
// Business Location Types
const VRR_BIZLOC_NONE = 0; // None
const VRR_BIZLOC_GATE = 1; // Center of any moveable gate that belongs to the biz
const VRR_BIZLOC_GARAGE = 2; // Location for attached garage (pos1 = outside, pos2 = inside). Use pos to teleport or spawn veh/ped
const VRR_BIZLOC_FUEL = 3; // Fuel pump
const VRR_BIZLOC_DRIVETHRU = 4; // Drivethrough
const VRR_BIZLOC_VENDMACHINE = 5; // Vending machine
// House Location Types
const VRR_HOUSELOC_NONE = 0; // None
const VRR_HOUSELOC_GATE = 1; // Center of any moveable gate that belongs to the house
const VRR_HOUSELOC_GARAGE = 2; // Location for garage (pos1 = outside, pos2 = inside). Use pos to teleport or spawn veh/ped
// Account Contact Types
const VRR_CONTACT_NONE = 0;
const VRR_CONTACT_NEUTRAL = 1; // Contact is neutral. Used for general contacts with no special additional features
const VRR_CONTACT_FRIEND = 2; // Contact is a friend. Shows when they're online.
const VRR_CONTACT_BLOCKED = 3; // Contact is blocked. Prevents all communication to/from them except for RP
// Job Work Types (Currently Unused)
const VRR_JOBWORKTYPE_NONE = 0;
const VRR_JOBWORKTYPE_ROUTE = 1; // Jobs that use routes. Bus, trash collector, mail, etc
const VRR_JOBWORKTYPE_SELL = 2; // Jobs that sell items to other players and NPCs. Drugs, guns, etc
const VRR_JOBWORKTYPE_SERVICE = 3; // Services to other players and NPCs. Taxi ride, mechanic fix, etc
// Vehicle Seats
const VRR_VEHSEAT_DRIVER = 0;
const VRR_VEHSEAT_FRONTPASSENGER = 1;
const VRR_VEHSEAT_REARLEFTPASSENGER = 2;
const VRR_VEHSEAT_REARRIGHTPASSENGER = 3;
// Ban Types
const VRR_BANTYPE_NONE = 0;
const VRR_BANTYPE_ACCOUNT = 1;
const VRR_BANTYPE_SUBACCOUNT = 2;
const VRR_BANTYPE_IPADDRESS = 3;
const VRR_BANTYPE_SUBNET = 4;
// Blip Owner Types
const VRR_BLIP_NONE = 0;
const VRR_BLIP_JOB = 1;
const VRR_BLIP_BUSINESS_ENTRANCE = 2;
const VRR_BLIP_BUSINESS_EXIT = 3;
const VRR_BLIP_HOUSE_ENTRANCE = 4;
const VRR_BLIP_HOUSE_EXIT = 5;
const VRR_BLIP_EXIT = 6;
// Insurance Account Owner Types
const VRR_INS_ACCT_OWNER_NONE = 0; // None
const VRR_INS_ACCT_OWNER_PLAYER = 1; // Player owns insurance company
const VRR_INS_ACCT_OWNER_BIZ = 2; // Business owns insurance company
const VRR_INS_ACCT_OWNER_CLAN = 3; // Clan owns insurance company
// Insurance Account Entity Types
const VRR_INS_ACCT_ENTITY_NONE = 0; // None
const VRR_INS_ACCT_ENTITY_PLAYER_HEALTH = 1; // Health Insurance
const VRR_INS_ACCT_ENTITY_PLAYER_LIFE = 2; // Life Insurance
const VRR_INS_ACCT_ENTITY_VEH = 3; // Vehicle Insurance
const VRR_INS_ACCT_ENTITY_BIZ = 4; // Business Insurance
const VRR_INS_ACCT_ENTITY_HOUSE = 5; // House Insurance
// Insurance Account History Types
const VRR_INS_ACCT_HISTORY_NONE = 0; // None
const VRR_INS_ACCT_HISTORY_PLAYER_MEDICAL = 1; // Medical insurance was used (player disease/injury)
const VRR_INS_ACCT_HISTORY_PLAYER_DEATH = 2; // Life insurance was used (player death)
const VRR_INS_ACCT_HISTORY_VEH_DAMAGE = 3; // Vehicle was damaged, but not destroyed
const VRR_INS_ACCT_HISTORY_VEH_WRECKED = 4; // Vehicle was completely destroyed
const VRR_INS_ACCT_HISTORY_VEH_THEFT = 5; // Vehicle was stolen
const VRR_INS_ACCT_HISTORY_BIZ_DAMAGE = 6; // Business was damaged (broken items/window/door)
const VRR_INS_ACCT_HISTORY_BIZ_THEFT = 7; // Business was stolen from
const VRR_INS_ACCT_HISTORY_HOUSE_DAMAGE = 8; // House was damaged
const VRR_INS_ACCT_HISTORY_HOUSE_THEFT = 9; // House was stolen from
// Islands
const VRR_ISLAND_NONE = 0; // None
const VRR_ISLAND_PORTLAND = 0; // Portland Island
const VRR_ISLAND_STAUNTON = 1; // Staunton Island
const VRR_ISLAND_SHORESIDEVALE = 2; // Shoreside Vale
const VRR_ISLAND_VICEWEST = 0; // Western Island of VC
const VRR_ISLAND_VICEEAST = 1; // Eastern Island of VC
const VRR_ISLAND_LOSSANTOS = 0; // Los Santos
const VRR_ISLAND_LASVENTURAS = 1; // Las Venturas
const VRR_ISLAND_SANFIERRO = 2; // San Fierro
const VRR_ISLAND_REDCOUNTYNORTH = 4; // Red County North (spans all the way from Palamino/shore on the east east to border of Flint County on the west)
const VRR_ISLAND_BONECOUNTYNORTH = 5; // Bone County North (usually called Tierra Robada)
const VRR_ISLAND_BONECOUNTYSOUTH = 6; // Bone County South
// Item Owners
const VRR_ITEM_OWNER_NONE = 0; // None
const VRR_ITEM_OWNER_PLAYER = 1; // Item is in a player's inventory
const VRR_ITEM_OWNER_VEHTRUNK = 2; // Item is in a vehicle's trunk
const VRR_ITEM_OWNER_VEHDASH = 3; // Item is in a vehicle's glove compartment
const VRR_ITEM_OWNER_BIZFLOOR = 4; // Item is in the public area of a business (on the floor = ready to buy)
const VRR_ITEM_OWNER_BIZSTORAGE = 5; // Item is in a business's storage area (stock room)
const VRR_ITEM_OWNER_HOUSE = 6; // Item is in a house
const VRR_ITEM_OWNER_SAFE = 7; // Item is in a safe (safes can be anywhere)
const VRR_ITEM_OWNER_ITEM = 8; // Item is in another item (trashbag, briefcase, wallet, suitcase, crate/box, barrel, etc)
const VRR_ITEM_OWNER_GROUND = 9; // Item is on the ground
const VRR_ITEM_OWNER_JOBLOCKER = 10; // Item is in player's job locker
const VRR_ITEM_OWNER_LOCKER = 10; // Item is in player's locker
// Item Use Types
const VRR_ITEM_USETYPE_NONE = 0; // Has no effect
const VRR_ITEM_USETYPE_WEAPON = 1; // Equips weapon
const VRR_ITEM_USETYPE_AMMO_CLIP = 2; // Magazine for weapon. If in inventory, R will load it into gun
const VRR_ITEM_USETYPE_PHONE = 3; // Pulls out phone
const VRR_ITEM_USETYPE_GPS = 4; // Not sure how I want this to work yet
const VRR_ITEM_USETYPE_MAP = 5; // Shows minimap on HUD
const VRR_ITEM_USETYPE_SKIN = 6; // Changes skin (uses skin changer)
const VRR_ITEM_USETYPE_PEDPART = 7; // Changes ped part (clothing, skin, hair, etc) (UNUSED)
const VRR_ITEM_USETYPE_PEDPROP = 8; // Changes ped prop (watches, glasses, hats, etc) (UNUSED)
const VRR_ITEM_USETYPE_STORAGE = 9; // Shows stored items. Backpack, crate, briefcase, wallet, etc
const VRR_ITEM_USETYPE_VEHKEY = 10; // Locks/unlocks a vehicle and allows starting engine without hotwire
const VRR_ITEM_USETYPE_BIZKEY = 11; // Locks/unlocks a business
const VRR_ITEM_USETYPE_HOUSEKEY = 12; // Locks/unlocks a house
const VRR_ITEM_USETYPE_SEED = 13; // Plants a seed
const VRR_ITEM_USETYPE_WEED = 14; // Light drug effect (short term relief of addiction symptoms?)
const VRR_ITEM_USETYPE_COKE = 15; // Medium drug effect (medium term relief of addiction symptoms?)
const VRR_ITEM_USETYPE_METH = 16; // Heavy drug effect (extended term relief of addiction symptoms?)
const VRR_ITEM_USETYPE_CIGAR = 17; // Just for appearance. Makes people look cool I guess
const VRR_ITEM_USETYPE_WATER = 18; // Replenishes small amount of health
const VRR_ITEM_USETYPE_FOOD = 19; // Eat food. Replenishes a small amount of health
const VRR_ITEM_USETYPE_BEER = 20; // Subtle drunk effect. Replenishes small amount of health.
const VRR_ITEM_USETYPE_WINE = 21; // Moderate drunk effect. Replenishes moderate amount of health.
const VRR_ITEM_USETYPE_LIQUOR = 22; // Heavy drunk effect. Replenishes large amount of health.
const VRR_ITEM_USETYPE_COFFEE = 23; // Replenishes moderate amount of health.
const VRR_ITEM_USETYPE_AMMO_ROUND = 23; // Bullet. Loads into magazine. Not used at the moment
const VRR_ITEM_USETYPE_HANDCUFF = 24; //
const VRR_ITEM_USETYPE_ROPE = 25; //
const VRR_ITEM_USETYPE_BLINDFOLD = 26; //
const VRR_ITEM_USETYPE_TAZER = 27; //
const VRR_ITEM_USETYPE_ARMOUR = 28; //
const VRR_ITEM_USETYPE_HEALTH = 29; //
const VRR_ITEM_USETYPE_AED = 30; //
const VRR_ITEM_USETYPE_WALKIETALKIE = 31; //
const VRR_ITEM_USETYPE_BOOMBOX = 32; //
const VRR_ITEM_USETYPE_EARBUDS = 33; //
const VRR_ITEM_USETYPE_BADGE = 34; //
const VRR_ITEM_USETYPE_DRINK = 35; // Drinkable item. Action output shows "Player_Name drinks some (drink name)"
const VRR_ITEM_USETYPE_EXTINGUISHER = 36; // Extinguisher item. Allows putting out fires
const VRR_ITEM_USETYPE_SPRAYPAINT = 37; // Spraypaint item. Allows spraying custom clan tags on walls
const VRR_ITEM_USETYPE_PEPPERSPRAY = 38; // Pepper spray item. Incapacitates nearby player
const VRR_ITEM_USETYPE_FLASHLIGHT = 39; // Flashlight item. Unusable for now, but plan to cast a custom light beam
const VRR_ITEM_USETYPE_AIRPLANETICKET = 40; // Airplane ticket. Allows a character to move to another server
const VRR_ITEM_USETYPE_TRAINTICKET = 41; // Train ticket. Allows a character to move to another server
const VRR_ITEM_USETYPE_VEHUPGRADE_PART = 42; // Vehicle update part item. Allows adding custom parts like spoilers, side skirts, roof scoops, etc
const VRR_ITEM_USETYPE_VEHTIRE = 43; // Vehicle tire item. Allows changing the tire/rim types
const VRR_ITEM_USETYPE_FUELCAN = 44; // Fuel can item. Allows refueling of a nearby vehicle anywhere
const VRR_ITEM_USETYPE_VEHCOLOUR = 45; // Vehicle colour item. Changes primary and secondary vehicle colours
const VRR_ITEM_USETYPE_VEHLIVERY = 46; // Vehicle livery/paintjob item. Applies decals and special paint jobs
const VRR_ITEM_USETYPE_VEHREPAIR = 47; // Vehicle repair item. Much longer use time
const VRR_ITEM_USETYPE_SMOKEDRUG = 48; // Smokable drug. Action output shows "Player_Name smokes some (drug)"
const VRR_ITEM_USETYPE_SNORTDRUG = 49; // Snortable drug. Action output shows "Player_Name snorts some (drug)"
const VRR_ITEM_USETYPE_PLANT = 50; // Plantable item. Pot plants, coke plants, etc
const VRR_ITEM_USETYPE_MEGAPHONE = 51; // Megaphone item. Allows shouting over greater distances. Also called a bullhorn
const VRR_ITEM_USETYPE_INJECTDRUG = 52; // Injectable drug. Action output shows "Player_Name injects some (drug)"
const VRR_ITEM_USETYPE_ALCOHOL = 53; // Alcohol. Applies an intoxication/drunkness effect
// Item Drop Types
const VRR_ITEM_DROPTYPE_NONE = 0; // Can't be dropped
const VRR_ITEM_DROPTYPE_OBJECT = 1; // Drops as an object on the ground
const VRR_ITEM_DROPTYPE_PICKUP = 2; // Drops as a pickup
const VRR_ITEM_DROPTYPE_OBJECTLIGHT = 3; // Object that produces an area light effect (lamp, flashlight, etc)
const VRR_ITEM_DROPTYPE_DESTROY = 4; // Will destroy the item on drop (keys mostly but for any tiny object)
const VRR_ITEM_DROPTYPE_OBJECTSTACK = 5; // Stackable objects (crates and such). Will sit on top of closest other stackable
// Forensic Types
const VRR_FORENSICS_NONE = 0;
const VRR_FORENSICS_BULLET = 1; // Bullet. The actual tip that hits a target. Has rifling and ballistics information of the weapon.
const VRR_FORENSICS_BLOOD = 2; // Blood. Automatically applied to ground and bullets that hit when somebody is shot
const VRR_FORENSICS_BODY = 3; // Body. A dead body lol
const VRR_FORENSICS_HAIR = 4; // Hair. Automatically applied to
const VRR_FORENSICS_SWEAT = 5; // Sweat. Automatically applied to clothing when worn
const VRR_FORENSICS_SALIVA = 6; // Saliva. Automatically applied to drinks when drank
const VRR_FORENSICS_BULLETCASINGS = 7; // Bullet casings. Automatically dropped when fired from a weapon except when used in a vehicle (driveby)
// Account Authentication Methods
const VRR_ACCT_AUTHMETHOD_NONE = 0; // None
const VRR_ACCT_AUTHMETHOD_EMAIL = 1; // Email
const VRR_ACCT_AUTHMETHOD_PHONENUM = 2; // Phone number
const VRR_ACCT_AUTHMETHOD_2FA = 3; // Two factor authentication app (authy, google authenticator, etc)
const VRR_ACCT_AUTHMETHOD_PEBBLE = 4; // Pebble watch (this one's for Vortrex but anybody with a Pebble can use)
const VRR_ACCT_AUTHMETHOD_PHONEAPP = 5; // The Android/iOS companion app (will initially be a web based thing until I can get the apps created)
// Police Patrol Types
const VRR_PATROLTYPE_NONE = 0; // None
const VRR_PATROLTYPE_FOOT = 1; // Foot patrol. Officer takes a vehicle to get to their designated area and then walks a beat. More common in LC games
const VRR_PATROLTYPE_VEHICLE = 2; // Vehicle patrol. More common in VC/LS/SF/LV cities.
// Job Route States
const VRR_JOBROUTESTATE_NONE = 0; // None
const VRR_JOBROUTESTATE_INPROGRESS = 1; // Route is in progress. Player is in between stops but not at the last one.
const VRR_JOBROUTESTATE_LASTSTOP = 2; // Player is heading to the last stop on the route
const VRR_JOBROUTESTATE_PAUSED = 3; // Route is paused for some reason. For police, this could be player accepted callout and once finished, patrol route will resume
const VRR_JOBROUTESTATE_ATSTOP = 4; // For bus/trash stops that freeze player, this is the state when they're at one
// Item Occupied States
const VRR_ITEM_ACTION_NONE = 0; // None
const VRR_ITEM_ACTION_USE = 1; // Using item
const VRR_ITEM_ACTION_PICKUP = 2; // Picking up item
const VRR_ITEM_ACTION_DROP = 3; // Dropping item
const VRR_ITEM_ACTION_SWITCH = 4; // Switching item
const VRR_ITEM_ACTION_PUT = 5; // Putting item (into trunk, dash, crate, etc)
const VRR_ITEM_ACTION_TAKE = 6; // Taking item (from trunk, dash, crate, etc)
// Ped States
const VRR_PEDSTATE_NONE = 2; // None
const VRR_PEDSTATE_READY = 1; // Ready
const VRR_PEDSTATE_DRIVER = 2; // Driving a vehicle
const VRR_PEDSTATE_PASSENGER = 3; // In a vehicle as passenger
const VRR_PEDSTATE_DEAD = 4; // Dead
const VRR_PEDSTATE_ENTERINGPROPERTY = 5; // Entering a property
const VRR_PEDSTATE_EXITINGPROPERTY = 6; // Exiting a property
const VRR_PEDSTATE_ENTERINGVEHICLE = 7; // Entering a vehicle
const VRR_PEDSTATE_EXITINGVEHICLE = 8; // Exiting a vehicle
const VRR_PEDSTATE_BINDED = 9; // Binded by rope or handcuffs
const VRR_PEDSTATE_TAZED = 10; // Under incapacitating effect of tazer
const VRR_PEDSTATE_INTRUNK = 11; // In vehicle trunk
const VRR_PEDSTATE_INITEM = 12; // In item (crate, box, etc)
const VRR_PEDSTATE_HANDSUP = 13; // Has hands up (surrendering)
const VRR_PEDSTATE_SPAWNING = 14; // Spawning
// Two-Factor Authentication States
const VRR_2FA_STATE_NONE = 0; // None
const VRR_2FA_STATE_CODEINPUT = 1; // Waiting on player to enter code to play
const VRR_2FA_STATE_SETUP_CODETOAPP = 2; // Providing player with a code to put in their auth app
const VRR_2FA_STATE_SETUP_CODEFROMAPP = 3; // Waiting on player to enter code from auth app to set up
// Reset Password States
const VRR_RESETPASS_STATE_NONE = 0; // None
const VRR_RESETPASS_STATE_CODEINPUT = 1; // Waiting on player to enter code sent via email
const VRR_RESETPASS_STATE_SETPASS = 2; // Waiting on player to enter new password
// NPC Trigger Condition Match Types
const VRR_NPC_COND_MATCH_NONE = 0; // None (invalid)
const VRR_NPC_COND_MATCH_EQ = 1; // Must be equal to
const VRR_NPC_COND_MATCH_GT = 2; // Must be greater than
const VRR_NPC_COND_MATCH_LT = 3; // Must be less than
const VRR_NPC_COND_MATCH_GTEQ = 4; // Must be greater than or equal to
const VRR_NPC_COND_MATCH_LTEQ = 5; // Must be less than or equal to
const VRR_NPC_COND_MATCH_CONTAINS = 6; // Must contain string (case insensitive)
const VRR_NPC_COND_MATCH_CONTAINS_CASE = 7; // Must contain string (case sensitive)
const VRR_NPC_COND_MATCH_EXACT = 8; // Must match string exactly (case insensitive)
const VRR_NPC_COND_MATCH_EXACT_CASE = 9; // Must match string exactly (case insensitive)
// Business Types
const VRR_BIZ_TYPE_NONE = 0; // None (invalid)
const VRR_BIZ_TYPE_NORMAL = 1; // Normal business (sells items)
const VRR_BIZ_TYPE_BANK = 2; // Bank
const VRR_BIZ_TYPE_PUBLIC = 3; // Public business (Government, public service, etc)
// Return-To types (for when a player is teleported)
const VRR_RETURNTO_TYPE_NONE = 0; // "Return to" data is invalid
const VRR_RETURNTO_TYPE_ADMINGET = 1; // "Return to" data is from admin teleporting
const VRR_RETURNTO_TYPE_SKINSELECT = 2; // "Return to" data is from skin select
// Card Game Types
const VRR_DECKCARD_GAME_NONE = 0; // None (invalid)
const VRR_DECKCARD_GAME_BLACKJACK = 1; // Blackjack
const VRR_DECKCARD_GAME_TEXASHOLDEM = 2; // Texas Hold-em
const VRR_DECKCARD_GAME_FIVECARDDRAW = 3; // Five Card Draw
const VRR_DECKCARD_GAME_FIVECARDSTUD = 4; // Five Card Stud
const VRR_DECKCARD_GAME_HIGHLOW = 5; // High-Low (Also known as War)
// Card Suits
const VRR_DECKCARD_SUIT_NONE = 0; // None (invalid)
const VRR_DECKCARD_SUIT_SPADE = 1; // Spades
const VRR_DECKCARD_SUIT_CLUB = 2; // Clubs
const VRR_DECKCARD_SUIT_HEART = 3; // Hearts
const VRR_DECKCARD_SUIT_DIAMOND = 4; // Diamonds
// GPS State Types
const VRR_GPS_TYPE_NONE = 0; // None (invalid)
const VRR_GPS_TYPE_BUSINESS = 1; // Business
const VRR_GPS_TYPE_POLICE = 2; // Police Station
const VRR_GPS_TYPE_HOSPITAL = 3; // Hospital
const VRR_GPS_TYPE_JOB = 4; // Job
const VRR_GPS_TYPE_GAMELOC = 5; // Game Location

22
scripts/server/crime.js Normal file
View File

@@ -0,0 +1,22 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: crime.js
// DESC: Provides crime data structures, functions, and operations
// TYPE: Server (JavaScript)
// ===========================================================================
/**
* @class Representing a crime's data. Loaded and saved in the database
*/
class CrimeData {
constructor(suspectId, crimeType, reporterId = 0) {
this.crimeType = crimeType;
this.suspectId = suspectId;
this.reporterId = reporterId;
this.whenCommitted = 0;
this.whenReported = 0;
this.databaseId = 0;
}
};

View File

@@ -254,7 +254,7 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
vehicle = client.player.vehicle; vehicle = client.player.vehicle;
} }
if(!getVehicleData(vehicle)) { if(getVehicleData(vehicle) == false) {
return false; return false;
} }

View File

@@ -7,8 +7,6 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
// ===========================================================================
function initFishingScript() { function initFishingScript() {
logToConsole(LOG_INFO, "[VRR.Fishing]: Initializing fishing script ..."); logToConsole(LOG_INFO, "[VRR.Fishing]: Initializing fishing script ...");
logToConsole(LOG_INFO, "[VRR.Fishing]: Fishing script initialized successfully!"); logToConsole(LOG_INFO, "[VRR.Fishing]: Fishing script initialized successfully!");

View File

@@ -0,0 +1,20 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: forensics.js
// DESC: Provides forensics functions and commands (bullet casings, blood, etc)
// TYPE: Server (JavaScript)
// ===========================================================================
// Forensic Types
const VRR_FORENSICS_NONE = 0;
const VRR_FORENSICS_BULLET = 1; // Bullet. The actual tip that hits a target. Has rifling and ballistics information of the weapon.
const VRR_FORENSICS_BLOOD = 2; // Blood. Automatically applied to ground and bullets that hit when somebody is shot
const VRR_FORENSICS_BODY = 3; // Body. A dead body lol
const VRR_FORENSICS_HAIR = 4; // Hair. Automatically applied to
const VRR_FORENSICS_SWEAT = 5; // Sweat. Automatically applied to clothing when worn
const VRR_FORENSICS_SALIVA = 6; // Saliva. Automatically applied to drinks when drank
const VRR_FORENSICS_BULLETCASINGS = 7; // Bullet casings. Automatically dropped when fired from a weapon except when used in a vehicle (driveby)
// ===========================================================================

View File

@@ -7,6 +7,18 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
// Gate Owner Types
const VRR_GATEOWNER_NONE = 0; // Not owned
const VRR_GATEOWNER_PLAYER = 1; // Owner is a player (character/subaccount)
const VRR_GATEOWNER_JOB = 2; // Owned by a job
const VRR_GATEOWNER_CLAN = 3; // Owned by a clan
const VRR_GATEOWNER_FACTION = 4; // Owned by a faction
const VRR_GATEOWNER_PUBLIC = 5; // Public gate. Technically not owned. This probably won't be used.
const VRR_GATEOWNER_BUSINESS = 6; // Owned by a business. Back lots, unloading areas, and other stuff like that
const VRR_GATEOWNER_HOUSE = 7; // Owned by a house. Like for mansions with closed private areas.
// ===========================================================================
function doesPlayerHaveGateKeys(client, vehicle) { function doesPlayerHaveGateKeys(client, vehicle) {
let gateData = getGateData(vehicle); let gateData = getGateData(vehicle);

148
scripts/server/gps.js Normal file
View File

@@ -0,0 +1,148 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: gps.js
// DESC: Provides GPS functions and commands
// TYPE: Server (JavaScript)
// ===========================================================================
// GPS State Types
const VRR_GPS_TYPE_NONE = 0; // None (invalid)
const VRR_GPS_TYPE_BUSINESS = 1; // Business
const VRR_GPS_TYPE_POLICE = 2; // Police Station
const VRR_GPS_TYPE_HOSPITAL = 3; // Hospital
const VRR_GPS_TYPE_JOB = 4; // Job
const VRR_GPS_TYPE_GAMELOC = 5; // Game Location
// ===========================================================================
function gpsCommand(command, params, client) {
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBusinessList")));
let locationType = VRR_GPS_TYPE_NONE;
let useType = VRR_ITEM_USETYPE_NONE;
let blipColour = "white";
switch(toLowerCase(params)) {
case "police":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_POLICE;
break;
case "hospital":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_HOSPITAL;
break;
case "job":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_JOB;
break;
case "skin":
case "skins":
case "clothes":
case "player":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_BUSINESS;
useType = VRR_ITEM_USETYPE_SKIN;
break;
case "gun":
case "guns":
case "weapon":
case "weapons":
case "wep":
case "weps":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_BUSINESS;
useType = VRR_ITEM_USETYPE_WEAPON;
break;
case "food":
case "eat":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_BUSINESS;
useType = VRR_ITEM_USETYPE_FOOD;
break;
case "drink":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_BUSINESS;
useType = VRR_ITEM_USETYPE_DRINK;
break;
case "alcohol":
case "booze":
case "bar":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_BUSINESS;
useType = VRR_ITEM_USETYPE_ALCOHOL;
break;
case "repair":
case "carrepair":
case "vehrepair":
case "spray":
case "fix":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_BUSINESS;
useType = VRR_ITEM_USETYPE_VEHREPAIR;
break;
case "vehiclecolour":
case "vehcolour":
case "carcolour":
case "colour":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_BUSINESS;
useType = VRR_ITEM_USETYPE_VEHCOLOUR;
break;
default: {
let itemTypeId = getItemTypeFromParams(params);
if(getItemTypeData(itemTypeId) != false) {
locationType = VRR_GPS_TYPE_BUSINESS;
blipColour = "businessBlue";
useType = getItemTypeData(itemTypeId).useType;
} else {
let gameLocationId = getGameLocationFromParams(params);
if(gameLocationId != false) {
position = getGameConfig().locations[getServerGame()][gameLocationId][1]
}
}
}
}
if(locationType == VRR_GPS_TYPE_NONE) {
messagePlayerError(client, getLocaleString(client, "InvalidGPSLocation"));
return false;
}
if(locationType == VRR_GPS_TYPE_BUSINESS) {
let businessId = getClosestBusinessWithBuyableItemOfUseType(useType);
if(!businessId) {
messagePlayerError(client, getLocaleString(client, "NoBusinessWithItemType"));
return false;
}
if(!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "NoBusinessWithItemType"));
return false;
}
hideAllBlipsForPlayerGPS(client);
blinkGenericGPSBlipForPlayer(client, getBusinessData(businessId).entrancePosition, getBusinessData(businessId).entranceBlipModel, getColourByType(blipColour), 10);
messagePlayerSuccess(client, "Look for the blinking icon on your mini map");
}
if(locationType == VRR_GPS_TYPE_GAMELOC) {
hideAllBlipsForPlayerGPS(client);
blinkGenericGPSBlipForPlayer(client, position, 0, getColourByType(blipColour), 10);
messagePlayerSuccess(client, "Look for the blinking icon on your mini map");
return true;
}
}
// ===========================================================================

View File

@@ -7,6 +7,13 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
// Prompts (used for client GUI prompt responses)
const VRR_PROMPT_NONE = 0;
const VRR_PROMPT_CREATEFIRSTCHAR = 1;
const VRR_PROMPT_BIZORDER = 2;
// ===========================================================================
function initGUIScript() { function initGUIScript() {
logToConsole(LOG_INFO, "[VRR.GUI]: Initializing GUI script ..."); logToConsole(LOG_INFO, "[VRR.GUI]: Initializing GUI script ...");
logToConsole(LOG_INFO, "[VRR.GUI]: GUI script initialized successfully!"); logToConsole(LOG_INFO, "[VRR.GUI]: GUI script initialized successfully!");

View File

@@ -7,6 +7,159 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
// House Location Types
const VRR_HOUSELOC_NONE = 0; // None
const VRR_HOUSELOC_GATE = 1; // Center of any moveable gate that belongs to the house
const VRR_HOUSELOC_GARAGE = 2; // Location for garage (pos1 = outside, pos2 = inside). Use pos to teleport or spawn veh/ped
// ===========================================================================
// House Owner Types
const VRR_HOUSEOWNER_NONE = 0; // Not owned
const VRR_HOUSEOWNER_PLAYER = 1; // Owner is a player (character/subaccount)
const VRR_HOUSEOWNER_JOB = 2; // Owned by a job
const VRR_HOUSEOWNER_CLAN = 3; // Owned by a clan
const VRR_HOUSEOWNER_FACTION = 4; // Owned by a faction
const VRR_HOUSEOWNER_PUBLIC = 5; // Is a public house. Technically not owned. This probably won't be used.
// ===========================================================================
/**
* @class Representing a house's data. Loaded and saved in the database
*/
class HouseData {
constructor(dbAssoc = false) {
this.databaseId = 0
this.description = "";
this.ownerType = VRR_HOUSEOWNER_NONE;
this.ownerId = 0;
this.buyPrice = 0;
this.rentPrice = 0;
this.renter = 0;
this.locked = false;
this.hasInterior = false;
this.index = -1;
this.needsSaved = false;
this.interiorLights = true;
this.itemCache = [];
this.locations = [];
//this.gameScripts = [];
this.entrancePosition = false;
this.entranceRotation = 0.0;
this.entranceInterior = 0;
this.entranceDimension = 0;
this.entrancePickupModel = -1;
this.entranceBlipModel = -1;
this.entrancePickup = null;
this.entranceBlip = null;
this.exitPosition = false;
this.exitRotation = 0.0;
this.exitInterior = 0;
this.exitDimension = -1;
this.exitPickupModel = -1;
this.exitBlipModel = -1;
this.exitPickup = null;
this.exitBlip = null;
this.streamingRadioStation = -1;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["house_id"]);
this.description = toString(dbAssoc["house_description"]);
this.ownerType = toInteger(dbAssoc["house_owner_type"]);
this.ownerId = toInteger(dbAssoc["house_owner_id"]);
this.buyPrice = toInteger(dbAssoc["house_buy_price"]);
this.rentPrice = toInteger(dbAssoc["house_rent_price"]);
this.renter = toInteger(dbAssoc["house_renter"]);
this.locked = intToBool(toInteger(dbAssoc["house_locked"]));
this.hasInterior = intToBool(toInteger(dbAssoc["house_has_interior"]));
this.interiorLights = intToBool(toInteger(dbAssoc["house_interior_lights"]));
this.entrancePosition = toVector3(toFloat(dbAssoc["house_entrance_pos_x"]), toFloat(dbAssoc["house_entrance_pos_y"]), toFloat(dbAssoc["house_entrance_pos_z"]));
this.entranceRotation = toFloat(dbAssoc["house_entrance_rot_z"]);
this.entranceInterior = toInteger(dbAssoc["house_entrance_int"]);
this.entranceDimension = toInteger(dbAssoc["house_entrance_vw"]);
this.entrancePickupModel = toInteger(dbAssoc["house_entrance_pickup"]);
this.entranceBlipModel = toInteger(dbAssoc["house_entrance_blip"]);
this.exitPosition = toVector3(toFloat(dbAssoc["house_exit_pos_x"]), toFloat(dbAssoc["house_exit_pos_y"]), toFloat(dbAssoc["house_exit_pos_z"]));
this.exitRotation = toFloat(dbAssoc["house_exit_rot_z"]);
this.exitInterior = toInteger(dbAssoc["house_exit_int"]);
this.exitDimension = toInteger(dbAssoc["house_exit_vw"]);
this.exitPickupModel = toInteger(dbAssoc["house_exit_pickup"]);
this.exitBlipModel = toInteger(dbAssoc["house_exit_blip"]);
}
}
};
// ===========================================================================
/**
* @class Representing a houses's location data. Multiple can be used for a single house. Used for things like doors, garage entry/exit/vehspawn, gates, etc. Loaded and saved in the database
*/
class HouseLocationData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.type = 0;
this.house = 0;
this.enabled = false;
this.index = -1;
this.houseIndex = -1;
this.needsSaved = false;
this.position = toVector3(0.0, 0.0, 0.0);
this.interior = 0;
this.dimension = 0;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["house_loc_id"]);
this.name = toString(dbAssoc["house_loc_name"]);
this.type = toInteger(dbAssoc["house_loc_type"]);
this.house = toInteger(dbAssoc["house_loc_house"]);
this.enabled = intToBool(toInteger(dbAssoc["house_loc_enabled"]));
this.index = -1;
this.position = toVector3(toFloat(dbAssoc["house_loc_pos_x"]), toFloat(dbAssoc["house_loc_pos_y"]), toFloat(dbAssoc["house_loc_pos_z"]));
this.interior = toInteger(dbAssoc["house_loc_int"]);
this.dimension = toInteger(dbAssoc["house_loc_vw"]);
}
};
//saveToDatabase = () => {
// saveHouseLocationToDatabase(this.houseIndex, this.index);
//}
};
// ===========================================================================
/**
* @class Representing a house's game scripts. Multiple can be used for a single house
*/
class HouseGameScriptData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.business = 0;
this.state = false;
this.index = -1;
this.houseIndex = -1;
this.needsSaved = false;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["house_script_id"]);
this.name = toString(dbAssoc["house_script_name"]);
this.state = toInteger(dbAssoc["house_script_state"]);
this.business = toInteger(dbAssoc["house_script_biz"]);
}
}
};
// ===========================================================================
function initHouseScript() { function initHouseScript() {
logToConsole(LOG_INFO, "[VRR.House]: Initializing house script ..."); logToConsole(LOG_INFO, "[VRR.House]: Initializing house script ...");
getServerData().houses = loadHousesFromDatabase(); getServerData().houses = loadHousesFromDatabase();

View File

@@ -0,0 +1,40 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: insurance.js
// DESC: Provides insurance commands, functions, and usage
// TYPE: Server (JavaScript)
// ===========================================================================
// Insurance Account Owner Types
const VRR_INS_ACCT_OWNER_NONE = 0; // None
const VRR_INS_ACCT_OWNER_PLAYER = 1; // Player owns insurance company
const VRR_INS_ACCT_OWNER_BIZ = 2; // Business owns insurance company
const VRR_INS_ACCT_OWNER_CLAN = 3; // Clan owns insurance company
// ===========================================================================
// Insurance Account Entity Types
const VRR_INS_ACCT_ENTITY_NONE = 0; // None
const VRR_INS_ACCT_ENTITY_PLAYER_HEALTH = 1; // Health Insurance
const VRR_INS_ACCT_ENTITY_PLAYER_LIFE = 2; // Life Insurance
const VRR_INS_ACCT_ENTITY_VEH = 3; // Vehicle Insurance
const VRR_INS_ACCT_ENTITY_BIZ = 4; // Business Insurance
const VRR_INS_ACCT_ENTITY_HOUSE = 5; // House Insurance
// ===========================================================================
// Insurance Account History Types
const VRR_INS_ACCT_HISTORY_NONE = 0; // None
const VRR_INS_ACCT_HISTORY_PLAYER_MEDICAL = 1; // Medical insurance was used (player disease/injury)
const VRR_INS_ACCT_HISTORY_PLAYER_DEATH = 2; // Life insurance was used (player death)
const VRR_INS_ACCT_HISTORY_VEH_DAMAGE = 3; // Vehicle was damaged, but not destroyed
const VRR_INS_ACCT_HISTORY_VEH_WRECKED = 4; // Vehicle was completely destroyed
const VRR_INS_ACCT_HISTORY_VEH_THEFT = 5; // Vehicle was stolen
const VRR_INS_ACCT_HISTORY_BIZ_DAMAGE = 6; // Business was damaged (broken items/window/door)
const VRR_INS_ACCT_HISTORY_BIZ_THEFT = 7; // Business was stolen from
const VRR_INS_ACCT_HISTORY_HOUSE_DAMAGE = 8; // House was damaged
const VRR_INS_ACCT_HISTORY_HOUSE_THEFT = 9; // House was stolen from
// ===========================================================================

View File

@@ -7,6 +7,229 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
// Item Owners
const VRR_ITEM_OWNER_NONE = 0; // None
const VRR_ITEM_OWNER_PLAYER = 1; // Item is in a player's inventory
const VRR_ITEM_OWNER_VEHTRUNK = 2; // Item is in a vehicle's trunk
const VRR_ITEM_OWNER_VEHDASH = 3; // Item is in a vehicle's glove compartment
const VRR_ITEM_OWNER_BIZFLOOR = 4; // Item is in the public area of a business (on the floor = ready to buy)
const VRR_ITEM_OWNER_BIZSTORAGE = 5; // Item is in a business's storage area (stock room)
const VRR_ITEM_OWNER_HOUSE = 6; // Item is in a house
const VRR_ITEM_OWNER_SAFE = 7; // Item is in a safe (safes can be anywhere)
const VRR_ITEM_OWNER_ITEM = 8; // Item is in another item (trashbag, briefcase, wallet, suitcase, crate/box, barrel, etc)
const VRR_ITEM_OWNER_GROUND = 9; // Item is on the ground
const VRR_ITEM_OWNER_JOBLOCKER = 10; // Item is in player's job locker
const VRR_ITEM_OWNER_LOCKER = 10; // Item is in player's locker
// ===========================================================================
// Item Use Types
const VRR_ITEM_USETYPE_NONE = 0; // Has no effect
const VRR_ITEM_USETYPE_WEAPON = 1; // Equips weapon
const VRR_ITEM_USETYPE_AMMO_CLIP = 2; // Magazine for weapon. If in inventory, R will load it into gun
const VRR_ITEM_USETYPE_PHONE = 3; // Pulls out phone
const VRR_ITEM_USETYPE_GPS = 4; // Not sure how I want this to work yet
const VRR_ITEM_USETYPE_MAP = 5; // Shows minimap on HUD
const VRR_ITEM_USETYPE_SKIN = 6; // Changes skin (uses skin changer)
const VRR_ITEM_USETYPE_PEDPART = 7; // Changes ped part (clothing, skin, hair, etc) (UNUSED)
const VRR_ITEM_USETYPE_PEDPROP = 8; // Changes ped prop (watches, glasses, hats, etc) (UNUSED)
const VRR_ITEM_USETYPE_STORAGE = 9; // Shows stored items. Backpack, crate, briefcase, wallet, etc
const VRR_ITEM_USETYPE_VEHKEY = 10; // Locks/unlocks a vehicle and allows starting engine without hotwire
const VRR_ITEM_USETYPE_BIZKEY = 11; // Locks/unlocks a business
const VRR_ITEM_USETYPE_HOUSEKEY = 12; // Locks/unlocks a house
const VRR_ITEM_USETYPE_SEED = 13; // Plants a seed
const VRR_ITEM_USETYPE_WEED = 14; // Light drug effect (short term relief of addiction symptoms?)
const VRR_ITEM_USETYPE_COKE = 15; // Medium drug effect (medium term relief of addiction symptoms?)
const VRR_ITEM_USETYPE_METH = 16; // Heavy drug effect (extended term relief of addiction symptoms?)
const VRR_ITEM_USETYPE_CIGAR = 17; // Just for appearance. Makes people look cool I guess
const VRR_ITEM_USETYPE_WATER = 18; // Replenishes small amount of health
const VRR_ITEM_USETYPE_FOOD = 19; // Eat food. Replenishes a small amount of health
const VRR_ITEM_USETYPE_BEER = 20; // Subtle drunk effect. Replenishes small amount of health.
const VRR_ITEM_USETYPE_WINE = 21; // Moderate drunk effect. Replenishes moderate amount of health.
const VRR_ITEM_USETYPE_LIQUOR = 22; // Heavy drunk effect. Replenishes large amount of health.
const VRR_ITEM_USETYPE_COFFEE = 23; // Replenishes moderate amount of health.
const VRR_ITEM_USETYPE_AMMO_ROUND = 23; // Bullet. Loads into magazine. Not used at the moment
const VRR_ITEM_USETYPE_HANDCUFF = 24; //
const VRR_ITEM_USETYPE_ROPE = 25; //
const VRR_ITEM_USETYPE_BLINDFOLD = 26; //
const VRR_ITEM_USETYPE_TAZER = 27; //
const VRR_ITEM_USETYPE_ARMOUR = 28; //
const VRR_ITEM_USETYPE_HEALTH = 29; //
const VRR_ITEM_USETYPE_AED = 30; //
const VRR_ITEM_USETYPE_WALKIETALKIE = 31; //
const VRR_ITEM_USETYPE_BOOMBOX = 32; //
const VRR_ITEM_USETYPE_EARBUDS = 33; //
const VRR_ITEM_USETYPE_BADGE = 34; //
const VRR_ITEM_USETYPE_DRINK = 35; // Drinkable item. Action output shows "Player_Name drinks some (drink name)"
const VRR_ITEM_USETYPE_EXTINGUISHER = 36; // Extinguisher item. Allows putting out fires
const VRR_ITEM_USETYPE_SPRAYPAINT = 37; // Spraypaint item. Allows spraying custom clan tags on walls
const VRR_ITEM_USETYPE_PEPPERSPRAY = 38; // Pepper spray item. Incapacitates nearby player
const VRR_ITEM_USETYPE_FLASHLIGHT = 39; // Flashlight item. Unusable for now, but plan to cast a custom light beam
const VRR_ITEM_USETYPE_AIRPLANETICKET = 40; // Airplane ticket. Allows a character to move to another server
const VRR_ITEM_USETYPE_TRAINTICKET = 41; // Train ticket. Allows a character to move to another server
const VRR_ITEM_USETYPE_VEHUPGRADE_PART = 42; // Vehicle update part item. Allows adding custom parts like spoilers, side skirts, roof scoops, etc
const VRR_ITEM_USETYPE_VEHTIRE = 43; // Vehicle tire item. Allows changing the tire/rim types
const VRR_ITEM_USETYPE_FUELCAN = 44; // Fuel can item. Allows refueling of a nearby vehicle anywhere
const VRR_ITEM_USETYPE_VEHCOLOUR = 45; // Vehicle colour item. Changes primary and secondary vehicle colours
const VRR_ITEM_USETYPE_VEHLIVERY = 46; // Vehicle livery/paintjob item. Applies decals and special paint jobs
const VRR_ITEM_USETYPE_VEHREPAIR = 47; // Vehicle repair item. Much longer use time
const VRR_ITEM_USETYPE_SMOKEDRUG = 48; // Smokable drug. Action output shows "Player_Name smokes some (drug)"
const VRR_ITEM_USETYPE_SNORTDRUG = 49; // Snortable drug. Action output shows "Player_Name snorts some (drug)"
const VRR_ITEM_USETYPE_PLANT = 50; // Plantable item. Pot plants, coke plants, etc
const VRR_ITEM_USETYPE_MEGAPHONE = 51; // Megaphone item. Allows shouting over greater distances. Also called a bullhorn
const VRR_ITEM_USETYPE_INJECTDRUG = 52; // Injectable drug. Action output shows "Player_Name injects some (drug)"
const VRR_ITEM_USETYPE_ALCOHOL = 53; // Alcohol. Applies an intoxication/drunkness effect
// ===========================================================================
// Item Drop Types
const VRR_ITEM_DROPTYPE_NONE = 0; // Can't be dropped
const VRR_ITEM_DROPTYPE_OBJECT = 1; // Drops as an object on the ground
const VRR_ITEM_DROPTYPE_PICKUP = 2; // Drops as a pickup
const VRR_ITEM_DROPTYPE_OBJECTLIGHT = 3; // Object that produces an area light effect (lamp, flashlight, etc)
const VRR_ITEM_DROPTYPE_DESTROY = 4; // Will destroy the item on drop (keys mostly but for any tiny object)
const VRR_ITEM_DROPTYPE_OBJECTSTACK = 5; // Stackable objects (crates and such). Will sit on top of closest other stackable
// ===========================================================================
// Item Occupied States
const VRR_ITEM_ACTION_NONE = 0; // None
const VRR_ITEM_ACTION_USE = 1; // Using item
const VRR_ITEM_ACTION_PICKUP = 2; // Picking up item
const VRR_ITEM_ACTION_DROP = 3; // Dropping item
const VRR_ITEM_ACTION_SWITCH = 4; // Switching item
const VRR_ITEM_ACTION_PUT = 5; // Putting item (into trunk, dash, crate, etc)
const VRR_ITEM_ACTION_TAKE = 6; // Taking item (from trunk, dash, crate, etc)
// ===========================================================================
class ItemData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.index = 0;
this.itemTypeIndex = 0;
this.itemType = 0;
this.ownerType = VRR_ITEM_OWNER_NONE;
this.ownerId = 0;
this.ownerIndex = -1;
this.position = toVector3(0.0, 0.0, 0.0);
this.interior = 0;
this.dimension = 0;
this.object = null;
this.buyPrice = 0;
this.needsSaved = false;
this.amount = 0;
this.value = 0;
this.enabled = false;
this.extra = false;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["item_id"]);
this.index = 0;
this.itemTypeIndex = 0;
this.itemType = toInteger(dbAssoc["item_type"]);
this.ownerType = toInteger(dbAssoc["item_owner_type"]);;
this.ownerId = toInteger(dbAssoc["item_owner_id"]);
this.position = toVector3(toFloat(dbAssoc["item_pos_x"]), toFloat(dbAssoc["item_pos_y"]), toFloat(dbAssoc["item_pos_z"]));
this.interior = toInteger(dbAssoc["item_int"]);
this.dimension = toInteger(dbAssoc["item_vw"]);
this.buyPrice = toInteger(dbAssoc["item_buy_price"]);
this.amount = toInteger(dbAssoc["item_amount"]);
this.value = toInteger(dbAssoc["item_value"]);
this.enabled = intToBool(toInteger(dbAssoc["item_enabled"]));
}
}
};
// ===========================================================================
class ItemTypeData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.serverId = 0;
this.index = 0;
this.name = "Unknown";
this.enabled = false;
this.useType = VRR_ITEM_USETYPE_NONE;
this.useId = 0;
this.useValue = 0;
this.maxValue = 0;
this.dropType = VRR_ITEM_DROPTYPE_NONE;
this.useId = 0;
this.dropPosition = toVector3(0.0, 0.0, 0.0);
this.dropRotation = toVector3(0.0, 0.0, 0.0);
this.dropScale = toVector3(0.0, 0.0, 0.0);
this.dropModel = 0;
this.orderPrice = 0;
this.orderValue = 0;
this.demandMultiplier = 1;
this.supplyMultiplier = 1;
this.riskMultiplier = 1;
this.needsSaved = false;
this.useDelay = 0;
this.switchDelay = 0;
this.pickupDelay = 0;
this.putDelay = 0;
this.takeDelay = 0;
this.giveDelay = 0;
this.dropDelay = 0;
this.useAnimationName = "";
this.dropAnimationName = "";
this.pickupAnimationName = "";
this.giveAnimationName = "";
this.putAnimationName = "";
this.takeAnimationName = "";
this.switchAnimationName = "";
this.useAnimationIndex = false;
this.dropAnimationIndex = false;
this.pickupAnimationIndex = false;
this.giveAnimationIndex = false;
this.putAnimationIndex = false;
this.takeAnimationIndex = false;
this.switchAnimationIndex = false;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["item_type_id"]);
this.serverId = toInteger(dbAssoc["item_type_server"]);
this.name = dbAssoc["item_type_name"];
this.enabled = intToBool(toInteger(dbAssoc["item_type_enabled"]));
this.useType = toInteger(dbAssoc["item_type_use_type"]);
this.dropType = toInteger(dbAssoc["item_type_drop_type"]);
this.useId = toInteger(dbAssoc["item_type_use_id"]);
this.dropPosition = toVector3(toFloat(dbAssoc["item_type_drop_pos_x"]), toFloat(dbAssoc["item_type_drop_pos_y"]), toFloat(dbAssoc["item_type_drop_pos_z"]));
this.dropRotation = toVector3(toFloat(dbAssoc["item_type_drop_rot_x"]), toFloat(dbAssoc["item_type_drop_rot_y"]), toFloat(dbAssoc["item_type_drop_rot_z"]));
this.dropScale = toVector3(toFloat(dbAssoc["item_type_drop_scale_x"]), toFloat(dbAssoc["item_type_drop_scale_y"]), toFloat(dbAssoc["item_type_drop_scale_z"]));
this.dropModel = toInteger(dbAssoc["item_type_drop_model"]);
this.useId = toInteger(dbAssoc["item_type_use_id"]);
this.useValue = toInteger(dbAssoc["item_type_use_value"]);
this.maxValue = toInteger(dbAssoc["item_type_max_value"]);
this.orderPrice = toInteger(dbAssoc["item_type_order_price"]);
this.orderValue = toInteger(dbAssoc["item_type_order_value"]);
this.demandMultiplier = toFloat(dbAssoc["item_type_demand_multiplier"]);
this.supplyMultiplier = toFloat(dbAssoc["item_type_supply_multiplier"]);
this.riskMultiplier = toFloat(dbAssoc["item_type_risk_multiplier"]);
this.size = toInteger(dbAssoc["item_type_size"]);
this.capacity = toInteger(dbAssoc["item_type_capacity"]);
this.useDelay = toInteger(dbAssoc["item_type_delay_use"]);
this.switchDelay = toInteger(dbAssoc["item_type_delay_switch"]);
this.pickupDelay = toInteger(dbAssoc["item_type_delay_pickup"]);
this.putDelay = toInteger(dbAssoc["item_type_delay_put"]);
this.takeDelay = toInteger(dbAssoc["item_type_delay_take"]);
this.giveDelay = toInteger(dbAssoc["item_type_delay_give"]);
this.dropDelay = toInteger(dbAssoc["item_type_delay_drop"]);
this.useAnimationName = toInteger(dbAssoc["item_type_anim_use"]);
this.switchAnimationName = toInteger(dbAssoc["item_type_anim_switch"]);
this.pickupAnimationName = toInteger(dbAssoc["item_type_anim_pickup"]);
this.putAnimationName = toInteger(dbAssoc["item_type_anim_put"]);
this.takeAnimationName = toInteger(dbAssoc["item_type_anim_take"]);
this.giveAnimationName = toInteger(dbAssoc["item_type_anim_give"]);
this.dropAnimationName = toInteger(dbAssoc["item_type_anim_drop"]);
}
}
};
// ===========================================================================
function initItemScript() { function initItemScript() {
logToConsole(LOG_INFO, "[VRR.Item]: Initializing item script ..."); logToConsole(LOG_INFO, "[VRR.Item]: Initializing item script ...");
getServerData().itemTypes = loadItemTypesFromDatabase(); getServerData().itemTypes = loadItemTypesFromDatabase();

View File

@@ -7,6 +7,346 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
// Job Types
const VRR_JOB_NONE = 0;
const VRR_JOB_POLICE = 1;
const VRR_JOB_MEDICAL = 2;
const VRR_JOB_FIRE = 3;
const VRR_JOB_BUS = 4;
const VRR_JOB_TAXI = 5;
const VRR_JOB_GARBAGE = 6;
const VRR_JOB_WEAPON = 7;
const VRR_JOB_DRUG = 8;
const VRR_JOB_PIZZA = 9;
const VRR_JOB_GENERIC = 10;
// ===========================================================================
// Job Route States
const VRR_JOBROUTESTATE_NONE = 0; // None
const VRR_JOBROUTESTATE_INPROGRESS = 1; // Route is in progress. Player is in between stops but not at the last one.
const VRR_JOBROUTESTATE_LASTSTOP = 2; // Player is heading to the last stop on the route
const VRR_JOBROUTESTATE_PAUSED = 3; // Route is paused for some reason. For police, this could be player accepted callout and once finished, patrol route will resume
const VRR_JOBROUTESTATE_ATSTOP = 4; // For bus/trash stops that freeze player, this is the state when they're at one
// ===========================================================================
/**
* @class Representing a job's data. Loaded and saved in the database
*/
class JobData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.serverId = 0;
this.type = VRR_JOB_NONE;
this.name = "Unnamed";
this.enabled = true;
this.blipModel = -1
this.pickupModel = -1
this.colour = toColour(0, 0, 0, 255);
this.whiteListEnabled = false;
this.blackListEnabled = false;
this.walkieTalkieFrequency = 0;
this.index = -1;
this.needsSaved = false;
this.equipment = [];
this.uniforms = [];
this.locations = [];
this.whiteList = [];
this.blackList = [];
this.routes = [];
if(dbAssoc) {
this.databaseId = dbAssoc["job_id"];
this.serverId = dbAssoc["job_server"];
this.type = dbAssoc["job_type"];
this.name = dbAssoc["job_name"];
this.enabled = dbAssoc["job_enabled"];
this.blipModel = dbAssoc["job_blip"];
this.pickupModel = dbAssoc["job_pickup"];
this.colour = toColour(dbAssoc["job_colour_r"], dbAssoc["job_colour_g"], dbAssoc["job_colour_b"], 255);
this.whiteListEnabled = dbAssoc["job_wl"];
this.blackListEnabled = dbAssoc["job_bl"];
this.walkieTalkieFrequency = dbAssoc["job_walkietalkiefreq"];
this.equipment = [];
this.uniforms = [];
this.locations = [];
this.whiteList = [];
this.blackList = [];
this.routes = [];
}
}
};
// ===========================================================================
class JobRouteData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.jobId = 0;
this.locationId = 0;
this.enabled = false;
this.index = -1;
this.jobIndex = -1;
this.locationIndex = -1;
this.needsSaved = false;
this.pay = 0;
this.vehicleColour1 = 1;
this.vehicleColour2 = 1;
this.detail = 0;
this.startMessage = "";
this.finishMessage = "";
this.locationArriveMessage = "";
this.locationNextMessage = "";
this.locations = [];
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["job_route_id"]);
this.name = toString(dbAssoc["job_route_name"]);
this.jobId = toInteger(dbAssoc["job_route_job"]);
this.locationId = toInteger(dbAssoc["job_route_job_loc"]);
this.enabled = intToBool(toInteger(dbAssoc["job_route_enabled"]));
this.pay = toInteger(dbAssoc["job_route_pay"]);
this.startMessage = toString(dbAssoc["job_route_start_msg"]);
this.finishMessage = toString(dbAssoc["job_route_finish_msg"]);
this.locationArriveMessage = toString(dbAssoc["job_route_loc_arrive_msg"]);
this.locationNextMessage = toString(dbAssoc["job_route_loc_next_msg"]);
this.vehicleColour1 = toInteger(dbAssoc["job_route_veh_colour1"]);
this.vehicleColour2 = toInteger(dbAssoc["job_route_veh_colour2"]);
this.detail = toInteger(dbAssoc["job_route_detail"]);
}
}
};
// ===========================================================================
class JobRouteLocationData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.routeId = 0;
this.enabled = false;
this.index = -1;
this.jobIndex = -1;
this.routeIndex = -1;
this.needsSaved = false;
this.position = toVector3(0.0, 0.0, 0.0);
this.stopDelay = 0;
this.pay = 0;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["job_route_loc_id"]);
this.name = toString(dbAssoc["job_route_loc_name"]);
this.routeId = toInteger(dbAssoc["job_route_loc_route"]);
this.enabled = intToBool(toInteger(dbAssoc["job_route_loc_enabled"]));
this.position = toVector3(toFloat(dbAssoc["job_route_loc_x"]), toFloat(dbAssoc["job_route_loc_y"]), toFloat(dbAssoc["job_route_loc_z"]));
this.stopDelay = toInteger(dbAssoc["job_route_loc_delay"]);
this.pay = toInteger(dbAssoc["job_route_loc_pay"]);
}
}
};
// ===========================================================================
/**
* @class Representing a job equipment set's data. Loaded and saved in the database
*/
class JobEquipmentData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.job = 0;
this.name = "Unnamed";
this.requiredRank = 0;
this.enabled = false;
this.index = -1;
this.jobIndex = -1;
this.needsSaved = false;
this.items = [];
if(dbAssoc) {
this.databaseId = dbAssoc["job_equip_id"];
this.job = dbAssoc["job_equip_job"];
this.name = dbAssoc["job_equip_name"];
this.requiredRank = dbAssoc["job_equip_minrank"];
this.enabled = dbAssoc["job_equip_enabled"];
}
}
};
// ===========================================================================
/**
* @class Representing a job equipment set item's data. Loaded and saved in the database
*/
class JobEquipmentItemData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.equipmentId = 0;
this.itemType = 0;
this.value = 0;
this.enabled = false;
this.index = -1;
this.jobIndex = -1;
this.needsSaved = false;
if(dbAssoc) {
this.databaseId = dbAssoc["job_equip_item_id"];
this.equipmentId = dbAssoc["job_equip_item_equip"];
this.itemType = dbAssoc["job_equip_item_type"];
this.value = dbAssoc["job_equip_item_value"];
this.enabled = dbAssoc["job_equip_item_enabled"];
}
}
};
// ===========================================================================
/**
* @class Representing a job uniform's data. Loaded and saved in the database
*/
class JobUniformData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.job = 0;
this.name = "Unnamed";
this.requiredRank = 0
this.skin = -1;
this.enabled = false;
this.index = -1;
this.jobIndex = -1;
this.needsSaved = false;
this.bodyParts = {
hair: [0,0],
head: [0,0],
upper: [0,0],
lower: [0,0],
};
this.bodyProps = {
hair: [0,0],
eyes: [0,0],
head: [0,0],
leftHand: [0,0],
rightHand: [0,0],
leftWrist: [0,0],
rightWrist: [0,0],
hip: [0,0],
leftFoot: [0,0],
rightFoot: [0,0],
};
if(dbAssoc) {
this.databaseId = dbAssoc["job_uniform_id"];
this.job = dbAssoc["job_uniform_job"];
this.name = dbAssoc["job_uniform_name"];
this.requiredRank = dbAssoc["job_uniform_minrank"];
this.skin = dbAssoc["job_uniform_skin"];
this.enabled = intToBool(dbAssoc["job_uniform_enabled"]);
this.bodyParts = {
hair: [toInteger(dbAssoc["job_uniform_hd_part_hair_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_part_hair_texture"]) || 0],
head: [toInteger(dbAssoc["job_uniform_hd_part_head_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_part_head_texture"]) || 0],
upper: [toInteger(dbAssoc["job_uniform_hd_part_upper_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_part_upper_texture"]) || 0],
lower: [toInteger(dbAssoc["job_uniform_hd_part_lower_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_part_lower_texture"]) || 0],
};
this.bodyProps = {
hair: [toInteger(dbAssoc["job_uniform_hd_prop_hair_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_hair_texture"]) || 0],
eyes: [toInteger(dbAssoc["job_uniform_hd_prop_eyes_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_eyes_texture"]) || 0],
head: [toInteger(dbAssoc["job_uniform_hd_prop_head_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_head_texture"]) || 0],
leftHand: [toInteger(dbAssoc["job_uniform_hd_prop_lefthand_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_lefthand_texture"]) || 0],
rightHand: [toInteger(dbAssoc["job_uniform_hd_prop_righthand_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_righthand_texture"]) || 0],
leftWrist: [toInteger(dbAssoc["job_uniform_hd_prop_leftwrist_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_leftwrist_texture"]) || 0],
rightWrist: [toInteger(dbAssoc["job_uniform_hd_prop_rightwrist_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_rightwrist_texture"]) || 0],
hip: [toInteger(dbAssoc["job_uniform_hd_prop_hip_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_hip_texture"]) || 0],
leftFoot: [toInteger(dbAssoc["job_uniform_hd_prop_leftfoot_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_leftfoot_texture"]) || 0],
rightFoot: [toInteger(dbAssoc["job_uniform_hd_prop_rightfoot_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_rightfoot_texture"]) || 0],
};
}
}
};
// ===========================================================================
/**
* @class JobLocationData Representing a job uniform's data. Loaded and saved in the database
*/
class JobLocationData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.jobId = 0;
this.position = toVector3(0.0, 0.0, 0.0);
this.blip = false;
this.pickup = false;
this.enabled = false;
this.interior = 0;
this.dimension = 0;
this.index = -1;
this.jobIndex = -1;
this.needsSaved = false;
this.routeCache = [];
if(dbAssoc) {
this.databaseId = dbAssoc["job_loc_id"];
this.jobId = dbAssoc["job_loc_job"];
this.position = toVector3(dbAssoc["job_loc_pos_x"], dbAssoc["job_loc_pos_y"], dbAssoc["job_loc_pos_z"]);
this.blip = false;
this.pickup = false;
this.enabled = dbAssoc["job_loc_enabled"];
this.interior = dbAssoc["job_loc_int"];
this.dimension = dbAssoc["job_loc_vw"];
}
}
};
// ===========================================================================
class JobWhiteListData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.job = 0;
this.subAccount = 0
this.enabled = false;
this.index = -1;
this.jobIndex = -1;
this.needsSaved = false;
if(dbAssoc) {
this.databaseId = dbAssoc["job_wl_id"];
this.job = dbAssoc["job_wl_job"];
this.subAccount = dbAssoc["job_wl_sacct"]
this.enabled = dbAssoc["job_wl_enabled"];
}
}
};
// ===========================================================================
class JobBlackListData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.job = 0;
this.subAccount = 0
this.enabled = false;
this.index = -1;
this.jobIndex = -1;
this.needsSaved = false;
if(dbAssoc) {
this.databaseId = dbAssoc["job_bl_id"];
this.job = dbAssoc["job_bl_job"];
this.subAccount = dbAssoc["job_bl_sacct"]
this.enabled = dbAssoc["job_bl_enabled"];
}
}
};
// ===========================================================================
function initJobScript() { function initJobScript() {
logToConsole(LOG_INFO, "[VRR.Job]: Initializing job script ..."); logToConsole(LOG_INFO, "[VRR.Job]: Initializing job script ...");
getServerData().jobs = loadJobsFromDatabase(); getServerData().jobs = loadJobsFromDatabase();

View File

@@ -8,6 +8,32 @@
// =========================================================================== // ===========================================================================
class KeyBindData {
constructor(dbAssoc = false, key = 0, commandString = "", keyState = VRR_KEYSTATE_UP) {
this.databaseId = 0;
this.key = key;
this.account = 0;
this.commandString = commandString;
this.whenAdded = 0;
this.enabled = true;
this.keyState = false;
this.index = -1;
this.needsSaved = false;
if(dbAssoc) {
this.databaseId = dbAssoc["acct_hotkey_id"];
this.key = toInteger(dbAssoc["acct_hotkey_key"]);
this.account = toInteger(dbAssoc["acct_hotkey_acct"]);
this.commandString = dbAssoc["acct_hotkey_cmdstr"];
this.whenAdded = dbAssoc["acct_hotkey_when_added"];
this.enabled = intToBool(dbAssoc["acct_hotkey_enabled"]);
this.keyState = intToBool(dbAssoc["acct_hotkey_down"]);
}
}
};
// ===========================================================================
function initKeyBindScript() { function initKeyBindScript() {
logToConsole(LOG_INFO, "[VRR.KeyBind]: Initializing key bind script ..."); logToConsole(LOG_INFO, "[VRR.KeyBind]: Initializing key bind script ...");
getGlobalConfig().keyBind = loadKeyBindConfiguration(); getGlobalConfig().keyBind = loadKeyBindConfiguration();

View File

@@ -7,6 +7,45 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
// Pickup Types
const VRR_PICKUP_NONE = 0;
const VRR_PICKUP_JOB = 1;
const VRR_PICKUP_BUSINESS_ENTRANCE = 2;
const VRR_PICKUP_BUSINESS_EXIT = 3;
const VRR_PICKUP_HOUSE_ENTRANCE = 4;
const VRR_PICKUP_HOUSE_EXIT = 5;
const VRR_PICKUP_EXIT = 6;
// ===========================================================================
// Blip Owner Types
const VRR_BLIP_NONE = 0;
const VRR_BLIP_JOB = 1;
const VRR_BLIP_BUSINESS_ENTRANCE = 2;
const VRR_BLIP_BUSINESS_EXIT = 3;
const VRR_BLIP_HOUSE_ENTRANCE = 4;
const VRR_BLIP_HOUSE_EXIT = 5;
const VRR_BLIP_EXIT = 6;
// ===========================================================================
// Ped States
const VRR_PEDSTATE_NONE = 2; // None
const VRR_PEDSTATE_READY = 1; // Ready
const VRR_PEDSTATE_DRIVER = 2; // Driving a vehicle
const VRR_PEDSTATE_PASSENGER = 3; // In a vehicle as passenger
const VRR_PEDSTATE_DEAD = 4; // Dead
const VRR_PEDSTATE_ENTERINGPROPERTY = 5; // Entering a property
const VRR_PEDSTATE_EXITINGPROPERTY = 6; // Exiting a property
const VRR_PEDSTATE_ENTERINGVEHICLE = 7; // Entering a vehicle
const VRR_PEDSTATE_EXITINGVEHICLE = 8; // Exiting a vehicle
const VRR_PEDSTATE_BINDED = 9; // Binded by rope or handcuffs
const VRR_PEDSTATE_TAZED = 10; // Under incapacitating effect of tazer
const VRR_PEDSTATE_INTRUNK = 11; // In vehicle trunk
const VRR_PEDSTATE_INITEM = 12; // In item (crate, box, etc)
const VRR_PEDSTATE_HANDSUP = 13; // Has hands up (surrendering)
const VRR_PEDSTATE_SPAWNING = 14; // Spawning
// =========================================================================== // ===========================================================================
function initMiscScript() { function initMiscScript() {
@@ -389,136 +428,6 @@ function listOnlineAdminsCommand(command, params, client) {
// =========================================================================== // ===========================================================================
function gpsCommand(command, params, client) {
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBusinessList")));
let locationType = VRR_GPS_TYPE_NONE;
let useType = VRR_ITEM_USETYPE_NONE;
let blipColour = "white";
switch(toLowerCase(params)) {
case "police":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_POLICE;
break;
case "hospital":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_HOSPITAL;
break;
case "job":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_JOB;
break;
case "skin":
case "skins":
case "clothes":
case "player":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_BUSINESS;
useType = VRR_ITEM_USETYPE_SKIN;
break;
case "gun":
case "guns":
case "weapon":
case "weapons":
case "wep":
case "weps":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_BUSINESS;
useType = VRR_ITEM_USETYPE_WEAPON;
break;
case "food":
case "eat":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_BUSINESS;
useType = VRR_ITEM_USETYPE_FOOD;
break;
case "drink":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_BUSINESS;
useType = VRR_ITEM_USETYPE_DRINK;
break;
case "alcohol":
case "booze":
case "bar":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_BUSINESS;
useType = VRR_ITEM_USETYPE_ALCOHOL;
break;
case "repair":
case "carrepair":
case "vehrepair":
case "spray":
case "fix":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_BUSINESS;
useType = VRR_ITEM_USETYPE_VEHREPAIR;
break;
case "vehiclecolour":
case "vehcolour":
case "carcolour":
case "colour":
blipColour = "businessBlue"
locationType = VRR_GPS_TYPE_BUSINESS;
useType = VRR_ITEM_USETYPE_VEHCOLOUR;
break;
default: {
let itemTypeId = getItemTypeFromParams(params);
if(getItemTypeData(itemTypeId) != false) {
locationType = VRR_GPS_TYPE_BUSINESS;
blipColour = "businessBlue";
useType = getItemTypeData(itemTypeId).useType;
} else {
let gameLocationId = getGameLocationFromParams(params);
if(gameLocationId != false) {
position = getGameConfig().locations[getServerGame()][gameLocationId][1]
}
}
}
}
if(locationType == VRR_GPS_TYPE_NONE) {
messagePlayerError(client, getLocaleString(client, "InvalidGPSLocation"));
return false;
}
if(locationType == VRR_GPS_TYPE_BUSINESS) {
let businessId = getClosestBusinessWithBuyableItemOfUseType(useType);
if(!businessId) {
messagePlayerError(client, getLocaleString(client, "NoBusinessWithItemType"));
return false;
}
if(!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "NoBusinessWithItemType"));
return false;
}
hideAllBlipsForPlayerGPS(client);
blinkGenericGPSBlipForPlayer(client, getBusinessData(businessId).entrancePosition, getBusinessData(businessId).entranceBlipModel, getColourByType(blipColour), 10);
messagePlayerSuccess(client, "Look for the blinking icon on your mini map");
}
if(locationType == VRR_GPS_TYPE_GAMELOC) {
hideAllBlipsForPlayerGPS(client);
blinkGenericGPSBlipForPlayer(client, position, 0, getColourByType(blipColour), 10);
messagePlayerSuccess(client, "Look for the blinking icon on your mini map");
return true;
}
}
// ===========================================================================
function stuckPlayerCommand(command, params, client) { function stuckPlayerCommand(command, params, client) {
if((getCurrentUnixTimestamp()-getPlayerData(client).lastStuckCommand) < getGlobalConfig().stuckCommandInterval) { if((getCurrentUnixTimestamp()-getPlayerData(client).lastStuckCommand) < getGlobalConfig().stuckCommandInterval) {
messagePlayerError(client, "CantUseCommandYet"); messagePlayerError(client, "CantUseCommandYet");

View File

@@ -7,6 +7,179 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
// NPC Trigger Condition Match Types
const VRR_NPC_COND_MATCH_NONE = 0; // None (invalid)
const VRR_NPC_COND_MATCH_EQ = 1; // Must be equal to
const VRR_NPC_COND_MATCH_GT = 2; // Must be greater than
const VRR_NPC_COND_MATCH_LT = 3; // Must be less than
const VRR_NPC_COND_MATCH_GTEQ = 4; // Must be greater than or equal to
const VRR_NPC_COND_MATCH_LTEQ = 5; // Must be less than or equal to
const VRR_NPC_COND_MATCH_CONTAINS = 6; // Must contain string (case insensitive)
const VRR_NPC_COND_MATCH_CONTAINS_CASE = 7; // Must contain string (case sensitive)
const VRR_NPC_COND_MATCH_EXACT = 8; // Must match string exactly (case insensitive)
const VRR_NPC_COND_MATCH_EXACT_CASE = 9; // Must match string exactly (case insensitive)
// ===========================================================================
class NPCData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.serverId = 0;
this.firstName = "John";
this.lastName = "Doe";
this.middleName = "Q";
this.skin = 0;
this.cash = 0;
this.spawnPosition = toVector3(0.0, 0.0, 0.0);
this.spawnHeading = 0.0;
this.clan = 0;
this.isWorking = false;
this.jobUniform = this.skin;
this.lastJobVehicle = null;
this.job = 0;
this.weapons = [];
this.interior = 0;
this.dimension = 0;
this.pedScale = toVector3(1.0, 1.0, 1.0);
this.walkStyle = 0;
this.fightStyle = 0;
this.health = 100;
this.armour = 100;
this.currentAction = VRR_NPCACTION_NONE;
this.triggers = [];
this.bodyParts = {
hair: [0,0],
head: [0,0],
upper: [0,0],
lower: [0,0],
};
this.bodyProps = {
hair: [0,0],
eyes: [0,0],
head: [0,0],
leftHand: [0,0],
rightHand: [0,0],
leftWrist: [0,0],
rightWrist: [0,0],
hip: [0,0],
leftFoot: [0,0],
rightFoot: [0,0],
};
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["npc_id"]);
this.serverId = toInteger(dbAssoc["npc_server"]);
this.firstName = dbAssoc["npc_name_first"];
this.lastName = dbAssoc["npc_name_last"];
this.middleName = dbAssoc["npc_name_middle"] || "";
this.skin = toInteger(dbAssoc["npc_skin"]);
this.cash = toInteger(dbAssoc["npc_cash"]);
this.spawnPosition = toVector3(toFloat(dbAssoc["npc_pos_x"]), toFloat(dbAssoc["npc_pos_y"]), toFloat(dbAssoc["npc_pos_z"]));
this.spawnHeading = toFloat(dbAssoc["npc_angle"]);
this.lastLogin = toInteger(dbAssoc["npc_when_lastlogin"]);
this.clan = toInteger(dbAssoc["npc_clan"]);
this.clanFlags = toInteger(dbAssoc["npc_clan_flags"]);
this.clanRank = toInteger(dbAssoc["npc_clan_rank"]);
this.clanTitle = toInteger(dbAssoc["npc_clan_title"]);
this.job = toInteger(dbAssoc["npc_job"]);
this.interior = toInteger(dbAssoc["npc_int"]);
this.dimension = toInteger(dbAssoc["npc_vw"]);
this.pedScale = toVector3(toFloat(dbAssoc["npc_scale_x"]), toFloat(dbAssoc["npc_scale_y"]), toFloat(dbAssoc["npc_scale_z"]));
this.walkStyle = toInteger(dbAssoc["npc_walkstyle"]);
this.fightStyle = toInteger(dbAssoc["npc_fightstyle"]);
this.health = toInteger(dbAssoc["npc_health"]);
this.armour = toInteger(dbAssoc["npc_armour"]);
this.bodyParts = {
hair: [toInteger(dbAssoc["npc_hd_part_hair_model"]) || 0, toInteger(dbAssoc["npc_hd_part_hair_texture"]) || 0],
head: [toInteger(dbAssoc["npc_hd_part_head_model"]) || 0, toInteger(dbAssoc["npc_hd_part_head_texture"]) || 0],
upper: [toInteger(dbAssoc["npc_hd_part_upper_model"]) || 0, toInteger(dbAssoc["npc_hd_part_upper_texture"]) || 0],
lower: [toInteger(dbAssoc["npc_hd_part_lower_model"]) || 0, toInteger(dbAssoc["npc_hd_part_lower_texture"]) || 0],
};
this.bodyProps = {
hair: [toInteger(dbAssoc["npc_hd_prop_hair_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_hair_texture"]) || 0],
eyes: [toInteger(dbAssoc["npc_hd_prop_eyes_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_eyes_texture"]) || 0],
head: [toInteger(dbAssoc["npc_hd_prop_head_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_head_texture"]) || 0],
leftHand: [toInteger(dbAssoc["npc_hd_prop_lefthand_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_lefthand_texture"]) || 0],
rightHand: [toInteger(dbAssoc["npc_hd_prop_righthand_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_righthand_texture"]) || 0],
leftWrist: [toInteger(dbAssoc["npc_hd_prop_leftwrist_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_leftwrist_texture"]) || 0],
rightWrist: [toInteger(dbAssoc["npc_hd_prop_rightwrist_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_rightwrist_texture"]) || 0],
hip: [toInteger(dbAssoc["npc_hd_prop_hip_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_hip_texture"]) || 0],
leftFoot: [toInteger(dbAssoc["npc_hd_prop_leftfoot_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_leftfoot_texture"]) || 0],
rightFoot: [toInteger(dbAssoc["npc_hd_prop_rightfoot_model"]) || 0, toInteger(dbAssoc["npc_hd_prop_rightfoot_texture"]) || 0],
};
}
}
};
// ===========================================================================
class NPCTriggerData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.npcId = 0;
this.index = 0;
this.npc = 0;
this.npcIndex = -1;
this.triggerType = 0;
this.conditions = [];
this.responses = [];
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["npc_trig_id"]);
this.npc = toInteger(dbAssoc["npc_trig_npc"]);
this.triggerType = toInteger(dbAssoc["npc_trig_type"]);
}
}
};
// ===========================================================================
class NPCTriggerConditionData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.triggerId = 0;
this.index = 0;
this.triggerIndex = 0;
this.conditionType = 0;
this.conditionValue = false;
this.matchType = false;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["npc_trig_cond_id"]);
this.npc = toInteger(dbAssoc["npc_trig_cond_trig"]);
this.conditionType = toInteger(dbAssoc["npc_trig_cond_type"]);
this.conditionValue = toInteger(dbAssoc["npc_trig_cond_val"]);
this.matchType = toInteger(dbAssoc["npc_trig_cond_val"]);
}
}
};
// ===========================================================================
class NPCTriggerResponseData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.triggerId = 0;
this.index = 0;
this.triggerIndex = 0;
this.responseType = 0;
this.responseValue = false;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["npc_trig_resp_id"]);
this.npc = toInteger(dbAssoc["npc_trig_resp_trig"]);
this.responseType = toInteger(dbAssoc["npc_trig_resp_type"]);
this.responseValue = toInteger(dbAssoc["npc_trig_resp_val"]);
}
}
};
// ===========================================================================
function initNPCScript() { function initNPCScript() {
getServerData().npcs = loadNPCsFromDatabase(); getServerData().npcs = loadNPCsFromDatabase();
setAllNPCDataIndexes(); setAllNPCDataIndexes();

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: biker.js
// DESC: Provides biker NPC interaction and functionality
// TYPE: Server (JavaScript)
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: drugdealer.js
// DESC: Provides drug dealer NPC interaction and functionality
// TYPE: Server (JavaScript)
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: firefighter.js
// DESC: Provides firefighter NPC interaction and functionality
// TYPE: Server (JavaScript)
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: gangsta.js
// DESC: Provides street gang/hoodlum NPC interaction and functionality
// TYPE: Server (JavaScript)
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: mafia.js
// DESC: Provides mafia/mafioso NPC interaction and functionality
// TYPE: Server (JavaScript)
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: normal.js
// DESC: Provides normal/generic civilian NPC interaction and functionality
// TYPE: Server (JavaScript)
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: paramedic.js
// DESC: Provides paramedic NPC interaction and functionality
// TYPE: Server (JavaScript)
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: police.js
// DESC: Provides police officer NPC interaction and functionality
// TYPE: Server (JavaScript)
// ===========================================================================

View File

@@ -1,28 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: taxi.js
// DESC: Provides taxi driver NPC interaction and functionality
// TYPE: Server (JavaScript)
// ===========================================================================
function attemptToSignalToNearbyTaxi(client) {
if(!isPlayerLoggedIn(client)) {
return false;
}
if(!isPlayerSpawned(client)) {
return false;
}
let nearbyTaxis = getElementsByType(ELEMENT_VEHICLE).filter((v) > getPlayerPosition(client).distance(v.position) <= 15 && isTaxiVehicle(v));
let closestTaxi = nearbyTaxis.reduce((i, j) => (i.position.distance(pos) < j.position.distance(pos)) ? i : j);
if(!closestTaxi.getOccupant(0).isType(ELEMENT_PLAYER)) {
setVehicleCruiseSpeed(closestTaxi, 0.0);
setVehicleLockedState(closestTaxi, false);
}
}
// ===========================================================================

View File

@@ -7,6 +7,27 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
class RadioStationData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.url = "";
this.genre = "";
this.codec = "";
this.index = -1;
if(dbAssoc) {
this.databaseId = dbAssoc["radio_id"];
this.name = dbAssoc["radio_name"];
this.url = dbAssoc["radio_url"];
this.genre = dbAssoc["radio_genre"];
this.codec = dbAssoc["radio_codec"];
}
}
};
// ===========================================================================
function initRadioScript() { function initRadioScript() {
logToConsole(LOG_INFO, "[VRR.Radio]: Initializing radio script ..."); logToConsole(LOG_INFO, "[VRR.Radio]: Initializing radio script ...");
getServerData().radioStations = loadRadioStationsFromDatabase(); getServerData().radioStations = loadRadioStationsFromDatabase();

View File

@@ -7,6 +7,116 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
/**
* @class Representing a character's (subaccount) data. Loaded and saved in the database
*/
class SubAccountData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.serverId = 0;
this.firstName = "John";
this.lastName = "Doe";
this.middleName = "Q";
this.account = 0;
this.skin = 0;
this.cash = 0;
this.spawnPosition = toVector3(0.0, 0.0, 0.0);
this.spawnHeading = 0.0;
this.lastLogin = 0;
this.clan = 0;
this.clanFlags = 0;
this.clanRank = 0;
this.clanTitle = 0;
this.isWorking = false;
this.jobUniform = this.skin;
this.job = 0;
this.jobRank = 0;
this.weapons = [];
this.inJail = false;
this.interior = 0;
this.dimension = 0;
this.pedScale = toVector3(1.0, 1.0, 1.0);
this.walkStyle = 0;
this.fightStyle = 0;
this.health = 100;
this.armour = 100;
this.inHouse = 0;
this.inBusiness = 0;
this.accent = "";
this.bodyParts = {
hair: [0,0],
head: [0,0],
upper: [0,0],
lower: [0,0],
};
this.bodyProps = {
hair: [0,0],
eyes: [0,0],
head: [0,0],
leftHand: [0,0],
rightHand: [0,0],
leftWrist: [0,0],
rightWrist: [0,0],
hip: [0,0],
leftFoot: [0,0],
rightFoot: [0,0],
};
if(dbAssoc) {
this.databaseId = dbAssoc["sacct_id"];
this.serverId = toInteger(dbAssoc["sacct_server"]);
this.firstName = dbAssoc["sacct_name_first"];
this.lastName = dbAssoc["sacct_name_last"];
this.middleName = dbAssoc["sacct_name_middle"] || "";
this.account = toInteger(dbAssoc["sacct_acct"]);
this.skin = toInteger(dbAssoc["sacct_svr_skin"]);
this.cash = toInteger(dbAssoc["sacct_cash"]);
this.spawnPosition = toVector3(toFloat(dbAssoc["sacct_pos_x"]), toFloat(dbAssoc["sacct_pos_y"]), toFloat(dbAssoc["sacct_pos_z"]));
this.spawnHeading = toFloat(dbAssoc["sacct_rot_z"]);
this.lastLogin = toInteger(dbAssoc["sacct_when_lastlogin"]);
this.clan = toInteger(dbAssoc["sacct_svr_clan"]);
this.clanFlags = toInteger(dbAssoc["sacct_svr_clan_flags"]);
this.clanRank = toInteger(dbAssoc["sacct_svr_clan_rank"]);
this.clanTitle = toInteger(dbAssoc["sacct_svr_clan_title"]);
this.job = toInteger(dbAssoc["sacct_svr_job"]);
this.jobRank = toInteger(dbAssoc["sacct_svr_job_rank"]);
this.interior = toInteger(dbAssoc["sacct_int"]);
this.dimension = toInteger(dbAssoc["sacct_vw"]);
this.pedScale = toVector3(toFloat(dbAssoc["sacct_svr_scale_x"]), toFloat(dbAssoc["sacct_svr_scale_y"]), toFloat(dbAssoc["sacct_svr_scale_z"]));
this.walkStyle = toInteger(dbAssoc["sacct_svr_walkstyle"]);
this.fightStyle = toInteger(dbAssoc["sacct_svr_fightstyle"]);
this.health = toInteger(dbAssoc["sacct_health"]);
this.armour = toInteger(dbAssoc["sacct_armour"]);
this.inHouse = toInteger(dbAssoc["sacct_inhouse"]);
this.inBusiness = toInteger(dbAssoc["sacct_inbusiness"]);
this.accent = toString(dbAssoc["sacct_accent"]);
this.bodyParts = {
hair: [toInteger(dbAssoc["sacct_svr_hd_part_hair_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_part_hair_texture"]) || 0],
head: [toInteger(dbAssoc["sacct_svr_hd_part_head_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_part_head_texture"]) || 0],
upper: [toInteger(dbAssoc["sacct_svr_hd_part_upper_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_part_upper_texture"]) || 0],
lower: [toInteger(dbAssoc["sacct_svr_hd_part_lower_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_part_lower_texture"]) || 0],
};
this.bodyProps = {
hair: [toInteger(dbAssoc["sacct_svr_hd_prop_hair_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_hair_texture"]) || 0],
eyes: [toInteger(dbAssoc["sacct_svr_hd_prop_eyes_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_eyes_texture"]) || 0],
head: [toInteger(dbAssoc["sacct_svr_hd_prop_head_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_head_texture"]) || 0],
leftHand: [toInteger(dbAssoc["sacct_svr_hd_prop_lefthand_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_lefthand_texture"]) || 0],
rightHand: [toInteger(dbAssoc["sacct_svr_hd_prop_righthand_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_righthand_texture"]) || 0],
leftWrist: [toInteger(dbAssoc["sacct_svr_hd_prop_leftwrist_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_leftwrist_texture"]) || 0],
rightWrist: [toInteger(dbAssoc["sacct_svr_hd_prop_rightwrist_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_rightwrist_texture"]) || 0],
hip: [toInteger(dbAssoc["sacct_svr_hd_prop_hip_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_hip_texture"]) || 0],
leftFoot: [toInteger(dbAssoc["sacct_svr_hd_prop_leftfoot_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_leftfoot_texture"]) || 0],
rightFoot: [toInteger(dbAssoc["sacct_svr_hd_prop_rightfoot_model"]) || 0, toInteger(dbAssoc["sacct_svr_hd_prop_rightfoot_texture"]) || 0],
};
}
}
};
function initSubAccountScript() { function initSubAccountScript() {
logToConsole(LOG_INFO, "[VRR.SubAccount]: Initializing subaccount script ..."); logToConsole(LOG_INFO, "[VRR.SubAccount]: Initializing subaccount script ...");
logToConsole(LOG_INFO, "[VRR.SubAccount]: SubAccount script initialized!"); logToConsole(LOG_INFO, "[VRR.SubAccount]: SubAccount script initialized!");

View File

@@ -7,6 +7,180 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
// Vehicle Owner Types
const VRR_VEHOWNER_NONE = 0; // Not owned
const VRR_VEHOWNER_PLAYER = 1; // Owned by a player (character/subaccount)
const VRR_VEHOWNER_JOB = 2; // Owned by a job
const VRR_VEHOWNER_CLAN = 3; // Owned by a clan
const VRR_VEHOWNER_FACTION = 4; // Owned by a faction (not used at the moment)
const VRR_VEHOWNER_PUBLIC = 5; // Public vehicle. Anybody can drive it.
const VRR_VEHOWNER_BIZ = 6; // Owned by a business (also includes dealerships since they're businesses)
// ===========================================================================
// Vehicle Seats
const VRR_VEHSEAT_DRIVER = 0;
const VRR_VEHSEAT_FRONTPASSENGER = 1;
const VRR_VEHSEAT_REARLEFTPASSENGER = 2;
const VRR_VEHSEAT_REARRIGHTPASSENGER = 3;
// ===========================================================================
/**
* @class Representing a vehicle's data. Loaded and saved in the database
*/
class VehicleData {
constructor(dbAssoc = false, vehicle = false) {
// General Info
this.databaseId = 0;
this.serverId = getServerId();
this.model = (vehicle != false) ? getVehicleModelIndexFromModel(vehicle.modelIndex) : 0;
this.vehicle = vehicle;
this.index = -1;
this.needsSaved = false;
// GTA IV
this.ivNetworkId = -1;
this.syncPosition = toVector3(0.0, 0.0, 0.0);
this.syncHeading = 0.0;
// Ownership
this.ownerType = VRR_VEHOWNER_NONE;
this.ownerId = 0;
this.buyPrice = 0;
this.rentPrice = 0;
this.rentedBy = false;
this.rentStart = 0;
// Position and Rotation
this.spawnPosition = (vehicle) ? vehicle.position : toVector3(0.0, 0.0, 0.0);
this.spawnRotation = (vehicle) ? vehicle.heading : 0.0;
this.spawnLocked = false;
// Colour Info
this.colour1IsRGBA = 0;
this.colour2IsRGBA = 0;
this.colour3IsRGBA = 0;
this.colour4IsRGBA = 0;
this.colour1 = (vehicle) ? vehicle.colour1 : 1;
this.colour2 = (vehicle) ? vehicle.colour2 : 1;
this.colour3 = (vehicle) ? vehicle.colour3 : 1;
this.colour4 = (vehicle) ? vehicle.colour4 : 1;
this.livery = 3;
this.extras = [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
];
// Vehicle Attributes
this.locked = false;
this.engine = false;
this.lights = false;
this.health = 1000;
this.engineDamage = 0;
this.visualDamage = 0;
this.dirtLevel = 0;
this.trunkItemCache = [];
this.dashItemCache = [];
this.streamingRadioStation = -1;
// Other/Misc
this.insuranceAccount = 0;
this.fuel = 0;
this.flags = 0;
this.needsSaved = false;
this.whoAdded = 0;
this.whenAdded = 0;
this.interior = 0;
this.dimension = 0;
this.lastActiveTime = false;
if(dbAssoc) {
// General Info
this.databaseId = toInteger(dbAssoc["veh_id"]);
this.serverId = toInteger(dbAssoc["veh_server"]);
this.model = toInteger(dbAssoc["veh_model"]);
// Ownership
this.ownerType = toInteger(dbAssoc["veh_owner_type"]);
this.ownerId = toInteger(dbAssoc["veh_owner_id"]);
this.buyPrice = toInteger(dbAssoc["veh_buy_price"]);
this.rentPrice = toInteger(dbAssoc["veh_rent_price"]);
// Position and Rotation
this.spawnPosition = toVector3(dbAssoc["veh_pos_x"], dbAssoc["veh_pos_y"], dbAssoc["veh_pos_z"]);
this.spawnRotation = toInteger(dbAssoc["veh_rot_z"]);
this.spawnLocked = intToBool(toInteger(dbAssoc["veh_spawn_lock"]));
// Colour Info
this.colour1IsRGBA = intToBool(toInteger(dbAssoc["veh_col1_isrgba"]));
this.colour2IsRGBA = intToBool(toInteger(dbAssoc["veh_col2_isrgba"]));
this.colour3IsRGBA = intToBool(toInteger(dbAssoc["veh_col3_isrgba"]));
this.colour4IsRGBA = intToBool(toInteger(dbAssoc["veh_col4_isrgba"]));
this.colour1 = toInteger(dbAssoc["veh_col1"]);
this.colour2 = toInteger(dbAssoc["veh_col2"]);
this.colour3 = toInteger(dbAssoc["veh_col3"]);
this.colour4 = toInteger(dbAssoc["veh_col4"]);
this.livery = toInteger(dbAssoc["veh_livery"]);
// Extras (components on SA, extras on IV+)
this.extras = [
toInteger(dbAssoc["veh_extra1"]),
toInteger(dbAssoc["veh_extra2"]),
toInteger(dbAssoc["veh_extra3"]),
toInteger(dbAssoc["veh_extra4"]),
toInteger(dbAssoc["veh_extra5"]),
toInteger(dbAssoc["veh_extra6"]),
toInteger(dbAssoc["veh_extra7"]),
toInteger(dbAssoc["veh_extra8"]),
toInteger(dbAssoc["veh_extra9"]),
toInteger(dbAssoc["veh_extra10"]),
toInteger(dbAssoc["veh_extra11"]),
toInteger(dbAssoc["veh_extra12"]),
toInteger(dbAssoc["veh_extra13"]),
];
// Vehicle Attributes
this.locked = intToBool(toInteger(dbAssoc["veh_locked"]));
this.engine = intToBool(toInteger(dbAssoc["veh_engine"]));
this.lights = intToBool(toInteger(dbAssoc["veh_lights"]));
this.health = toInteger(dbAssoc["veh_damage_normal"]);
this.engineDamage = toInteger(dbAssoc["veh_damage_engine"]);
this.visualDamage = toInteger(dbAssoc["veh_damage_visual"]);
this.dirtLevel = toInteger(dbAssoc["veh_dirt_level"]);
// Other/Misc
this.insuranceAccount = toInteger(0);
this.fuel = toInteger(0);
this.flags = toInteger(0);
this.needsSaved = false;
this.whoAdded = toInteger(dbAssoc["veh_who_added"]);
this.whenAdded = toInteger(dbAssoc["veh_when_added"]);
this.interior = toInteger(dbAssoc["veh_int"]);
this.dimension = toInteger(dbAssoc["veh_vw"]);
}
}
};
// ===========================================================================
function initVehicleScript() { function initVehicleScript() {
logToConsole(LOG_INFO, "[VRR.Vehicle]: Initializing vehicle script ..."); logToConsole(LOG_INFO, "[VRR.Vehicle]: Initializing vehicle script ...");
getServerData().vehicles = loadVehiclesFromDatabase(); getServerData().vehicles = loadVehiclesFromDatabase();
@@ -182,7 +356,7 @@ function getVehicleData(vehicle) {
} }
} }
} else { } else {
return getServerVehicles().find((v) => v.ivNetworkId == vehicle); return getServerData().vehicles.find((v) => v.ivNetworkId == vehicle);
} }
return false; return false;

View File

@@ -92,4 +92,18 @@ const VRR_VEHBUYSTATE_NONE = 0;
const VRR_VEHBUYSTATE_TESTDRIVE = 1; const VRR_VEHBUYSTATE_TESTDRIVE = 1;
const VRR_VEHBUYSTATE_EXITVEH = 2; const VRR_VEHBUYSTATE_EXITVEH = 2;
const VRR_VEHBUYSTATE_FARENOUGH = 3; const VRR_VEHBUYSTATE_FARENOUGH = 3;
const VRR_VEHBUYSTATE_WRONGVEH = 4; const VRR_VEHBUYSTATE_WRONGVEH = 4;
// Islands
const VRR_ISLAND_NONE = 0; // None
const VRR_ISLAND_PORTLAND = 0; // Portland Island
const VRR_ISLAND_STAUNTON = 1; // Staunton Island
const VRR_ISLAND_SHORESIDEVALE = 2; // Shoreside Vale
const VRR_ISLAND_VICEWEST = 0; // Western Island of VC
const VRR_ISLAND_VICEEAST = 1; // Eastern Island of VC
const VRR_ISLAND_LOSSANTOS = 0; // Los Santos
const VRR_ISLAND_LASVENTURAS = 1; // Las Venturas
const VRR_ISLAND_SANFIERRO = 2; // San Fierro
const VRR_ISLAND_REDCOUNTYNORTH = 4; // Red County North (spans all the way from Palamino/shore on the east east to border of Flint County on the west)
const VRR_ISLAND_BONECOUNTYNORTH = 5; // Bone County North (usually called Tierra Robada)
const VRR_ISLAND_BONECOUNTYSOUTH = 6; // Bone County South