Merge branch 'organizing' into separate-resources
This commit is contained in:
7
meta.xml
7
meta.xml
@@ -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,10 +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/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" />
|
||||||
@@ -47,7 +49,6 @@
|
|||||||
<script src="scripts/server/npc.js" type="server" language="javascript" />
|
<script src="scripts/server/npc.js" type="server" language="javascript" />
|
||||||
<script src="scripts/server/race.js" type="server" language="javascript" />
|
<script src="scripts/server/race.js" type="server" language="javascript" />
|
||||||
<script src="scripts/server/radio.js" type="server" language="javascript" />
|
<script src="scripts/server/radio.js" type="server" language="javascript" />
|
||||||
<script src="scripts/server/radio.js" type="server" language="javascript" />
|
|
||||||
<script src="scripts/server/security.js" type="server" language="javascript" />
|
<script src="scripts/server/security.js" type="server" language="javascript" />
|
||||||
<script src="scripts/server/staff.js" type="server" language="javascript" />
|
<script src="scripts/server/staff.js" type="server" language="javascript" />
|
||||||
<script src="scripts/server/subaccount.js" type="server" language="javascript" />
|
<script src="scripts/server/subaccount.js" type="server" language="javascript" />
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ function onLocalPlayerEnteredVehicle(event, vehicle, seat) {
|
|||||||
|
|
||||||
sendNetworkEventToServer("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
sendNetworkEventToServer("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||||
|
|
||||||
|
//if (areServerElementsSupported()) {
|
||||||
//if(inVehicleSeat == 0) {
|
//if(inVehicleSeat == 0) {
|
||||||
//setVehicleEngine(vehicle, false);
|
//setVehicleEngine(vehicle, false);
|
||||||
//if(!inVehicle.engine) {
|
//if(!inVehicle.engine) {
|
||||||
@@ -173,6 +174,7 @@ function onLocalPlayerEnteredVehicle(event, vehicle, seat) {
|
|||||||
// parkedVehicleHeading = inVehicle.heading;
|
// parkedVehicleHeading = inVehicle.heading;
|
||||||
//}
|
//}
|
||||||
//}
|
//}
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -208,6 +208,7 @@ function setLocalPlayerInterior(interior) {
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (areServerElementsSupported() && isGameFeatureSupported("interior")) {
|
||||||
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
||||||
for (let i in vehicles) {
|
for (let i in vehicles) {
|
||||||
if (getEntityData(vehicles[i], "vrr.interior")) {
|
if (getEntityData(vehicles[i], "vrr.interior")) {
|
||||||
@@ -215,6 +216,7 @@ function setLocalPlayerInterior(interior) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
|||||||
@@ -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!");
|
||||||
@@ -801,9 +986,10 @@ function createAccount(name, password, email = "") {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkLogin(client, password) {
|
async function checkLogin(client, password) {
|
||||||
getPlayerData(client).loginAttemptsRemaining = getPlayerData(client).loginAttemptsRemaining - 1;
|
getPlayerData(client).loginAttemptsRemaining = getPlayerData(client).loginAttemptsRemaining - 1;
|
||||||
if (getPlayerData(client).loginAttemptsRemaining <= 0) {
|
if (getPlayerData(client).loginAttemptsRemaining <= 0) {
|
||||||
|
getPlayerData(client).customDisconnectReason = "Kicked - Failed to login";
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -840,9 +1026,10 @@ function checkLogin(client, password) {
|
|||||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAccountEmailVerified(getPlayerData(client).accountData) && !isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
|
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
||||||
sendAccountLoginFailedNotification(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerIP(client), getGame());
|
//if (isAccountEmailVerified(getPlayerData(client).accountData) && !isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
|
||||||
}
|
// await sendAccountLoginFailedNotification(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerIP(client), getGame());
|
||||||
|
//}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -856,9 +1043,10 @@ function checkLogin(client, password) {
|
|||||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAccountEmailVerified(getPlayerData(client).accountData) && !isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
|
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
||||||
sendAccountLoginFailedNotification(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerIP(client), getGame());
|
//if (isAccountEmailVerified(getPlayerData(client).accountData) && !isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
|
||||||
}
|
// await sendAccountLoginFailedNotification(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerIP(client), getGame());
|
||||||
|
//}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -875,9 +1063,10 @@ function checkLogin(client, password) {
|
|||||||
|
|
||||||
loginSuccess(client);
|
loginSuccess(client);
|
||||||
|
|
||||||
if (isAccountEmailVerified(getPlayerData(client).accountData) && !isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
|
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
||||||
sendAccountLoginSuccessNotification(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerIP(client), getGame());
|
//if (isAccountEmailVerified(getPlayerData(client).accountData) && !isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
|
||||||
}
|
// await sendAccountLoginSuccessNotification(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerIP(client), getGame());
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -984,6 +1173,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
|||||||
|
|
||||||
if (doesServerHaveTesterOnlyEnabled() && !isPlayerATester(client)) {
|
if (doesServerHaveTesterOnlyEnabled() && !isPlayerATester(client)) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
getPlayerData(client).customDisconnectReason = "Kicked - Not a tester";
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
@@ -1029,22 +1219,23 @@ function checkAccountResetPasswordRequest(client, inputText) {
|
|||||||
getPlayerData(client).passwordResetCode = passwordResetCode;
|
getPlayerData(client).passwordResetCode = passwordResetCode;
|
||||||
showPlayerResetPasswordCodeInputGUI(client);
|
showPlayerResetPasswordCodeInputGUI(client);
|
||||||
sendPasswordResetEmail(client, passwordResetCode);
|
sendPasswordResetEmail(client, passwordResetCode);
|
||||||
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} submitted successful email for password reset. Sending email and awaiting verification code input ...`);
|
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} submitted successful email for password reset. Sending email and awaiting verification code input (${passwordResetCode}) ...`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VRR_RESETPASS_STATE_CODEINPUT: {
|
case VRR_RESETPASS_STATE_CODEINPUT: {
|
||||||
|
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} submitted code for password reset (${inputText}) ...`);
|
||||||
if (inputText != "") {
|
if (inputText != "") {
|
||||||
if (getPlayerData(client).passwordResetCode == toUpperCase(inputText)) {
|
if (getPlayerData(client).passwordResetCode == toUpperCase(inputText)) {
|
||||||
getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_SETPASS;
|
getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_SETPASS;
|
||||||
showPlayerChangePasswordGUI(client, getLocaleString(client));
|
showPlayerChangePasswordGUI(client);
|
||||||
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} entered the correct reset password verification code. Awaiting new password input ...`);
|
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} entered the correct reset password verification code. Awaiting new password input ...`);
|
||||||
} else {
|
} else {
|
||||||
getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_NONE;
|
|
||||||
getPlayerData(client).passwordResetAttemptsRemaining = getPlayerData(client).passwordResetAttemptsRemaining - 1;
|
getPlayerData(client).passwordResetAttemptsRemaining = getPlayerData(client).passwordResetAttemptsRemaining - 1;
|
||||||
logToConsole(LOG_INFO | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (verification code not correct, ${getPlayerData(client).passwordResetAttemptsRemaining} attempts remaining)`);
|
logToConsole(LOG_INFO | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (verification code not correct, ${getPlayerData(client).passwordResetAttemptsRemaining} attempts remaining)`);
|
||||||
if (getPlayerData(client).passwordResetAttemptsRemaining <= 0) {
|
if (getPlayerData(client).passwordResetAttemptsRemaining <= 0) {
|
||||||
logToConsole(LOG_INFO | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (verification code not correct, no more attempts remaining, kicking ...)`);
|
logToConsole(LOG_INFO | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (verification code not correct, no more attempts remaining, kicking ...)`);
|
||||||
|
getPlayerData(client).customDisconnectReason = "Kicked - Failed to login";
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1191,8 +1382,8 @@ function initClient(client) {
|
|||||||
sendPlayerGUIInit(client);
|
sendPlayerGUIInit(client);
|
||||||
updatePlayerSnowState(client);
|
updatePlayerSnowState(client);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account] Showing connect camera to ${getPlayerDisplayForConsole(client)} ...`);
|
//logToConsole(LOG_DEBUG, `[VRR.Account] Showing connect camera to ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
showConnectCameraToPlayer(client);
|
//showConnectCameraToPlayer(client);
|
||||||
|
|
||||||
messageClient(`Please wait ...`, client, getColourByName("softGreen"));
|
messageClient(`Please wait ...`, client, getColourByName("softGreen"));
|
||||||
|
|
||||||
@@ -1541,7 +1732,7 @@ function sendAccountLoginSuccessNotification(emailAddress, name, ip, game = getG
|
|||||||
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
|
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
|
||||||
emailBodyText = emailBodyText.replace("{TIMESTAMP}", new Date().toLocaleString('en-US'));
|
emailBodyText = emailBodyText.replace("{TIMESTAMP}", new Date().toLocaleString('en-US'));
|
||||||
|
|
||||||
sendEmail(emailAddress, name, `Login failed on ${getServerName()}`, emailBodyText);
|
sendEmail(emailAddress, name, `Login successful on ${getServerName()}`, emailBodyText);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1567,6 +1758,7 @@ function checkPlayerTwoFactorAuthentication(client, authCode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPlayerData(client).customDisconnectReason = "Kicked - Failed to login";
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,36 @@
|
|||||||
// 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() {
|
||||||
logToConsole(LOG_INFO, "[VRR.Ban]: Initializing ban script ...");
|
logToConsole(LOG_INFO, "[VRR.Ban]: Initializing ban script ...");
|
||||||
logToConsole(LOG_INFO, "[VRR.Ban]: Ban script initialized!");
|
logToConsole(LOG_INFO, "[VRR.Ban]: Ban script initialized!");
|
||||||
@@ -37,9 +67,11 @@ function accountBanCommand(command, params, client) {
|
|||||||
|
|
||||||
logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
||||||
|
|
||||||
announceAdminAction(`PlayerAccountBanned`, `{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR}`);
|
announceAdminAction(`PlayerAccountBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
|
||||||
banAccount(getPlayerData(targetClient).accountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
banAccount(getPlayerData(targetClient).accountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
||||||
disconnectPlayer(client);
|
|
||||||
|
getPlayerData(targetClient).customDisconnectReason = `Banned - ${reason}`;
|
||||||
|
disconnectPlayer(targetClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -67,10 +99,11 @@ function subAccountBanCommand(command, params, client, fromDiscord) {
|
|||||||
|
|
||||||
logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name})'s subaccount was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name})'s subaccount was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
||||||
|
|
||||||
announceAdminAction(`PlayerCharacterBanned`, `{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR}`);
|
announceAdminAction(`PlayerCharacterBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
|
||||||
banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
||||||
|
|
||||||
disconnectPlayer(client);
|
getPlayerData(targetClient).customDisconnectReason = `Banned - ${reason}`;
|
||||||
|
disconnectPlayer(targetClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -99,6 +132,7 @@ function ipBanCommand(command, params, client, fromDiscord) {
|
|||||||
announceAdminAction(`PlayerIPBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
|
announceAdminAction(`PlayerIPBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
|
||||||
banIPAddress(getPlayerIP(targetClient), getPlayerData(client).accountData.databaseId, reason);
|
banIPAddress(getPlayerIP(targetClient), getPlayerData(client).accountData.databaseId, reason);
|
||||||
|
|
||||||
|
getPlayerData(targetClient).customDisconnectReason = `IP Banned - ${reason}`;
|
||||||
serverBanIP(getPlayerIP(targetClient));
|
serverBanIP(getPlayerIP(targetClient));
|
||||||
disconnectPlayer(targetClient);
|
disconnectPlayer(targetClient);
|
||||||
}
|
}
|
||||||
@@ -130,6 +164,7 @@ function subNetBanCommand(command, params, client, fromDiscord) {
|
|||||||
announceAdminAction(`PlayerSubNetBanned`, `{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR}`);
|
announceAdminAction(`PlayerSubNetBanned`, `{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR}`);
|
||||||
banSubNet(getPlayerIP(targetClient), getSubNet(getPlayerIP(targetClient), octetAmount), getPlayerData(client).accountData.databaseId, reason);
|
banSubNet(getPlayerIP(targetClient), getSubNet(getPlayerIP(targetClient), octetAmount), getPlayerData(client).accountData.databaseId, reason);
|
||||||
|
|
||||||
|
getPlayerData(client).customDisconnectReason = `IP Subnet Banned - ${reason}`;
|
||||||
serverBanIP(getPlayerIP(targetClient));
|
serverBanIP(getPlayerIP(targetClient));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,171 @@
|
|||||||
// 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 ...");
|
||||||
|
|
||||||
|
|
||||||
logToConsole(LOG_INFO, "[VRR.Business]: Business script initialized successfully!");
|
logToConsole(LOG_INFO, "[VRR.Business]: Business script initialized successfully!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -44,7 +205,7 @@ function loadBusinessesFromDatabase() {
|
|||||||
let dbAssoc;
|
let dbAssoc;
|
||||||
|
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
dbQuery = queryDatabase(dbConnection, `SELECT * FROM biz_main WHERE biz_server = ${getServerId()}`);
|
dbQuery = queryDatabase(dbConnection, `SELECT * FROM biz_main WHERE biz_deleted = 0 AND biz_server = ${getServerId()}`);
|
||||||
if (dbQuery) {
|
if (dbQuery) {
|
||||||
if (dbQuery.numRows > 0) {
|
if (dbQuery.numRows > 0) {
|
||||||
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
|
|||||||
@@ -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 ...");
|
||||||
logToConsole(LOG_INFO, "[VRR.Clan]: Clan script initialized successfully!");
|
logToConsole(LOG_INFO, "[VRR.Clan]: Clan script initialized successfully!");
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,41 @@
|
|||||||
// 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 = [];
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
function initCommandScript() {
|
function initCommandScript() {
|
||||||
logToConsole(LOG_INFO, "[VRR.Command]: Initializing commands script ...");
|
logToConsole(LOG_INFO, "[VRR.Command]: Initializing commands script ...");
|
||||||
logToConsole(LOG_INFO, "[VRR.Command]: Initialized commands script!");
|
logToConsole(LOG_INFO, "[VRR.Command]: Initialized commands script!");
|
||||||
|
|||||||
@@ -7,6 +7,127 @@
|
|||||||
// TYPE: Server (JavaScript)
|
// TYPE: Server (JavaScript)
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Representing data for server configuration
|
||||||
|
*/
|
||||||
|
class ServerConfigData {
|
||||||
|
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 gameConfig = false;
|
let gameConfig = false;
|
||||||
|
|
||||||
@@ -653,7 +774,7 @@ function toggleServerGUICommand(command, params, client) {
|
|||||||
|
|
||||||
getServerConfig().needsSaved = true;
|
getServerConfig().needsSaved = true;
|
||||||
|
|
||||||
announceAdminAction(`ServerGUISet`, `${getPlayerName(client)}{MAINCOLOUR}`, `{adminOrange}${getPlayerName(client)}{MAINCOLOUR}`, `${getBoolRedGreenInlineColour(getServerConfig().useGUI)}${toUpperCase(getOnOffFromBool(getServerConfig().useGUI))}{MAINCOLOUR}`);
|
announceAdminAction(`ServerGUISet`, `${getPlayerName(client)}{MAINCOLOUR}`, `${getBoolRedGreenInlineColour(getServerConfig().useGUI)}${toUpperCase(getOnOffFromBool(getServerConfig().useGUI))}{MAINCOLOUR}`);
|
||||||
updateServerRules();
|
updateServerRules();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -961,6 +1082,8 @@ function loadServerConfig() {
|
|||||||
logToConsole(LOG_ERROR, `[VRR.Config] Could not load server configuration for game ${getGame()} and port ${getServerPort}`);
|
logToConsole(LOG_ERROR, `[VRR.Config] Could not load server configuration for game ${getGame()} and port ${getServerPort}`);
|
||||||
thisResource.stop();
|
thisResource.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logToConsole(LOG_DEBUG | LOG_WARN, `Server ID: ${serverConfig.databaseId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1,371 +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;
|
|
||||||
const VRR_PROMPT_VEHGIVETOCLAN = 3;
|
|
||||||
const VRR_PROMPT_HOUSEGIVETOCLAN = 4;
|
|
||||||
const VRR_PROMPT_BIZGIVETOCLAN = 5;
|
|
||||||
const VRR_PROMPT_HOUSEBUY = 6;
|
|
||||||
const VRR_PROMPT_BIZBUY = 7;
|
|
||||||
|
|
||||||
// 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.
|
|
||||||
const VRR_HOUSEOWNER_BIZ = 6; // Owned by a business. Used for apartment buildings where rent goes to business.
|
|
||||||
|
|
||||||
// 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_AREARADIO = 32; //
|
|
||||||
const VRR_ITEM_USETYPE_PERSONALRADIO = 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
|
|
||||||
const VRR_ITEM_USETYPE_LOTTOTICKET = 54; // Lotto ticket. Allows a character to enter the lottery
|
|
||||||
|
|
||||||
// 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
|
|
||||||
const VRR_RESETPASS_STATE_EMAILCONFIRM = 3; // Waiting on player to enter their email to confirm it's correct
|
|
||||||
|
|
||||||
// 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
|
|
||||||
|
|
||||||
// Discord Webhook Types
|
|
||||||
const VRR_DISCORD_WEBHOOK_NONE = 0;
|
|
||||||
const VRR_DISCORD_WEBHOOK_LOG = 1;
|
|
||||||
const VRR_DISCORD_WEBHOOK_ADMIN = 2;
|
|
||||||
|
|
||||||
// NPC Owner Types
|
|
||||||
const VRR_NPCOWNER_NONE = 0; // Not owned
|
|
||||||
const VRR_NPCOWNER_PLAYER = 1; // Owned by a player (character/subaccount)
|
|
||||||
const VRR_NPCOWNER_JOB = 2; // Owned by a job
|
|
||||||
const VRR_NPCOWNER_CLAN = 3; // Owned by a clan
|
|
||||||
const VRR_NPCOWNER_FACTION = 4; // Owned by a faction (not used at the moment)
|
|
||||||
const VRR_NPCOWNER_PUBLIC = 5; // Public NPC. Anybody can do stuff with it.
|
|
||||||
const VRR_NPCOWNER_BIZ = 6; // Owned by a business
|
|
||||||
22
scripts/server/crime.js
Normal file
22
scripts/server/crime.js
Normal 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;
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -102,7 +102,7 @@ function messageDiscordChatChannel(messageString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
messageString = removeColoursInMessage(messageString);
|
messageString = removeColoursInMessage(messageString);
|
||||||
triggerWebHook(messageString, getServerId(), VRR_DISCORD_WEBHOOK_LOG);
|
triggerDiscordWebHook(messageString, getServerId(), VRR_DISCORD_WEBHOOK_LOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -121,7 +121,7 @@ function messageDiscordEventChannel(messageString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
messageString = removeColoursInMessage(messageString);
|
messageString = removeColoursInMessage(messageString);
|
||||||
triggerWebHook(messageString, getServerId(), VRR_DISCORD_WEBHOOK_LOG);
|
triggerDiscordWebHook(messageString, getServerId(), VRR_DISCORD_WEBHOOK_LOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -140,7 +140,31 @@ function messageDiscordAdminChannel(messageString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
messageString = removeColoursInMessage(messageString);
|
messageString = removeColoursInMessage(messageString);
|
||||||
triggerWebHook(messageString, getServerId(), VRR_DISCORD_WEBHOOK_ADMIN);
|
triggerDiscordWebHook(messageString, getServerId(), VRR_DISCORD_WEBHOOK_ADMIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function triggerDiscordWebHook(messageString, serverId = getServerId(), type = VRR_DISCORD_WEBHOOK_LOG) {
|
||||||
|
if (!getGlobalConfig().discord.webhook.enabled) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let tempURL = getGlobalConfig().discord.webhook.webhookBaseURL;
|
||||||
|
tempURL = tempURL.replace("{0}", encodeURI(messageString));
|
||||||
|
tempURL = tempURL.replace("{1}", serverId);
|
||||||
|
tempURL = tempURL.replace("{2}", type);
|
||||||
|
tempURL = tempURL.replace("{3}", getGlobalConfig().discord.webhook.pass);
|
||||||
|
|
||||||
|
httpGet(
|
||||||
|
tempURL,
|
||||||
|
"",
|
||||||
|
function (data) {
|
||||||
|
|
||||||
|
},
|
||||||
|
function (data) {
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -31,19 +31,19 @@ function playerPayDay(client) {
|
|||||||
let grossIncome = getPlayerData(client).payDayAmount;
|
let grossIncome = getPlayerData(client).payDayAmount;
|
||||||
|
|
||||||
// Passive income
|
// Passive income
|
||||||
grossIncome = grossIncome + getGlobalConfig().economy.passiveIncomePerPayDay;
|
grossIncome = Math.round(grossIncome + getGlobalConfig().economy.passiveIncomePerPayDay);
|
||||||
|
|
||||||
// Payday bonus
|
// Payday bonus
|
||||||
grossIncome = grossIncome*getGlobalConfig().economy.grossIncomeMultiplier;
|
grossIncome = Math.round(grossIncome * getGlobalConfig().economy.grossIncomeMultiplier);
|
||||||
|
|
||||||
// Double bonus
|
// Double bonus
|
||||||
if (isDoubleBonusActive()) {
|
if (isDoubleBonusActive()) {
|
||||||
grossIncome = grossIncome*2;
|
grossIncome = Math.round(grossIncome * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
let incomeTaxAmount = Math.round(calculateIncomeTax(wealth));
|
let incomeTaxAmount = Math.round(calculateIncomeTax(wealth));
|
||||||
|
|
||||||
let netIncome = grossIncome-incomeTaxAmount;
|
let netIncome = Math.round(grossIncome - incomeTaxAmount);
|
||||||
|
|
||||||
messagePlayerAlert(client, "== Payday! =============================");
|
messagePlayerAlert(client, "== Payday! =============================");
|
||||||
messagePlayerInfo(client, `Paycheck: {ALTCOLOUR}$${grossIncome}`);
|
messagePlayerInfo(client, `Paycheck: {ALTCOLOUR}$${grossIncome}`);
|
||||||
@@ -167,7 +167,7 @@ function attemptRepossession(client, totalToPay) {
|
|||||||
function repossessFirstAsset(client) {
|
function repossessFirstAsset(client) {
|
||||||
let vehicles = getAllVehiclesOwnedByPlayer(client);
|
let vehicles = getAllVehiclesOwnedByPlayer(client);
|
||||||
if (vehicles.length > 0) {
|
if (vehicles.length > 0) {
|
||||||
deleteVehicle(vehicles[0])
|
deleteVehicle(vehicles[0]);
|
||||||
return getGlobalConfig().economy.upKeepCosts.upKeepPerVehicle;
|
return getGlobalConfig().economy.upKeepCosts.upKeepPerVehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,12 @@ function initEmailScript() {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendEmail(toEmail, toName, subject, body) {
|
async function sendEmail(toEmail, toName, subject, body) {
|
||||||
if (!checkForSMTPModule()) {
|
if (!checkForSMTPModule()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Promise.resolve().then(() => {
|
||||||
module.smtp.send(
|
module.smtp.send(
|
||||||
getEmailConfig().smtp.host,
|
getEmailConfig().smtp.host,
|
||||||
getEmailConfig().smtp.port,
|
getEmailConfig().smtp.port,
|
||||||
@@ -30,7 +31,9 @@ function sendEmail(toEmail, toName, subject, body) {
|
|||||||
subject,
|
subject,
|
||||||
body,
|
body,
|
||||||
getEmailConfig().smtp.from,
|
getEmailConfig().smtp.from,
|
||||||
getEmailConfig().smtp.fromName);
|
getEmailConfig().smtp.fromName
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -109,9 +109,11 @@ function onPlayerQuit(event, client, quitReasonId) {
|
|||||||
updateConnectionLogOnQuit(client, quitReasonId);
|
updateConnectionLogOnQuit(client, quitReasonId);
|
||||||
|
|
||||||
let reasonText = disconnectReasons[quitReasonId];
|
let reasonText = disconnectReasons[quitReasonId];
|
||||||
if (getPlayerData(client).customDisconnectReason != "" && getPlayerData(client).customDisconnectReason != undefined && getPlayerData(client).customDisconnectReason != false && getPlayerData(client).customDisconnectReason != null) {
|
if (getPlayerData(client) != false) {
|
||||||
|
if (getPlayerData(client).customDisconnectReason != "") {
|
||||||
reasonText = getPlayerData(client).customDisconnectReason;
|
reasonText = getPlayerData(client).customDisconnectReason;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
messageDiscordEventChannel(`👋 ${getPlayerName(client)} has left the server (${reasonText})`);
|
messageDiscordEventChannel(`👋 ${getPlayerName(client)} has left the server (${reasonText})`);
|
||||||
|
|
||||||
@@ -488,6 +490,7 @@ async function onPlayerSpawn(client) {
|
|||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
||||||
if (!getPlayerData(client)) {
|
if (!getPlayerData(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
||||||
|
getPlayerData(targetClient).customDisconnectReason = `Kicked - Spawn bug. Data invalid.`;
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -495,6 +498,7 @@ async function onPlayerSpawn(client) {
|
|||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
||||||
if (!isPlayerLoggedIn(client)) {
|
if (!isPlayerLoggedIn(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
||||||
|
getPlayerData(targetClient).customDisconnectReason = `Kicked - Tried to force spawn without logging in.`;
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -502,6 +506,7 @@ async function onPlayerSpawn(client) {
|
|||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
||||||
if (getPlayerData(client).currentSubAccount == -1) {
|
if (getPlayerData(client).currentSubAccount == -1) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
||||||
|
getPlayerData(targetClient).customDisconnectReason = `Kicked - Tried to force spawn without selecting a character.`;
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -649,7 +654,7 @@ async function onPlayerSpawn(client) {
|
|||||||
|
|
||||||
getPlayerData(client).payDayTickStart = sdl.ticks;
|
getPlayerData(client).payDayTickStart = sdl.ticks;
|
||||||
|
|
||||||
sendPlayerLocaleStrings(client);
|
//sendPlayerLocaleStrings(client);
|
||||||
|
|
||||||
// Stop playing intro music and any other radio
|
// Stop playing intro music and any other radio
|
||||||
stopRadioStreamForPlayer(client);
|
stopRadioStreamForPlayer(client);
|
||||||
|
|||||||
20
scripts/server/forensics.js
Normal file
20
scripts/server/forensics.js
Normal 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)
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
@@ -7,6 +7,43 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
class GateData {
|
||||||
|
constructor(dbAssoc = false) {
|
||||||
|
this.databaseId = 0;
|
||||||
|
this.name = "";
|
||||||
|
this.scriptName = "";
|
||||||
|
this.enabled = false;
|
||||||
|
this.position = toVector3(0.0, 0.0, 0.0);
|
||||||
|
this.locked = true;
|
||||||
|
this.ownerType = VRR_GATEOWNER_NONE;
|
||||||
|
this.ownerId = 0;
|
||||||
|
|
||||||
|
if (dbAssoc) {
|
||||||
|
this.databaseId = toInteger(dbAssoc["gate_id"]);
|
||||||
|
this.name = toString(dbAssoc["gate_name"]);
|
||||||
|
this.scriptName = toString(dbAssoc["gate_script_name"]);
|
||||||
|
this.enabled = intToBool(toInteger(dbAssoc["gate_enabled"]));
|
||||||
|
this.position = toVector3(toFloat(dbAssoc["gate_pos_x"]), toFloat(dbAssoc["gate_pos_y"]), toFloat(dbAssoc["gate_pos_z"]));
|
||||||
|
this.ownerType = toInteger(dbAssoc["gate_owner_type"]);
|
||||||
|
this.ownerId = toInteger(dbAssoc["gate_owner_id"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
function initGateScript() {
|
function initGateScript() {
|
||||||
logToConsole(LOG_INFO, `[VRR.Gate]: Initializing gate script ...`);
|
logToConsole(LOG_INFO, `[VRR.Gate]: Initializing gate script ...`);
|
||||||
logToConsole(LOG_INFO, `[VRR.Gate]: Gate script initialized successfully!`);
|
logToConsole(LOG_INFO, `[VRR.Gate]: Gate script initialized successfully!`);
|
||||||
|
|||||||
148
scripts/server/gps.js
Normal file
148
scripts/server/gps.js
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
@@ -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!");
|
||||||
@@ -25,6 +32,7 @@ function playerPromptAnswerNo(client) {
|
|||||||
case VRR_PROMPT_CREATEFIRSTCHAR:
|
case VRR_PROMPT_CREATEFIRSTCHAR:
|
||||||
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} chose not to create a first character. Kicking them from the server ...`);
|
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} chose not to create a first character. Kicking them from the server ...`);
|
||||||
showPlayerErrorGUI(client, "You don't have a character to play. Goodbye!", "No Characters");
|
showPlayerErrorGUI(client, "You don't have a character to play. Goodbye!", "No Characters");
|
||||||
|
getPlayerData(targetClient).customDisconnectReason = `Kicked - Didn't create a character`;
|
||||||
setTimeout(function () { disconnectPlayer(client); }, 5000);
|
setTimeout(function () { disconnectPlayer(client); }, 5000);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -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 ...");
|
||||||
logToConsole(LOG_INFO, "[VRR.House]: House script initialized successfully!");
|
logToConsole(LOG_INFO, "[VRR.House]: House script initialized successfully!");
|
||||||
@@ -22,7 +175,7 @@ function loadHousesFromDatabase() {
|
|||||||
let dbAssoc;
|
let dbAssoc;
|
||||||
|
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let dbQuery = queryDatabase(dbConnection, `SELECT * FROM house_main WHERE house_server = ${getServerId()}`);
|
let dbQuery = queryDatabase(dbConnection, `SELECT * FROM house_main WHERE house_deleted = 0 AND house_server = ${getServerId()}`);
|
||||||
if (dbQuery) {
|
if (dbQuery) {
|
||||||
if (dbQuery.numRows > 0) {
|
if (dbQuery.numRows > 0) {
|
||||||
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
|
|||||||
40
scripts/server/insurance.js
Normal file
40
scripts/server/insurance.js
Normal 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
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
@@ -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 ...");
|
||||||
logToConsole(LOG_INFO, "[VRR.Item]: Item script initialized successfully!");
|
logToConsole(LOG_INFO, "[VRR.Item]: Item script initialized successfully!");
|
||||||
@@ -20,7 +243,7 @@ function loadItemsFromDatabase() {
|
|||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let dbFetchAssoc;
|
let dbFetchAssoc;
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let dbQuery = queryDatabase(dbConnection, `SELECT * FROM item_main WHERE item_server = ${getServerId()}`);
|
let dbQuery = queryDatabase(dbConnection, `SELECT * FROM item_main WHERE item_deleted = 0 AND item_server = ${getServerId()}`);
|
||||||
if (dbQuery) {
|
if (dbQuery) {
|
||||||
if (dbQuery.numRows > 0) {
|
if (dbQuery.numRows > 0) {
|
||||||
while (dbFetchAssoc = fetchQueryAssoc(dbQuery)) {
|
while (dbFetchAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
@@ -42,7 +265,7 @@ function loadItemTypesFromDatabase() {
|
|||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let dbFetchAssoc;
|
let dbFetchAssoc;
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let dbQuery = queryDatabase(dbConnection, `SELECT * FROM item_type WHERE item_type_enabled = 1 AND item_type_server = ${getServerId()}`);
|
let dbQuery = queryDatabase(dbConnection, `SELECT * FROM item_type WHERE item_type_deleted = 0 AND item_type_enabled = 1 AND item_type_server = ${getServerId()}`);
|
||||||
if (dbQuery) {
|
if (dbQuery) {
|
||||||
if (getQueryNumRows(dbQuery) > 0) {
|
if (getQueryNumRows(dbQuery) > 0) {
|
||||||
while (dbFetchAssoc = fetchQueryAssoc(dbQuery)) {
|
while (dbFetchAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
@@ -561,15 +784,16 @@ function setItemTypeDropModelCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let itemTypeIndex = getItemTypeFromParams(splitParams.slice(0, -1).join(" "));
|
let itemTypeIndex = getItemTypeFromParams(splitParams.slice(0, -1).join(" "));
|
||||||
let modelId = splitParams[splitParams.length - 1];
|
let modelIndex = getObjectModelIndexFromParams(splitParams.slice(-1).join(" "));
|
||||||
|
|
||||||
if (!getItemTypeData(itemTypeIndex)) {
|
if (!getItemTypeData(itemTypeIndex)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidItemType"));
|
messagePlayerError(client, getLocaleString(client, "InvalidItemType"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getItemTypeData(itemTypeIndex).dropModel = modelId;
|
getItemTypeData(itemTypeIndex).dropModel = modelIndex;
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} set item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name} dropped object model to ${modelId}`);
|
getItemTypeData(itemTypeIndex).needsSaved = true;
|
||||||
|
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} set item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name}'s dropped object model index to ${modelIndex}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -598,6 +822,7 @@ function setItemTypeOrderPriceCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getItemTypeData(itemTypeIndex).orderPrice = orderPrice;
|
getItemTypeData(itemTypeIndex).orderPrice = orderPrice;
|
||||||
|
getItemTypeData(itemTypeIndex).needsSaved = true;
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} set item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name} {MAINCOLOUR}base price to {ALTCOLOUR}$${orderPrice}`);
|
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} set item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name} {MAINCOLOUR}base price to {ALTCOLOUR}$${orderPrice}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,7 +852,8 @@ function setItemTypeRiskMultiplierCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getItemTypeData(itemTypeIndex).riskMultiplier = riskMultiplier;
|
getItemTypeData(itemTypeIndex).riskMultiplier = riskMultiplier;
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} set item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name} {MAINCOLOUR}risk multilier to {ALTCOLOUR}$${riskMultiplier}`);
|
getItemTypeData(itemTypeIndex).needsSaved = true;
|
||||||
|
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} set item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name}{MAINCOLOUR} risk multiplier to {ALTCOLOUR}$${riskMultiplier}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -655,6 +881,7 @@ function toggleItemTypeEnabledCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getItemTypeData(itemTypeIndex).enabled = !getItemTypeData(itemTypeIndex).enabled;
|
getItemTypeData(itemTypeIndex).enabled = !getItemTypeData(itemTypeIndex).enabled;
|
||||||
|
getItemTypeData(itemTypeIndex).needsSaved = true;
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} ${getEnabledDisabledFromBool(getItemTypeData(itemTypeIndex).enabled)} item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name}`);
|
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} ${getEnabledDisabledFromBool(getItemTypeData(itemTypeIndex).enabled)} item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -684,6 +911,7 @@ function setItemTypeUseTypeCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getItemTypeData(itemTypeIndex).useType = useType;
|
getItemTypeData(itemTypeIndex).useType = useType;
|
||||||
|
getItemTypeData(itemTypeIndex).needsSaved = true;
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} set item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name}{MAINCOLOUR} use type to {ALTCOLOUR}$${useType}`);
|
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} set item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name}{MAINCOLOUR} use type to {ALTCOLOUR}$${useType}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -713,6 +941,7 @@ function setItemTypeUseValueCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getItemTypeData(itemTypeIndex).useValue = useValue;
|
getItemTypeData(itemTypeIndex).useValue = useValue;
|
||||||
|
getItemTypeData(itemTypeIndex).needsSaved = true;
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} set item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name}{MAINCOLOUR} use value to {ALTCOLOUR}$${useValue}`);
|
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} set item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name}{MAINCOLOUR} use value to {ALTCOLOUR}$${useValue}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -722,6 +951,7 @@ function playerUseItem(client, hotBarSlot) {
|
|||||||
let itemIndex = getPlayerData(client).hotBarItems[hotBarSlot];
|
let itemIndex = getPlayerData(client).hotBarItems[hotBarSlot];
|
||||||
|
|
||||||
if (itemIndex == -1) {
|
if (itemIndex == -1) {
|
||||||
|
logToConsole(LOG_DEBUG | LOG_WARN, `[VRR.Item] ${getPlayerDisplayForConsole(client)} tried to use an empty hotbar slot ${hotBarSlot}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -732,10 +962,12 @@ function playerUseItem(client, hotBarSlot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let itemData = getItemData(itemIndex);
|
let itemData = getItemData(itemIndex);
|
||||||
let itemTypeData = getItemTypeData(itemIndex);
|
let itemTypeData = getItemTypeData(itemData.itemTypeIndex);
|
||||||
let hotBarItems = getPlayerData(client).hotBarItems;
|
let hotBarItems = getPlayerData(client).hotBarItems;
|
||||||
|
|
||||||
switch (itemTypeData.useType) {
|
logToConsole(LOG_DEBUG, `[VRR.Item] ${getPlayerDisplayForConsole(client)} used a ${itemTypeData.name} (use type ${itemTypeData.useType} - ${typeof itemTypeData.useType}) item (ID: ${itemData.index}/${itemData.databaseId}, TypeID: ${itemTypeData.index}/${itemTypeData.databaseId})`);
|
||||||
|
|
||||||
|
switch (toInteger(itemTypeData.useType)) {
|
||||||
case VRR_ITEM_USETYPE_SKIN: {
|
case VRR_ITEM_USETYPE_SKIN: {
|
||||||
getPlayerData(client).itemActionItem = itemIndex;
|
getPlayerData(client).itemActionItem = itemIndex;
|
||||||
forcePlayerIntoSkinSelect(client);
|
forcePlayerIntoSkinSelect(client);
|
||||||
@@ -746,9 +978,9 @@ function playerUseItem(client, hotBarSlot) {
|
|||||||
for (let i in hotBarItems) {
|
for (let i in hotBarItems) {
|
||||||
if (hotBarItems[i] != -1) {
|
if (hotBarItems[i] != -1) {
|
||||||
if (getItemData(hotBarItems[i]) != false) {
|
if (getItemData(hotBarItems[i]) != false) {
|
||||||
if (getItemData(getItemData(hotBarItems[i]).itemTypeIndex).useType == VRR_ITEM_USETYPE_AMMO_CLIP) {
|
if (getItemTypeData(getItemData(hotBarItems[i]).itemTypeIndex).useType == VRR_ITEM_USETYPE_AMMO_CLIP) {
|
||||||
let ammoItemData = getItemData(hotBarItems[i]);
|
let ammoItemData = getItemData(hotBarItems[i]);
|
||||||
let ammoItemTypeData = getItemData(ammoItemData.itemTypeIndex);
|
let ammoItemTypeData = getItemTypeData(ammoItemData.itemTypeIndex);
|
||||||
if (ammoItemTypeData.useId == itemTypeData.databaseId) {
|
if (ammoItemTypeData.useId == itemTypeData.databaseId) {
|
||||||
givePlayerWeaponAmmo(client, ammoItemData.value);
|
givePlayerWeaponAmmo(client, ammoItemData.value);
|
||||||
itemData.value = itemData.value + ammoItemData.value;
|
itemData.value = itemData.value + ammoItemData.value;
|
||||||
@@ -869,11 +1101,6 @@ function playerUseItem(client, hotBarSlot) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VRR_ITEM_USETYPE_NONE: {
|
|
||||||
messagePlayerError(client, `The ${getItemName(itemIndex)} doesn't do anything when you try to use it.`);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case VRR_ITEM_USETYPE_VEHREPAIR: {
|
case VRR_ITEM_USETYPE_VEHREPAIR: {
|
||||||
let vehicle = getClosestVehicle(getPlayerPosition(client));
|
let vehicle = getClosestVehicle(getPlayerPosition(client));
|
||||||
if (getDistance(getPlayerPosition(client), getVehiclePosition(vehicle)) <= getGlobalConfig().vehicleRepairDistance) {
|
if (getDistance(getPlayerPosition(client), getVehiclePosition(vehicle)) <= getGlobalConfig().vehicleRepairDistance) {
|
||||||
@@ -1059,25 +1286,31 @@ function playerUseItem(client, hotBarSlot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case VRR_ITEM_USETYPE_LOTTOTICKET: {
|
case VRR_ITEM_USETYPE_LOTTOTICKET: {
|
||||||
|
messagePlayerError(client, getLocaleString(client, "ItemDoesntDoAnythingOnUse", itemTypeData.name));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VRR_ITEM_USETYPE_AREARADIO: {
|
case VRR_ITEM_USETYPE_AREARADIO: {
|
||||||
itemData.enabled = !itemData.enabled;
|
itemData.enabled = !itemData.enabled;
|
||||||
meActionToNearbyPlayers(client, `turns ${getOnOffFromBool(itemData.enabled)} the boombox radio`);
|
meActionToNearbyPlayers(client, `turns ${getOnOffFromBool(itemData.enabled)} the boombox radio`);
|
||||||
messagePlayerAlert(client, `Use /radiostation to set the radio station and drop it on the ground to play`);
|
messagePlayerAlert(client, getLocaleString(client, "ItemRadioStationTip", `{ALTCOLOUR}/radiostation{MAINCOLOUR}`));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VRR_ITEM_USETYPE_PERSONALRADIO: {
|
case VRR_ITEM_USETYPE_PERSONALRADIO: {
|
||||||
itemData.enabled = !itemData.enabled;
|
itemData.enabled = !itemData.enabled;
|
||||||
meActionToNearbyPlayers(client, `turns ${getOnOffFromBool(itemData.enabled)} the boombox radio`);
|
meActionToNearbyPlayers(client, `turns ${getOnOffFromBool(itemData.enabled)} their personal radio`);
|
||||||
messagePlayerAlert(client, `Use /radiostation to set the radio station`);
|
messagePlayerAlert(client, getLocaleString(client, "ItemRadioStationTip", `{ALTCOLOUR}/radiostation{MAINCOLOUR}`));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case VRR_ITEM_USETYPE_NONE: {
|
||||||
|
messagePlayerError(client, getLocaleString(client, "ItemDoesntDoAnythingOnUse", itemTypeData.name));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
messagePlayerError(client, `The ${itemTypeData.name} doesn't do anything when you try to use it.`);
|
messagePlayerError(client, getLocaleString(client, "ItemDoesntDoAnythingOnUse", itemTypeData.name));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1455,7 +1688,7 @@ function cachePlayerHotBarItems(client) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function deleteItem(itemId) {
|
function deleteItem(itemId, whoDeleted = -1) {
|
||||||
let owner = -1;
|
let owner = -1;
|
||||||
let ownerTypeString = "Unknown";
|
let ownerTypeString = "Unknown";
|
||||||
switch (getItemData(itemId).ownerType) {
|
switch (getItemData(itemId).ownerType) {
|
||||||
@@ -1526,7 +1759,7 @@ function deleteItem(itemId) {
|
|||||||
logToConsole(LOG_DEBUG, `Deleted item ${itemId} (DBID: ${getItemData(itemId).databaseId}, Owner Type: ${ownerTypeString}, Owner ID: ${getItemData(itemId).ownerId})`);
|
logToConsole(LOG_DEBUG, `Deleted item ${itemId} (DBID: ${getItemData(itemId).databaseId}, Owner Type: ${ownerTypeString}, Owner ID: ${getItemData(itemId).ownerId})`);
|
||||||
|
|
||||||
if (getItemData(itemId).databaseId > 0) {
|
if (getItemData(itemId).databaseId > 0) {
|
||||||
quickDatabaseQuery(`DELETE FROM item_main WHERE item_id = ${getItemData(itemId).databaseId}`);
|
quickDatabaseQuery(`UPDATE item_main SET item_deleted = 1, item_when_deleted = UNIX_TIMESTAMP() WHERE item_id = ${getItemData(itemId).databaseId}`);
|
||||||
}
|
}
|
||||||
getServerData().items[itemId] = false;
|
getServerData().items[itemId] = false;
|
||||||
setAllItemDataIndexes();
|
setAllItemDataIndexes();
|
||||||
@@ -2234,9 +2467,54 @@ function getOrderPriceForItemType(itemType) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clearPlayerItemActionState(client) {
|
function clearPlayerItemActionState(client) {
|
||||||
|
if (getPlayerData(client).itemActionItem != -1) {
|
||||||
|
switch (getPlayerData(client).itemActionState) {
|
||||||
|
case VRR_ITEM_ACTION_DROP: {
|
||||||
|
if (getItemTypeData(getItemData(getPlayerData(client).itemActionItem).itemTypeIndex).dropAnimationIndex != -1) {
|
||||||
|
makePlayerStopAnimation(client);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case VRR_ITEM_ACTION_USE: {
|
||||||
|
if (getItemTypeData(getItemData(getPlayerData(client).itemActionItem).itemTypeIndex).useAnimationIndex != -1) {
|
||||||
|
makePlayerStopAnimation(client);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case VRR_ITEM_ACTION_PICKUP: {
|
||||||
|
if (getItemTypeData(getItemData(getPlayerData(client).itemActionItem).itemTypeIndex).pickupAnimationIndex != -1) {
|
||||||
|
makePlayerStopAnimation(client);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case VRR_ITEM_ACTION_TAKE: {
|
||||||
|
if (getItemTypeData(getItemData(getPlayerData(client).itemActionItem).itemTypeIndex).takeAnimationIndex != -1) {
|
||||||
|
makePlayerStopAnimation(client);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case VRR_ITEM_ACTION_PUT: {
|
||||||
|
if (getItemTypeData(getItemData(getPlayerData(client).itemActionItem).itemTypeIndex).putAnimationIndex != -1) {
|
||||||
|
makePlayerStopAnimation(client);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case VRR_ITEM_ACTION_SWITCH: {
|
||||||
|
if (getItemTypeData(getItemData(getPlayerData(client).itemActionItem).itemTypeIndex).switchAnimationIndex != -1) {
|
||||||
|
makePlayerStopAnimation(client);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getPlayerData(client).itemActionState = VRR_ITEM_ACTION_NONE;
|
getPlayerData(client).itemActionState = VRR_ITEM_ACTION_NONE;
|
||||||
getPlayerData(client).itemActionItem = -1;
|
getPlayerData(client).itemActionItem = -1;
|
||||||
makePlayerStopAnimation(client);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -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 ...");
|
||||||
logToConsole(LOG_INFO, "[VRR.Job]: Job script initialized successfully!");
|
logToConsole(LOG_INFO, "[VRR.Job]: Job script initialized successfully!");
|
||||||
@@ -24,7 +364,7 @@ function loadJobsFromDatabase() {
|
|||||||
let dbAssoc;
|
let dbAssoc;
|
||||||
|
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
dbQuery = queryDatabase(dbConnection, `SELECT * FROM job_main WHERE job_enabled = 1 AND job_server = ${getServerId()}`);
|
dbQuery = queryDatabase(dbConnection, `SELECT * FROM job_main WHERE job_deleted = 0 AND job_enabled = 1 AND job_server = ${getServerId()}`);
|
||||||
if (dbQuery) {
|
if (dbQuery) {
|
||||||
if (dbQuery.numRows > 0) {
|
if (dbQuery.numRows > 0) {
|
||||||
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
@@ -89,7 +429,7 @@ function loadJobRoutesFromDatabase(jobDatabaseId) {
|
|||||||
let dbAssoc;
|
let dbAssoc;
|
||||||
|
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
dbQuery = queryDatabase(dbConnection, `SELECT * FROM job_route WHERE job_route_enabled = 1 AND job_route_job = ${jobDatabaseId}`);
|
dbQuery = queryDatabase(dbConnection, `SELECT * FROM job_route WHERE job_route_deleted = 0 AND job_route_enabled = 1 AND job_route_job = ${jobDatabaseId}`);
|
||||||
if (dbQuery) {
|
if (dbQuery) {
|
||||||
if (dbQuery.numRows > 0) {
|
if (dbQuery.numRows > 0) {
|
||||||
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
@@ -119,7 +459,7 @@ function loadJobRouteLocationsFromDatabase(jobRouteId) {
|
|||||||
let dbAssoc;
|
let dbAssoc;
|
||||||
|
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
dbQuery = queryDatabase(dbConnection, `SELECT * FROM job_route_loc WHERE job_route_loc_enabled = 1 AND job_route_loc_route = ${jobRouteId}`);
|
dbQuery = queryDatabase(dbConnection, `SELECT * FROM job_route_loc WHERE job_route_loc_deleted = 0 AND job_route_loc_enabled = 1 AND job_route_loc_route = ${jobRouteId}`);
|
||||||
if (dbQuery) {
|
if (dbQuery) {
|
||||||
if (dbQuery.numRows > 0) {
|
if (dbQuery.numRows > 0) {
|
||||||
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
@@ -148,7 +488,7 @@ function loadJobEquipmentsFromDatabase(jobDatabaseId) {
|
|||||||
let dbAssoc;
|
let dbAssoc;
|
||||||
|
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
dbQuery = queryDatabase(dbConnection, "SELECT * FROM `job_equip` WHERE `job_equip_enabled` = 1 AND `job_equip_job` = " + toString(jobDatabaseId));
|
dbQuery = queryDatabase(dbConnection, `SELECT * FROM job_equip WHERE job_equip_deleted = 0 AND job_equip_enabled = 1 AND job_equip_job = ${jobDatabaseId}`);
|
||||||
if (dbQuery) {
|
if (dbQuery) {
|
||||||
if (dbQuery.numRows > 0) {
|
if (dbQuery.numRows > 0) {
|
||||||
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
@@ -178,7 +518,7 @@ function loadJobLocationsFromDatabase(jobDatabaseId) {
|
|||||||
let dbAssoc;
|
let dbAssoc;
|
||||||
|
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
dbQuery = queryDatabase(dbConnection, "SELECT * FROM `job_loc` WHERE `job_loc_enabled` = 1 AND `job_loc_job` = " + toString(jobDatabaseId));
|
dbQuery = queryDatabase(dbConnection, `SELECT * FROM job_loc WHERE job_loc_deleted = 0 AND job_loc_enabled = 1 AND job_loc_job = ${jobDatabaseId}`);
|
||||||
if (dbQuery) {
|
if (dbQuery) {
|
||||||
if (dbQuery.numRows > 0) {
|
if (dbQuery.numRows > 0) {
|
||||||
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
@@ -950,8 +1290,8 @@ function reloadAllJobsCommand(command, params, client) {
|
|||||||
|
|
||||||
Promise.resolve().then(() => {
|
Promise.resolve().then(() => {
|
||||||
getServerData().jobs = loadJobsFromDatabase();
|
getServerData().jobs = loadJobsFromDatabase();
|
||||||
createJobLocationPickup(i, j);
|
createAllJobPickups();
|
||||||
createJobLocationBlip(i, j);
|
createAllJobBlips();
|
||||||
});
|
});
|
||||||
|
|
||||||
announceAdminAction("AllJobsReloaded");
|
announceAdminAction("AllJobsReloaded");
|
||||||
@@ -3106,6 +3446,10 @@ function replaceJobRouteStringsInMessage(messageText, jobId, jobRouteId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updateJobBlipsForPlayer(client) {
|
function updateJobBlipsForPlayer(client) {
|
||||||
|
if (!areServerElementsSupported()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (let i in getServerData().jobs) {
|
for (let i in getServerData().jobs) {
|
||||||
for (let j in getServerData().jobs[i].locations) {
|
for (let j in getServerData().jobs[i].locations) {
|
||||||
if (getPlayerJob(client) == 0 || getPlayerJob(client) == i) {
|
if (getPlayerJob(client) == 0 || getPlayerJob(client) == i) {
|
||||||
|
|||||||
@@ -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 ...");
|
||||||
logToConsole(LOG_INFO, "[VRR.KeyBind]: Key bind script initialized!");
|
logToConsole(LOG_INFO, "[VRR.KeyBind]: Key bind script initialized!");
|
||||||
|
|||||||
@@ -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() {
|
||||||
@@ -218,10 +257,10 @@ function enterExitPropertyCommand(command, params, client) {
|
|||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
setPlayerInCutsceneInterior(client, closestProperty.exitCutscene);
|
setPlayerInCutsceneInterior(client, closestProperty.exitCutscene);
|
||||||
setPlayerPosition(client, closestProperty.exitPosition);
|
|
||||||
setPlayerHeading(client, closestProperty.exitRotation);
|
|
||||||
setPlayerDimension(client, closestProperty.exitDimension);
|
setPlayerDimension(client, closestProperty.exitDimension);
|
||||||
setPlayerInterior(client, closestProperty.exitInterior);
|
setPlayerInterior(client, closestProperty.exitInterior);
|
||||||
|
setPlayerPosition(client, closestProperty.exitPosition);
|
||||||
|
setPlayerHeading(client, closestProperty.exitRotation);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (isFadeCameraSupported()) {
|
if (isFadeCameraSupported()) {
|
||||||
fadeCamera(client, true, 1.0);
|
fadeCamera(client, true, 1.0);
|
||||||
@@ -417,146 +456,6 @@ function listOnlineAdminsCommand(command, params, client) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a command handler function.
|
|
||||||
*
|
|
||||||
* @param {string} command - The command name used by the player
|
|
||||||
* @param {string} params - The parameters/args string used with the command by the player
|
|
||||||
* @param {Client} client - The client/player that used the command
|
|
||||||
* @return {bool} Whether or not the command was successful
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
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":
|
|
||||||
case "policestation":
|
|
||||||
blipColour = "mediumGrey"
|
|
||||||
locationType = VRR_GPS_TYPE_POLICE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "hospital":
|
|
||||||
blipColour = "mediumGrey"
|
|
||||||
locationType = VRR_GPS_TYPE_HOSPITAL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "job":
|
|
||||||
blipColour = "mediumGrey"
|
|
||||||
locationType = VRR_GPS_TYPE_JOB;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "skin":
|
|
||||||
case "skins":
|
|
||||||
case "clothes":
|
|
||||||
case "player":
|
|
||||||
blipColour = "mediumGrey"
|
|
||||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
|
||||||
useType = VRR_ITEM_USETYPE_SKIN;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "gun":
|
|
||||||
case "guns":
|
|
||||||
case "weapon":
|
|
||||||
case "weapons":
|
|
||||||
case "wep":
|
|
||||||
case "weps":
|
|
||||||
blipColour = "mediumGrey"
|
|
||||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
|
||||||
useType = VRR_ITEM_USETYPE_WEAPON;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "food":
|
|
||||||
case "eat":
|
|
||||||
blipColour = "mediumGrey"
|
|
||||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
|
||||||
useType = VRR_ITEM_USETYPE_FOOD;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "drink":
|
|
||||||
blipColour = "mediumGrey"
|
|
||||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
|
||||||
useType = VRR_ITEM_USETYPE_DRINK;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "alcohol":
|
|
||||||
case "booze":
|
|
||||||
case "bar":
|
|
||||||
blipColour = "mediumGrey"
|
|
||||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
|
||||||
useType = VRR_ITEM_USETYPE_ALCOHOL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "repair":
|
|
||||||
case "carrepair":
|
|
||||||
case "vehrepair":
|
|
||||||
case "spray":
|
|
||||||
case "fix":
|
|
||||||
blipColour = "mediumGrey"
|
|
||||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
|
||||||
useType = VRR_ITEM_USETYPE_VEHREPAIR;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "vehiclecolour":
|
|
||||||
case "vehcolour":
|
|
||||||
case "carcolour":
|
|
||||||
case "colour":
|
|
||||||
blipColour = "mediumGrey"
|
|
||||||
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 = "mediumGrey";
|
|
||||||
useType = getItemTypeData(itemTypeId).useType;
|
|
||||||
} else {
|
|
||||||
let gameLocationId = getGameLocationFromParams(params);
|
|
||||||
if (gameLocationId != false) {
|
|
||||||
position = getGameConfig().locations[getGame()][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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a command handler function.
|
* This is a command handler function.
|
||||||
*
|
*
|
||||||
@@ -881,9 +780,9 @@ function deletePlayerBlip(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getPlayerData(client).playerBlip != false) {
|
if (getPlayerData(client).playerBlip != null) {
|
||||||
destroyElement(getPlayerData(client).playerBlip);
|
deleteGameElement(getPlayerData(client).playerBlip);
|
||||||
getPlayerData(client).playerBlip = false;
|
getPlayerData(client).playerBlip = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,124 @@
|
|||||||
// 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) {
|
||||||
|
/** @member {AccountData} accountData */
|
||||||
|
this.accountData = accountData;
|
||||||
|
|
||||||
|
/** @member {Array.<SubAccountData>} subAccounts */
|
||||||
|
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;
|
||||||
|
this.customDisconnectReason = "";
|
||||||
|
this.interiorCutscene = -1;
|
||||||
|
this.playerBlip = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
function initNetworkEventsScript() {
|
function initNetworkEventsScript() {
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Client]: Initializing client script ...");
|
logToConsole(LOG_DEBUG, "[VRR.Client]: Initializing client script ...");
|
||||||
addAllNetworkEventHandlers();
|
addAllNetworkEventHandlers();
|
||||||
|
|||||||
@@ -7,6 +7,198 @@
|
|||||||
// 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)
|
||||||
|
|
||||||
|
// NPC Owner Types
|
||||||
|
const VRR_NPC_OWNER_NONE = 0; // Not owned
|
||||||
|
const VRR_NPC_OWNER_PLAYER = 1; // Owned by a player (character/subaccount)
|
||||||
|
const VRR_NPC_OWNER_JOB = 2; // Owned by a job
|
||||||
|
const VRR_NPC_OWNER_CLAN = 3; // Owned by a clan
|
||||||
|
const VRR_NPC_OWNER_FACTION = 4; // Owned by a faction (not used at the moment)
|
||||||
|
const VRR_NPC_OWNER_PUBLIC = 5; // Public NPC. Anybody can do stuff with it.
|
||||||
|
const VRR_NPC_OWNER_BIZ = 6; // Owned by a business
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
class NPCData {
|
||||||
|
constructor(dbAssoc = false) {
|
||||||
|
this.databaseId = 0;
|
||||||
|
this.serverId = 0;
|
||||||
|
this.name = "NPC";
|
||||||
|
this.skin = 0;
|
||||||
|
this.cash = 0;
|
||||||
|
this.position = toVector3(0.0, 0.0, 0.0);
|
||||||
|
this.rotation = toVector3(0.0, 0.0, 0.0);
|
||||||
|
this.scale = toVector3(1.0, 1.0, 1.0);
|
||||||
|
this.heading = 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.walkStyle = 0;
|
||||||
|
this.fightStyle = 0;
|
||||||
|
this.health = 100;
|
||||||
|
this.armour = 100;
|
||||||
|
this.currentAction = VRR_NPC_ACTION_NONE;
|
||||||
|
this.triggers = [];
|
||||||
|
this.typeFlags = 0;
|
||||||
|
this.heedThreats = false;
|
||||||
|
this.threats = 0;
|
||||||
|
this.invincible = false;
|
||||||
|
this.animationName = "";
|
||||||
|
this.ownerType = VRR_NPC_OWNER_NONE;
|
||||||
|
this.ownerId = 0;
|
||||||
|
|
||||||
|
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],
|
||||||
|
};
|
||||||
|
|
||||||
|
this.triggers = [];
|
||||||
|
|
||||||
|
if (dbAssoc) {
|
||||||
|
this.databaseId = toInteger(dbAssoc["npc_id"]);
|
||||||
|
this.serverId = toInteger(dbAssoc["npc_server"]);
|
||||||
|
this.name = dbAssoc["npc_name"];
|
||||||
|
this.skin = toInteger(dbAssoc["npc_skin"]);
|
||||||
|
this.cash = toInteger(dbAssoc["npc_cash"]);
|
||||||
|
this.position = toVector3(toFloat(dbAssoc["npc_pos_x"]), toFloat(dbAssoc["npc_pos_y"]), toFloat(dbAssoc["npc_pos_z"]));
|
||||||
|
this.rotation = toVector3(toFloat(dbAssoc["npc_rot_x"]), toFloat(dbAssoc["npc_rot_y"]), toFloat(dbAssoc["npc_rot_z"]));
|
||||||
|
this.scale = toVector3(toFloat(dbAssoc["npc_scale_x"]), toFloat(dbAssoc["npc_scale_y"]), toFloat(dbAssoc["npc_scale_z"]));
|
||||||
|
this.heading = toFloat(dbAssoc["npc_rot_z"]);
|
||||||
|
this.lastLogin = toInteger(dbAssoc["npc_when_lastlogin"]);
|
||||||
|
this.rank = toInteger(dbAssoc["npc_rank"]);
|
||||||
|
this.title = toInteger(dbAssoc["npc_title"]);
|
||||||
|
this.job = toInteger(dbAssoc["npc_job"]);
|
||||||
|
this.interior = toInteger(dbAssoc["npc_int"]);
|
||||||
|
this.dimension = toInteger(dbAssoc["npc_vw"]);
|
||||||
|
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.typeFlags = toInteger(dbAssoc["npc_type_flags"]);
|
||||||
|
this.heedThreats = intToBool(dbAssoc["npc_headthreats"]);
|
||||||
|
this.threats = toInteger(dbAssoc["npc_threats"]);
|
||||||
|
this.invincible = intToBool(dbAssoc["npc_invincible"]);
|
||||||
|
this.animationName = intToBool(dbAssoc["npc_animation"]);
|
||||||
|
|
||||||
|
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() {
|
||||||
logToConsole(LOG_INFO, "[VRR.NPC]: Initializing NPC script ...");
|
logToConsole(LOG_INFO, "[VRR.NPC]: Initializing NPC script ...");
|
||||||
logToConsole(LOG_INFO, "[VRR.NPC]: NPC script initialized successfully!");
|
logToConsole(LOG_INFO, "[VRR.NPC]: NPC script initialized successfully!");
|
||||||
@@ -297,7 +489,7 @@ function spawnAllNPCs() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function deleteNPCCommand(command, params, client) {
|
function deleteNPCCommand(command, params, client) {
|
||||||
let closestNPC = getClosestNPC(getPlayerPosition(client));
|
let closestNPC = getClosestNPC(getPlayerPosition(client), getPlayerDimension(client), getPlayerInterior(client));
|
||||||
|
|
||||||
if (!getNPCData(closestNPC)) {
|
if (!getNPCData(closestNPC)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidNPC"));
|
messagePlayerError(client, getLocaleString(client, "InvalidNPC"));
|
||||||
@@ -333,7 +525,7 @@ function setNPCAnimationCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let closestNPC = getClosestNPC(getPlayerPosition(client));
|
let closestNPC = getClosestNPC(getPlayerPosition(client), getPlayerDimension(client), getPlayerInterior(client));
|
||||||
let animationId = getAnimationFromParams(getParam(params, " ", 1));
|
let animationId = getAnimationFromParams(getParam(params, " ", 1));
|
||||||
let animationPositionOffset = 1;
|
let animationPositionOffset = 1;
|
||||||
|
|
||||||
@@ -370,7 +562,7 @@ function setNPCNameCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let closestNPC = getClosestNPC(getPlayerPosition(client));
|
let closestNPC = getClosestNPC(getPlayerPosition(client), getPlayerDimension(client), getPlayerInterior(client));
|
||||||
let name = params;
|
let name = params;
|
||||||
|
|
||||||
if (!getNPCData(closestNPC)) {
|
if (!getNPCData(closestNPC)) {
|
||||||
@@ -389,7 +581,7 @@ function setNPCNameCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function toggleNPCLookAtClosestPlayerCommand(command, params, client) {
|
function toggleNPCLookAtClosestPlayerCommand(command, params, client) {
|
||||||
let closestNPC = getClosestNPC(getPlayerPosition(client));
|
let closestNPC = getClosestNPC(getPlayerPosition(client), getPlayerDimension(client), getPlayerInterior(client));
|
||||||
|
|
||||||
if (!getNPCData(closestNPC)) {
|
if (!getNPCData(closestNPC)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidNPC"));
|
messagePlayerError(client, getLocaleString(client, "InvalidNPC"));
|
||||||
@@ -423,28 +615,28 @@ function getNPCInfoCommand(command, params, client) {
|
|||||||
let ownerName = "Nobody";
|
let ownerName = "Nobody";
|
||||||
let ownerType = "None";
|
let ownerType = "None";
|
||||||
switch (npcData.ownerType) {
|
switch (npcData.ownerType) {
|
||||||
case VRR_NPCOWNER_CLAN:
|
case VRR_NPC_OWNER_CLAN:
|
||||||
ownerName = getClanData(getClanIdFromDatabaseId(npcData.ownerId)).name;
|
ownerName = getClanData(getClanIdFromDatabaseId(npcData.ownerId)).name;
|
||||||
ownerType = "clan";
|
ownerType = "clan";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_NPCOWNER_JOB:
|
case VRR_NPC_OWNER_JOB:
|
||||||
ownerName = getJobData(getJobIdFromDatabaseId(npcData.ownerId)).name;
|
ownerName = getJobData(getJobIdFromDatabaseId(npcData.ownerId)).name;
|
||||||
ownerType = "job";
|
ownerType = "job";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_NPCOWNER_PLAYER:
|
case VRR_NPC_OWNER_PLAYER:
|
||||||
let subAccountData = loadSubAccountFromId(npcData.ownerId);
|
let subAccountData = loadSubAccountFromId(npcData.ownerId);
|
||||||
ownerName = `${subAccountData.firstName} ${subAccountData.lastName} [${subAccountData.databaseId}]`;
|
ownerName = `${subAccountData.firstName} ${subAccountData.lastName} [${subAccountData.databaseId}]`;
|
||||||
ownerType = "player";
|
ownerType = "player";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_NPCOWNER_BIZ:
|
case VRR_NPC_OWNER_BIZ:
|
||||||
ownerName = getBusinessData(getBusinessIdFromDatabaseId(npcData.ownerId)).name;
|
ownerName = getBusinessData(getBusinessIdFromDatabaseId(npcData.ownerId)).name;
|
||||||
ownerType = "business";
|
ownerType = "business";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_NPCOWNER_PUBLIC:
|
case VRR_NPC_OWNER_PUBLIC:
|
||||||
ownerName = "Nobody";
|
ownerName = "Nobody";
|
||||||
ownerType = "public";
|
ownerType = "public";
|
||||||
break;
|
break;
|
||||||
@@ -471,12 +663,9 @@ function getNPCInfoCommand(command, params, client) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getClosestNPC(position) {
|
function getClosestNPC(position, interior, dimension) {
|
||||||
let npcs = getServerData().npcs;
|
let npcs = getServerData().npcs;
|
||||||
|
|
||||||
let interior = getPlayerInterior(client);
|
|
||||||
let dimension = getPlayerDimension(client);
|
|
||||||
|
|
||||||
let closest = 0;
|
let closest = 0;
|
||||||
for (let i in npcs) {
|
for (let i in npcs) {
|
||||||
if (getDistance(npcs[i].ped.position, position) < getDistance(npcs[closest].ped.position, position) && npcs[closest].interior == interior && npcs[closest].dimension == dimension) {
|
if (getDistance(npcs[i].ped.position, position) < getDistance(npcs[closest].ped.position, position) && npcs[closest].interior == interior && npcs[closest].dimension == dimension) {
|
||||||
|
|||||||
@@ -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)
|
|
||||||
// ===========================================================================
|
|
||||||
@@ -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)
|
|
||||||
// ===========================================================================
|
|
||||||
@@ -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)
|
|
||||||
// ===========================================================================
|
|
||||||
@@ -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)
|
|
||||||
// ===========================================================================
|
|
||||||
@@ -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)
|
|
||||||
// ===========================================================================
|
|
||||||
@@ -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)
|
|
||||||
// ===========================================================================
|
|
||||||
@@ -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)
|
|
||||||
// ===========================================================================
|
|
||||||
@@ -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)
|
|
||||||
// ===========================================================================
|
|
||||||
@@ -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);
|
|
||||||
setVehicleLocked(closestTaxi, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
@@ -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 ...");
|
||||||
logToConsole(LOG_INFO, "[VRR.Radio]: Radio script initialized successfully!");
|
logToConsole(LOG_INFO, "[VRR.Radio]: Radio script initialized successfully!");
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ function kickClientCommand(command, params, client) {
|
|||||||
|
|
||||||
//getPlayerData(targetClient).customDisconnectReason = reason;
|
//getPlayerData(targetClient).customDisconnectReason = reason;
|
||||||
announceAdminAction(`PlayerKicked`, getPlayerName(targetClient));
|
announceAdminAction(`PlayerKicked`, getPlayerName(targetClient));
|
||||||
targetdisconnectPlayer(client);
|
getPlayerData(targetClient).customDisconnectReason = `Kicked - ${reason}`;
|
||||||
|
disconnectPlayer(targetClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -85,7 +86,6 @@ function setStaffTitleCommand(command, params, client) {
|
|||||||
getPlayerData(targetClient).accountData.staffTitle = staffTitle;
|
getPlayerData(targetClient).accountData.staffTitle = staffTitle;
|
||||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set {ALTCOLOUR}${getPlayerName(targetClient)}'s{MAINCOLOUR} staff title to ${staffTitle}`);
|
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set {ALTCOLOUR}${getPlayerName(targetClient)}'s{MAINCOLOUR} staff title to ${staffTitle}`);
|
||||||
messagePlayerAlert(targetClient, `${getPlayerName(client)} set your staff title to ${staffTitle}`);
|
messagePlayerAlert(targetClient, `${getPlayerName(client)} set your staff title to ${staffTitle}`);
|
||||||
//targetdisconnectPlayer(client);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
function initServerScripts() {
|
function initServerScripts() {
|
||||||
checkForAllRequiredModules();
|
checkForAllRequiredModules();
|
||||||
|
|
||||||
initClassScript();
|
|
||||||
initDatabaseScript();
|
initDatabaseScript();
|
||||||
initConfigScript();
|
initConfigScript();
|
||||||
initEmailScript();
|
initEmailScript();
|
||||||
@@ -118,6 +117,7 @@ function loadServerDataFromDatabase() {
|
|||||||
|
|
||||||
// Always load these regardless of "test server" status
|
// Always load these regardless of "test server" status
|
||||||
getServerData().allowedSkins = getAllowedSkins(getGame());
|
getServerData().allowedSkins = getAllowedSkins(getGame());
|
||||||
|
getServerData().itemTypes = loadItemTypesFromDatabase();
|
||||||
|
|
||||||
// Translation Cache
|
// Translation Cache
|
||||||
//getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
//getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
||||||
@@ -127,7 +127,6 @@ function loadServerDataFromDatabase() {
|
|||||||
|
|
||||||
// Only load these if the server isn't a testing/dev server
|
// Only load these if the server isn't a testing/dev server
|
||||||
if (!getServerConfig().devServer) {
|
if (!getServerConfig().devServer) {
|
||||||
getServerData().itemTypes = loadItemTypesFromDatabase();
|
|
||||||
getServerData().items = loadItemsFromDatabase();
|
getServerData().items = loadItemsFromDatabase();
|
||||||
getServerData().businesses = loadBusinessesFromDatabase();
|
getServerData().businesses = loadBusinessesFromDatabase();
|
||||||
getServerData().houses = loadHousesFromDatabase();
|
getServerData().houses = loadHousesFromDatabase();
|
||||||
|
|||||||
@@ -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!");
|
||||||
@@ -245,9 +355,9 @@ function showCharacterSelectToClient(client) {
|
|||||||
//}, 500);
|
//}, 500);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select GUI`);
|
logToConsole(LOG_DEBUG, `[VRR.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select GUI`);
|
||||||
} else {
|
} else {
|
||||||
let charactersList = getPlayerData(client).subAccounts.map(sacct, index => `{teal}${index}: {ALTCOLOUR}${sacct.name}`);
|
let charactersList = getPlayerData(client).subAccounts.map((sacct, index) => `{teal}${index + 1}: {ALTCOLOUR}${sacct.firstName} ${sacct.lastName}`);
|
||||||
let chunkedList = splitArrayIntoChunks(charactersList, 5);
|
let chunkedList = splitArrayIntoChunks(charactersList, 5);
|
||||||
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderCharacterListSelf")));
|
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderCharactersListSelf")));
|
||||||
for (let i in chunkedList) {
|
for (let i in chunkedList) {
|
||||||
messagePlayerNormal(client, chunkedList[i].join("{MAINCOLOUR}, "));
|
messagePlayerNormal(client, chunkedList[i].join("{MAINCOLOUR}, "));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,14 +237,14 @@ function checkPayDays() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showRandomTipToAllPlayers() {
|
function showRandomTipToAllPlayers() {
|
||||||
let tipId = getRandom(0, randomTips.length-1);
|
|
||||||
|
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for (let i in clients) {
|
for (let i in clients) {
|
||||||
if (isClientInitialized(clients[i])) {
|
if (isClientInitialized(clients[i])) {
|
||||||
if (isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
|
if (isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
|
||||||
if (!doesPlayerHaveRandomTipsDisabled(clients[i])) {
|
if (!doesPlayerHaveRandomTipsDisabled(clients[i])) {
|
||||||
messagePlayerTimedRandomTip(null, randomTips[tipId]);
|
let localeId = getPlayerLocaleId(clients[i]);
|
||||||
|
let tipId = getRandom(0, getServerData().localeStrings[localeId]["RandomTips"].length - 1);
|
||||||
|
messagePlayerTip(clients[i], getGroupedLocaleString(clients[i], "RandomTips", tipId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -394,30 +394,6 @@ function getClientFromSyncerId(syncerId) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function triggerWebHook(messageString, serverId = getServerId(), type = VRR_DISCORD_WEBHOOK_LOG) {
|
|
||||||
if(!getGlobalConfig().discord.webhook.enabled) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
let tempURL = getGlobalConfig().discord.webhook.webhookBaseURL;
|
|
||||||
tempURL = tempURL.replace("{0}", encodeURI(messageString));
|
|
||||||
tempURL = tempURL.replace("{1}", serverId);
|
|
||||||
tempURL = tempURL.replace("{2}", type);
|
|
||||||
tempURL = tempURL.replace("{3}", getGlobalConfig().discord.webhook.pass);
|
|
||||||
|
|
||||||
httpGet(
|
|
||||||
tempURL,
|
|
||||||
"",
|
|
||||||
function(data) {
|
|
||||||
|
|
||||||
},
|
|
||||||
function(data) {
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function clearTemporaryVehicles() {
|
function clearTemporaryVehicles() {
|
||||||
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
||||||
for (let i in vehicles) {
|
for (let i in vehicles) {
|
||||||
@@ -452,6 +428,7 @@ function clearTemporaryPeds() {
|
|||||||
|
|
||||||
function kickAllClients() {
|
function kickAllClients() {
|
||||||
getClients().forEach((client) => {
|
getClients().forEach((client) => {
|
||||||
|
getPlayerData(client).customDisconnectReason = `Kicked - All clients are being disconnected`;
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,164 @@
|
|||||||
// 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;
|
||||||
|
this.interior = 0;
|
||||||
|
this.dimension = 0;
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
// 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.licensePlate = "";
|
||||||
|
|
||||||
|
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"]));
|
||||||
|
this.interior = toInteger(dbAssoc["veh_int"]);
|
||||||
|
this.dimension = toInteger(dbAssoc["veh_vw"]);
|
||||||
|
|
||||||
|
// 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.licensePlate = toInteger(dbAssoc["veh_license_plate"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
function initVehicleScript() {
|
function initVehicleScript() {
|
||||||
logToConsole(LOG_INFO, "[VRR.Vehicle]: Initializing vehicle script ...");
|
logToConsole(LOG_INFO, "[VRR.Vehicle]: Initializing vehicle script ...");
|
||||||
logToConsole(LOG_INFO, "[VRR.Vehicle]: Vehicle script initialized successfully!");
|
logToConsole(LOG_INFO, "[VRR.Vehicle]: Vehicle script initialized successfully!");
|
||||||
@@ -183,7 +341,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;
|
||||||
@@ -346,7 +504,7 @@ function deleteVehicleCommand(command, params, client) {
|
|||||||
let dataIndex = getEntityData(vehicle, "vrr.dataSlot");
|
let dataIndex = getEntityData(vehicle, "vrr.dataSlot");
|
||||||
let vehicleName = getVehicleName(vehicle);
|
let vehicleName = getVehicleName(vehicle);
|
||||||
|
|
||||||
quickDatabaseQuery(`DELETE FROM veh_main WHERE veh_id = ${getVehicleData(vehicle).databaseId}`);
|
quickDatabaseQuery(`UPDATE veh_main SET veh_deleted = 1 WHERE veh_id = ${getVehicleData(vehicle).databaseId}`);
|
||||||
|
|
||||||
getServerData().vehicles.splice(dataIndex, 1);
|
getServerData().vehicles.splice(dataIndex, 1);
|
||||||
destroyElement(vehicle);
|
destroyElement(vehicle);
|
||||||
|
|||||||
@@ -97,6 +97,20 @@ 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
|
||||||
|
|
||||||
// Body Parts for Skin Select (IV for now, but might do other games when I can add accessory objects)
|
// Body Parts for Skin Select (IV for now, but might do other games when I can add accessory objects)
|
||||||
const VRR_SKINSELECT_NONE = 0;
|
const VRR_SKINSELECT_NONE = 0;
|
||||||
const VRR_SKINSELECT_SKIN = 1;
|
const VRR_SKINSELECT_SKIN = 1;
|
||||||
|
|||||||
@@ -169,6 +169,16 @@ let supportedFeatures = {
|
|||||||
[VRR_GAME_MAFIA_ONE]: false,
|
[VRR_GAME_MAFIA_ONE]: false,
|
||||||
[VRR_GAME_MAFIA_TWO]: false,
|
[VRR_GAME_MAFIA_TWO]: false,
|
||||||
[VRR_GAME_MAFIA_THREE]: false
|
[VRR_GAME_MAFIA_THREE]: false
|
||||||
|
},
|
||||||
|
interior: {
|
||||||
|
[VRR_GAME_GTA_III]: false,
|
||||||
|
[VRR_GAME_GTA_VC]: true,
|
||||||
|
[VRR_GAME_GTA_SA]: true,
|
||||||
|
[VRR_GAME_GTA_IV]: false,
|
||||||
|
[VRR_GAME_GTA_IV_EFLC]: false,
|
||||||
|
[VRR_GAME_MAFIA_ONE]: false,
|
||||||
|
[VRR_GAME_MAFIA_TWO]: false,
|
||||||
|
[VRR_GAME_MAFIA_THREE]: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4008,6 +4018,20 @@ let gameData = {
|
|||||||
[170, "Grenade"],
|
[170, "Grenade"],
|
||||||
[182, "RemoteDetonator"],
|
[182, "RemoteDetonator"],
|
||||||
[1319, "GenericPackageWhite"],
|
[1319, "GenericPackageWhite"],
|
||||||
|
[1343, "WoodenBox"],
|
||||||
|
[1339, "CardboardBox"],
|
||||||
|
[1336, "RustyBarrel"],
|
||||||
|
[1348, "TrashDumpster"],
|
||||||
|
[1338, "WoodenPallet"],
|
||||||
|
[1360, "TrafficCone"],
|
||||||
|
[1310, "WashingMachine"],
|
||||||
|
[1347, "TrashBin"],
|
||||||
|
[1396, "MailBox"],
|
||||||
|
[1359, "OrangeRoundRoadBarrier"],
|
||||||
|
[1398, "ParkBench"],
|
||||||
|
[1344, "RedBarrel"],
|
||||||
|
[1349, "StraightRoadBarrier"]
|
||||||
|
[1337, "YellowBarrel"],
|
||||||
],
|
],
|
||||||
[VRR_GAME_GTA_VC]: [ // GTA VC
|
[VRR_GAME_GTA_VC]: [ // GTA VC
|
||||||
[259, "BrassKnuckles"],
|
[259, "BrassKnuckles"],
|
||||||
@@ -4769,6 +4793,8 @@ let gameData = {
|
|||||||
[VRR_GAME_GTA_III]: [1],
|
[VRR_GAME_GTA_III]: [1],
|
||||||
[VRR_GAME_GTA_VC]: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
|
[VRR_GAME_GTA_VC]: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
|
||||||
[VRR_GAME_GTA_SA]: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
[VRR_GAME_GTA_SA]: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
||||||
|
[VRR_GAME_GTA_IV]: [1, 2, 3],
|
||||||
|
[VRR_GAME_GTA_IV_EFLC]: [1, 2, 3],
|
||||||
},
|
},
|
||||||
blipSprites: {
|
blipSprites: {
|
||||||
[VRR_GAME_GTA_III]: { // GTA III
|
[VRR_GAME_GTA_III]: { // GTA III
|
||||||
@@ -5724,6 +5750,8 @@ let gameData = {
|
|||||||
Apartment1: [toVector3(891.87, -308.28, 8.72), 0, false, -1],
|
Apartment1: [toVector3(891.87, -308.28, 8.72), 0, false, -1],
|
||||||
JailCell: [toVector3(328.40, -1093.31, 25.98), 0, false, -1],
|
JailCell: [toVector3(328.40, -1093.31, 25.98), 0, false, -1],
|
||||||
Church: [toVector3(13.87, -1122.43, 26.12), 0, false, -1],
|
Church: [toVector3(13.87, -1122.43, 26.12), 0, false, -1],
|
||||||
|
Mansion: [toVector3(1461.00, -173.87, 55.78), 0, false, -1],
|
||||||
|
Garage: [toVector3(-420.69, 289.86, 62.96), 0, false, -1],
|
||||||
},
|
},
|
||||||
[VRR_GAME_GTA_VC]: { // GTA VC
|
[VRR_GAME_GTA_VC]: { // GTA VC
|
||||||
Mall: [toVector3(379.62, 1007.00, 19.22), 4, false, -1],
|
Mall: [toVector3(379.62, 1007.00, 19.22), 4, false, -1],
|
||||||
|
|||||||
Reference in New Issue
Block a user