Mass convert to tabs + fix veh buy ownership
This commit is contained in:
@@ -10,8 +10,8 @@
|
||||
// ===========================================================================
|
||||
|
||||
function initBanScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Ban]: Initializing ban script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.Ban]: Ban script initialized!");
|
||||
logToConsole(LOG_INFO, "[VRR.Ban]: Initializing ban script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.Ban]: Ban script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -22,22 +22,22 @@ function accountBanCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let reason = splitParams.slice(1).join(" ");
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let reason = splitParams.slice(1).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent banning admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
||||
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
||||
// Prevent banning admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
||||
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
||||
|
||||
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been account banned.`);
|
||||
banAccount(getPlayerData(targetClient).accountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
||||
@@ -52,27 +52,27 @@ function subAccountBanCommand(command, params, client, fromDiscord) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let reason = splitParams.slice(1).join(" ");
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let reason = splitParams.slice(1).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
return false;
|
||||
}
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent banning admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
||||
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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}`);
|
||||
|
||||
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been character banned.`);
|
||||
banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
||||
banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
||||
|
||||
disconnectPlayer(client);
|
||||
disconnectPlayer(client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -81,28 +81,28 @@ function ipBanCommand(command, params, client, fromDiscord) {
|
||||
if(areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let reason = splitParams.slice(1).join(" ");
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let reason = splitParams.slice(1).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
return false;
|
||||
}
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent banning admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
||||
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been IP banned.`);
|
||||
banIPAddress(targetClient.ip, getPlayerData(client).accountData.databaseId, reason);
|
||||
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been IP banned.`);
|
||||
banIPAddress(targetClient.ip, getPlayerData(client).accountData.databaseId, reason);
|
||||
|
||||
server.banIP(targetClient.ip);
|
||||
targetClient.disconnect();
|
||||
server.banIP(targetClient.ip);
|
||||
targetClient.disconnect();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -111,190 +111,189 @@ function subNetBanCommand(command, params, client, fromDiscord) {
|
||||
if(areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let octetAmount = Number(getParam(params, " ", 2));
|
||||
let reason = splitParams.slice(2).join(" ");
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let octetAmount = Number(getParam(params, " ", 2));
|
||||
let reason = splitParams.slice(2).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
return false;
|
||||
}
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent banning admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
||||
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been subnet banned`);
|
||||
banSubNet(targetClient.ip, getSubNet(targetClient.ip, octetAmount), getPlayerData(client).accountData.databaseId, reason);
|
||||
|
||||
server.banIP(targetClient.ip);
|
||||
server.banIP(targetClient.ip);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function banAccount(accountId, adminAccountId, reason) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let safeReason = dbConnection.escapetoString(reason);
|
||||
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_ACCOUNT}, ${accountId}, ${adminAccountId}, '${safeReason}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let safeReason = dbConnection.escapetoString(reason);
|
||||
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_ACCOUNT}, ${accountId}, ${adminAccountId}, '${safeReason}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function banSubAccount(subAccountId, adminAccountId, reason) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let safeReason = dbConnection.escapetoString(reason);
|
||||
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBACCOUNT}, ${subAccountId}, ${adminAccountId}, '${safeReason}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let safeReason = dbConnection.escapetoString(reason);
|
||||
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBACCOUNT}, ${subAccountId}, ${adminAccountId}, '${safeReason}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function banIPAddress(ipAddress, adminAccountId, reason) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let safeReason = dbConnection.escapetoString(reason);
|
||||
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_IPADDRESS}, INET_ATON(${ipAddress}), ${adminAccountId}, '${safeReason}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let safeReason = dbConnection.escapetoString(reason);
|
||||
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_IPADDRESS}, INET_ATON(${ipAddress}), ${adminAccountId}, '${safeReason}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function banSubNet(ipAddressStart, ipAddressEnd, adminAccountId, reason) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let safeReason = dbConnection.escapetoString(reason);
|
||||
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_ip_start, ban_ip_end, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBNET}, INET_ATON(${ipAddressStart}), INET_ATON(${ipAddressEnd}), ${adminAccountId}, '${safeReason}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let safeReason = dbConnection.escapetoString(reason);
|
||||
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_ip_start, ban_ip_end, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBNET}, INET_ATON(${ipAddressStart}), INET_ATON(${ipAddressEnd}), ${adminAccountId}, '${safeReason}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function unbanAccount(accountId, adminAccountId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_ACCOUNT} AND ban_detail=${accountId}`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_ACCOUNT} AND ban_detail=${accountId}`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function unbanSubAccount(subAccountId, adminAccountId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBACCOUNT} AND ban_detail=${subAccountId}`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBACCOUNT} AND ban_detail=${subAccountId}`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function unbanIPAddress(ipAddress, adminAccountId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_IPADDRESS} AND ban_detail=INET_ATON(${ipAddress})`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_IPADDRESS} AND ban_detail=INET_ATON(${ipAddress})`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function unbanSubNet(ipAddressStart, ipAddressEnd, adminAccountId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBNET} AND ban_ip_start=INET_ATON(${ipAddressStart}) AND ban_ip_end=INET_ATON(${ipAddressEnd})`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBNET} AND ban_ip_start=INET_ATON(${ipAddressStart}) AND ban_ip_end=INET_ATON(${ipAddressEnd})`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isAccountBanned(accountId) {
|
||||
let bans = getServerData().bans;
|
||||
for(let i in bans) {
|
||||
if(bans[i].type == VRR_BANTYPE_ACCOUNT) {
|
||||
if(bans[i].detail == accountId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
let bans = getServerData().bans;
|
||||
for(let i in bans) {
|
||||
if(bans[i].type == VRR_BANTYPE_ACCOUNT) {
|
||||
if(bans[i].detail == accountId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isSubAccountBanned(subAccountId) {
|
||||
let bans = getServerData().bans;
|
||||
for(let i in bans) {
|
||||
if(bans[i].type == VRR_BANTYPE_SUBACCOUNT) {
|
||||
if(bans[i].detail == subAccountId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
let bans = getServerData().bans;
|
||||
for(let i in bans) {
|
||||
if(bans[i].type == VRR_BANTYPE_SUBACCOUNT) {
|
||||
if(bans[i].detail == subAccountId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isIpAddressBanned(ipAddress) {
|
||||
let bans = getServerData().bans;
|
||||
for(let i in bans) {
|
||||
if(bans[i].type == VRR_BANTYPE_IPADDRESS) {
|
||||
if(bans[i].detail == ipAddress) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
let bans = getServerData().bans;
|
||||
for(let i in bans) {
|
||||
if(bans[i].type == VRR_BANTYPE_IPADDRESS) {
|
||||
if(bans[i].detail == ipAddress) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -16,31 +16,31 @@ function initDiscordScript() {
|
||||
|
||||
/*
|
||||
addEventHandler("OnDiscordCommand", function(command, params, discordUser) {
|
||||
let commandData = getCommand(command);
|
||||
let commandData = getCommand(command);
|
||||
|
||||
if(!commandData) {
|
||||
messagePlayerError(discordUser, "That command does not exist!");
|
||||
return false;
|
||||
}
|
||||
if(!commandData) {
|
||||
messagePlayerError(discordUser, "That command does not exist!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isCommandAllowedOnDiscord(command)) {
|
||||
messagePlayerError(discordUser, "That command can not be used on Discord!");
|
||||
return false;
|
||||
}
|
||||
if(isCommandAllowedOnDiscord(command)) {
|
||||
messagePlayerError(discordUser, "That command can not be used on Discord!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(doesClientHavePermission(discordUser, getCommandRequiredPermissions(command))) {
|
||||
messagePlayerError(discordUser, "You do not have permission to use that command!");
|
||||
return false;
|
||||
}
|
||||
if(doesClientHavePermission(discordUser, getCommandRequiredPermissions(command))) {
|
||||
messagePlayerError(discordUser, "You do not have permission to use that command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
commandData.handlerFunction(command, params, discordUser);
|
||||
commandData.handlerFunction(command, params, discordUser);
|
||||
});
|
||||
*/
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messageDiscordUser(discordUser, messageText) {
|
||||
let socketData = JSON.stringify({
|
||||
let socketData = JSON.stringify({
|
||||
type: "chat.message.text",
|
||||
payload: {
|
||||
author: discordUser.name,
|
||||
@@ -53,88 +53,88 @@ function messageDiscordUser(discordUser, messageText) {
|
||||
// ===========================================================================
|
||||
|
||||
function sendDiscordSocketData(socketData) {
|
||||
if(!getDiscordSocket()) {
|
||||
return false;
|
||||
}
|
||||
if(!getDiscordSocket()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getDiscordSocket().send(module.hash.encodeBase64(socketData) + "\r\n");
|
||||
getDiscordSocket().send(module.hash.encodeBase64(socketData) + "\r\n");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isClientFromDiscord(client) {
|
||||
if(client == null) {
|
||||
return false;
|
||||
}
|
||||
if(client == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(client instanceof Client) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
if(client instanceof Client) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getDiscordSocket() {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getDiscordUserData(discordUserId) {
|
||||
return loadAccountFromDiscordUserId(discordUserId);
|
||||
return loadAccountFromDiscordUserId(discordUserId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messageDiscordChatChannel(message) {
|
||||
if(!getServerConfig().discordConfig.sendChat) {
|
||||
return false;
|
||||
}
|
||||
if(!getServerConfig().discordConfig.sendChat) {
|
||||
return false;
|
||||
}
|
||||
|
||||
message = removeColoursInMessage(message);
|
||||
console.warn(message);
|
||||
let payloadData = {
|
||||
"username": "Chat",
|
||||
"content": message,
|
||||
};
|
||||
message = removeColoursInMessage(message);
|
||||
console.warn(message);
|
||||
let payloadData = {
|
||||
"username": "Chat",
|
||||
"content": message,
|
||||
};
|
||||
|
||||
triggerWebHook(getServerConfig().discordConfig.chatChannelWebHookURL, JSON.stringify(payloadData));
|
||||
triggerWebHook(getServerConfig().discordConfig.chatChannelWebHookURL, JSON.stringify(payloadData));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messageDiscordAdminChannel(message) {
|
||||
if(!getServerConfig().discordConfig.sendAdminEvents) {
|
||||
return false;
|
||||
}
|
||||
if(!getServerConfig().discordConfig.sendAdminEvents) {
|
||||
return false;
|
||||
}
|
||||
|
||||
message = removeColoursInMessage(message);
|
||||
console.warn(message);
|
||||
let payloadData = {
|
||||
"username": "Admin Event",
|
||||
"content": message,
|
||||
};
|
||||
message = removeColoursInMessage(message);
|
||||
console.warn(message);
|
||||
let payloadData = {
|
||||
"username": "Admin Event",
|
||||
"content": message,
|
||||
};
|
||||
|
||||
triggerWebHook(getServerConfig().discordConfig.adminChannelWebHookURL, JSON.stringify(payloadData));
|
||||
triggerWebHook(getServerConfig().discordConfig.adminChannelWebHookURL, JSON.stringify(payloadData));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messageDiscordEventChannel(message) {
|
||||
if(!getServerConfig().discordConfig.sendEvents) {
|
||||
return false;
|
||||
}
|
||||
if(!getServerConfig().discordConfig.sendEvents) {
|
||||
return false;
|
||||
}
|
||||
|
||||
message = removeColoursInMessage(message);
|
||||
console.warn(message);
|
||||
let payloadData = {
|
||||
"username": "Event",
|
||||
"content": message,
|
||||
};
|
||||
message = removeColoursInMessage(message);
|
||||
console.warn(message);
|
||||
let payloadData = {
|
||||
"username": "Event",
|
||||
"content": message,
|
||||
};
|
||||
|
||||
triggerWebHook(getServerConfig().discordConfig.eventChannelWebHookURL, JSON.stringify(payloadData));
|
||||
triggerWebHook(getServerConfig().discordConfig.eventChannelWebHookURL, JSON.stringify(payloadData));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -8,47 +8,47 @@
|
||||
// ===========================================================================
|
||||
|
||||
function initEmailScript() {
|
||||
if(!checkForSMTPModule()) {
|
||||
return false;
|
||||
}
|
||||
if(!checkForSMTPModule()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_INFO, "[VRR.Email]: Initializing email script ...");
|
||||
emailConfig = loadEmailConfiguration();
|
||||
emailConfig = loadEmailConfiguration();
|
||||
logToConsole(LOG_INFO, "[VRR.Email]: Email script initialized successfully!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendEmail(toEmail, toName, subject, body) {
|
||||
if(!checkForSMTPModule()) {
|
||||
return false;
|
||||
}
|
||||
if(!checkForSMTPModule()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
module.smtp.send(
|
||||
getEmailConfig().smtp.host,
|
||||
getEmailConfig().smtp.port,
|
||||
intToBool(getEmailConfig().smtp.useTLS),
|
||||
getEmailConfig().smtp.username,
|
||||
getEmailConfig().smtp.password,
|
||||
toEmail,
|
||||
toName,
|
||||
subject,
|
||||
body,
|
||||
getEmailConfig().smtp.from,
|
||||
getEmailConfig().smtp.fromName);
|
||||
module.smtp.send(
|
||||
getEmailConfig().smtp.host,
|
||||
getEmailConfig().smtp.port,
|
||||
intToBool(getEmailConfig().smtp.useTLS),
|
||||
getEmailConfig().smtp.username,
|
||||
getEmailConfig().smtp.password,
|
||||
toEmail,
|
||||
toName,
|
||||
subject,
|
||||
body,
|
||||
getEmailConfig().smtp.from,
|
||||
getEmailConfig().smtp.fromName);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadEmailConfiguration() {
|
||||
let emailConfigFile = loadTextFile("config/email.json");
|
||||
let emailConfigFile = loadTextFile("config/email.json");
|
||||
return JSON.parse(emailConfigFile);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getEmailConfig() {
|
||||
return emailConfig;
|
||||
return emailConfig;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -8,59 +8,59 @@
|
||||
// ===========================================================================
|
||||
|
||||
function initEventScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Event]: Initializing event script ...");
|
||||
addAllEventHandlers();
|
||||
logToConsole(LOG_INFO, "[VRR.Event]: Event script initialized!");
|
||||
logToConsole(LOG_INFO, "[VRR.Event]: Initializing event script ...");
|
||||
addAllEventHandlers();
|
||||
logToConsole(LOG_INFO, "[VRR.Event]: Event script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addAllEventHandlers() {
|
||||
addEventHandler("onResourceStart", onResourceStart);
|
||||
addEventHandler("onResourceStop", onResourceStop);
|
||||
addEventHandler("onServerStop", onResourceStop);
|
||||
addEventHandler("onResourceStart", onResourceStart);
|
||||
addEventHandler("onResourceStop", onResourceStop);
|
||||
addEventHandler("onServerStop", onResourceStop);
|
||||
|
||||
addEventHandler("onProcess", onProcess);
|
||||
addEventHandler("onEntityProcess", onEntityProcess);
|
||||
addEventHandler("onProcess", onProcess);
|
||||
addEventHandler("onEntityProcess", onEntityProcess);
|
||||
|
||||
addEventHandler("onPlayerConnect", onPlayerConnect);
|
||||
addEventHandler("onPlayerJoin", onPlayerJoin);
|
||||
addEventHandler("onPlayerJoined", onPlayerJoined);
|
||||
addEventHandler("onPlayerChat", onPlayerChat);
|
||||
addEventHandler("onPlayerQuit", onPlayerQuit);
|
||||
addEventHandler("onElementStreamIn", onElementStreamIn);
|
||||
addEventHandler("onElementStreamOut", onElementStreamOut);
|
||||
addEventHandler("onPlayerConnect", onPlayerConnect);
|
||||
addEventHandler("onPlayerJoin", onPlayerJoin);
|
||||
addEventHandler("onPlayerJoined", onPlayerJoined);
|
||||
addEventHandler("onPlayerChat", onPlayerChat);
|
||||
addEventHandler("onPlayerQuit", onPlayerQuit);
|
||||
addEventHandler("onElementStreamIn", onElementStreamIn);
|
||||
addEventHandler("onElementStreamOut", onElementStreamOut);
|
||||
|
||||
addEventHandler("onPedSpawn", onPedSpawn);
|
||||
addEventHandler("onPedEnterVehicle", onPedEnteringVehicle);
|
||||
addEventHandler("onPedExitVehicle", onPedExitingVehicle);
|
||||
addEventHandler("onPedSpawn", onPedSpawn);
|
||||
addEventHandler("onPedEnterVehicle", onPedEnteringVehicle);
|
||||
addEventHandler("onPedExitVehicle", onPedExitingVehicle);
|
||||
|
||||
addEventHandler("onPedEnteringVehicle", onPedEnteringVehicle);
|
||||
addEventHandler("onPedExitingVehicle", onPedExitingVehicle);
|
||||
addEventHandler("onPedEnteringVehicle", onPedEnteringVehicle);
|
||||
addEventHandler("onPedExitingVehicle", onPedExitingVehicle);
|
||||
|
||||
addEventHandler("OnPlayerCommand", onPlayerCommand);
|
||||
addEventHandler("OnPlayerCommand", onPlayerCommand);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerConnect(event, ipAddress, port) {
|
||||
logToConsole(LOG_INFO, `[VRR.Event] Client connecting (IP: ${ipAddress})`);
|
||||
//if(isIpAddressBanned(ipAddress)) {
|
||||
// messagePlayerError(client, "You are banned from this server!");
|
||||
// return false;
|
||||
//}
|
||||
logToConsole(LOG_INFO, `[VRR.Event] Client connecting (IP: ${ipAddress})`);
|
||||
//if(isIpAddressBanned(ipAddress)) {
|
||||
// messagePlayerError(client, "You are banned from this server!");
|
||||
// return false;
|
||||
//}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerJoin(event, client) {
|
||||
logToConsole(LOG_INFO, `[VRR.Event] Client ${client.name}[${client.index}] joining from ${client.ip}`);
|
||||
logToConsole(LOG_INFO, `[VRR.Event] Client ${client.name}[${client.index}] joining from ${client.ip}`);
|
||||
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
|
||||
messageDiscordEventChannel(`👋 ${getPlayerDisplayForConsole(client)} has joined the server.`);
|
||||
messageDiscordEventChannel(`👋 ${getPlayerDisplayForConsole(client)} has joined the server.`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -72,16 +72,16 @@ function onPlayerJoined(event, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function onElementStreamIn(event, element, client) {
|
||||
//if(getPlayerDimension(client) != getElementDimension(element)) {
|
||||
// event.preventDefault();
|
||||
//}
|
||||
//if(getPlayerDimension(client) != getElementDimension(element)) {
|
||||
// event.preventDefault();
|
||||
//}
|
||||
|
||||
if(getPlayerData(getClientFromIndex(element.owner)) != false ) {
|
||||
if(hasBitFlag(getPlayerData(getClientFromIndex(element.owner)).accountData.flags.moderation, getModerationFlagValue("DontSyncClientElements"))) {
|
||||
event.preventDefault();
|
||||
destroyGameElement(element);
|
||||
}
|
||||
}
|
||||
if(getPlayerData(getClientFromIndex(element.owner)) != false ) {
|
||||
if(hasBitFlag(getPlayerData(getClientFromIndex(element.owner)).accountData.flags.moderation, getModerationFlagValue("DontSyncClientElements"))) {
|
||||
event.preventDefault();
|
||||
destroyGameElement(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -93,39 +93,39 @@ function onElementStreamOut(event, element, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerQuit(event, client, quitReasonId) {
|
||||
logToConsole(LOG_INFO, `👋 Client ${getPlayerDisplayForConsole(client)} disconnected (${disconnectReasons[quitReasonId]}[${quitReasonId}])`);
|
||||
updateConnectionLogOnQuit(client, quitReasonId);
|
||||
logToConsole(LOG_INFO, `👋 Client ${getPlayerDisplayForConsole(client)} disconnected (${disconnectReasons[quitReasonId]}[${quitReasonId}])`);
|
||||
updateConnectionLogOnQuit(client, quitReasonId);
|
||||
|
||||
if(isPlayerLoggedIn(client)) {
|
||||
messagePlayerNormal(null, `👋 ${getPlayerName(client)} has left the server (${disconnectReasons[quitReasonId]})`, getColourByName("softYellow"));
|
||||
savePlayerToDatabase(client);
|
||||
resetClientStuff(client);
|
||||
getServerData().clients[client.index] = null;
|
||||
}
|
||||
if(isPlayerLoggedIn(client)) {
|
||||
messagePlayerNormal(null, `👋 ${getPlayerName(client)} has left the server (${disconnectReasons[quitReasonId]})`, getColourByName("softYellow"));
|
||||
savePlayerToDatabase(client);
|
||||
resetClientStuff(client);
|
||||
getServerData().clients[client.index] = null;
|
||||
}
|
||||
|
||||
messageDiscordEventChannel(`👋 ${getPlayerDisplayForConsole(client)} has left the server.`);
|
||||
messageDiscordEventChannel(`👋 ${getPlayerDisplayForConsole(client)} has left the server.`);
|
||||
|
||||
clearTemporaryVehicles();
|
||||
clearTemporaryPeds();
|
||||
clearTemporaryVehicles();
|
||||
clearTemporaryPeds();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
async function onPlayerChat(event, client, messageText) {
|
||||
event.preventDefault();
|
||||
event.preventDefault();
|
||||
|
||||
processPlayerChat(client, messageText);
|
||||
processPlayerChat(client, messageText);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onProcess(event, deltaTime) {
|
||||
updateServerGameTime();
|
||||
//checkPlayerSpawning();
|
||||
//checkPlayerPedState();
|
||||
//checkVehicleBurning();
|
||||
updateServerGameTime();
|
||||
//checkPlayerSpawning();
|
||||
//checkPlayerPedState();
|
||||
//checkVehicleBurning();
|
||||
|
||||
processVehiclePurchasing();
|
||||
processVehiclePurchasing();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -136,89 +136,89 @@ function onEntityProcess(event, entity) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
||||
if(ped.isType(ELEMENT_PLAYER)) {
|
||||
let client = getClientFromPlayerElement(ped);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_ENTERINGVEHICLE;
|
||||
if(ped.isType(ELEMENT_PLAYER)) {
|
||||
let client = getClientFromPlayerElement(ped);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_ENTERINGVEHICLE;
|
||||
|
||||
if(!getVehicleData(vehicle)) {
|
||||
return false;
|
||||
}
|
||||
if(!getVehicleData(vehicle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getVehicleData(vehicle).locked) {
|
||||
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "lock")) {
|
||||
messagePlayerTip(client, `🔒 This ${getVehicleName(vehicle)} is locked. Press {ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "lock").key))} {MAINCOLOUR}to unlock it.`);
|
||||
} else {
|
||||
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked. Use /lock to unlock it`);
|
||||
}
|
||||
} else {
|
||||
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked and you don't have the keys to unlock it`);
|
||||
}
|
||||
if(getVehicleData(vehicle).locked) {
|
||||
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "lock")) {
|
||||
messagePlayerTip(client, `🔒 This ${getVehicleName(vehicle)} is locked. Press {ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "lock").key))} {MAINCOLOUR}to unlock it.`);
|
||||
} else {
|
||||
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked. Use /lock to unlock it`);
|
||||
}
|
||||
} else {
|
||||
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked and you don't have the keys to unlock it`);
|
||||
}
|
||||
|
||||
getPlayerData(client).enteringVehicle = null;
|
||||
makePlayerStopAnimation(client);
|
||||
return false;
|
||||
}
|
||||
getPlayerData(client).enteringVehicle = null;
|
||||
makePlayerStopAnimation(client);
|
||||
return false;
|
||||
}
|
||||
|
||||
getPlayerData(client).enteringVehicle = vehicle;
|
||||
}
|
||||
getPlayerData(client).enteringVehicle = vehicle;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPedExitingVehicle(event, ped, vehicle) {
|
||||
if(!getVehicleData(vehicle)) {
|
||||
return false;
|
||||
}
|
||||
if(!getVehicleData(vehicle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(ped.isType(ELEMENT_PLAYER)) {
|
||||
let client = getClientFromPlayerElement(ped);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_EXITINGVEHICLE;
|
||||
}
|
||||
if(ped.isType(ELEMENT_PLAYER)) {
|
||||
let client = getClientFromPlayerElement(ped);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_EXITINGVEHICLE;
|
||||
}
|
||||
|
||||
if(!getVehicleData(vehicle).spawnLocked) {
|
||||
getVehicleData(vehicle).spawnPosition = getVehiclePosition(vehicle);
|
||||
getVehicleData(vehicle).spawnRotation = getVehicleHeading(vehicle);
|
||||
getVehicleData(vehicle).needsSaved = true;
|
||||
}
|
||||
if(!getVehicleData(vehicle).spawnLocked) {
|
||||
getVehicleData(vehicle).spawnPosition = getVehiclePosition(vehicle);
|
||||
getVehicleData(vehicle).spawnRotation = getVehicleHeading(vehicle);
|
||||
getVehicleData(vehicle).needsSaved = true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onResourceStart(event, resource) {
|
||||
logToConsole(LOG_WARN, `[VRR.Event] ${resource.name} started!`);
|
||||
logToConsole(LOG_WARN, `[VRR.Event] ${resource.name} started!`);
|
||||
|
||||
if(resource != thisResource) {
|
||||
messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name} {MAINCOLOUR}started!`);
|
||||
}
|
||||
if(resource != thisResource) {
|
||||
messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name} {MAINCOLOUR}started!`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onResourceStop(event, resource) {
|
||||
logToConsole(LOG_WARN, `[VRR.Event] ${resource.name} stopped!`);
|
||||
logToConsole(LOG_WARN, `[VRR.Event] ${resource.name} stopped!`);
|
||||
|
||||
if(resource != thisResource) {
|
||||
messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name} {MAINCOLOUR}stopped!`);
|
||||
}
|
||||
if(resource != thisResource) {
|
||||
messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name} {MAINCOLOUR}stopped!`);
|
||||
}
|
||||
|
||||
if(resource == thisResource) {
|
||||
saveAllServerDataToDatabase();
|
||||
clearArray(getServerData().vehicles);
|
||||
clearArray(getServerData().clients);
|
||||
clearArray(getServerData().businesses);
|
||||
clearArray(getServerData().houses);
|
||||
clearArray(getServerData().factions);
|
||||
clearArray(getServerData().jobs);
|
||||
clearArray(getServerData().clans);
|
||||
clearArray(getServerData().items);
|
||||
clearArray(getServerData().itemTypes);
|
||||
clearArray(getServerData().groundItemCache);
|
||||
clearArray(getServerData().groundPlantCache);
|
||||
kickAllClients();
|
||||
}
|
||||
if(resource == thisResource) {
|
||||
saveAllServerDataToDatabase();
|
||||
clearArray(getServerData().vehicles);
|
||||
clearArray(getServerData().clients);
|
||||
clearArray(getServerData().businesses);
|
||||
clearArray(getServerData().houses);
|
||||
clearArray(getServerData().factions);
|
||||
clearArray(getServerData().jobs);
|
||||
clearArray(getServerData().clans);
|
||||
clearArray(getServerData().items);
|
||||
clearArray(getServerData().itemTypes);
|
||||
clearArray(getServerData().groundItemCache);
|
||||
clearArray(getServerData().groundPlantCache);
|
||||
kickAllClients();
|
||||
}
|
||||
|
||||
collectAllGarbage();
|
||||
collectAllGarbage();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -236,199 +236,199 @@ function onPlayerExitedSphere(client, sphere) {
|
||||
// ===========================================================================
|
||||
|
||||
async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
|
||||
if(client == null) {
|
||||
return false;
|
||||
}
|
||||
if(client == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(client.player == null) {
|
||||
return false;
|
||||
}
|
||||
if(client.player == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
await waitUntil(() => client != null && client.player != null && client.player.vehicle != null);
|
||||
//setTimeout(function() {
|
||||
//if(client.player.vehicle == null) {
|
||||
// onPlayerEnteredVehicle(client, clientVehicle, seat);
|
||||
//}
|
||||
await waitUntil(() => client != null && client.player != null && client.player.vehicle != null);
|
||||
//setTimeout(function() {
|
||||
//if(client.player.vehicle == null) {
|
||||
// onPlayerEnteredVehicle(client, clientVehicle, seat);
|
||||
//}
|
||||
|
||||
let vehicle = client.player.vehicle;
|
||||
let vehicle = client.player.vehicle;
|
||||
|
||||
//if(vehicle.syncer != client.index) {
|
||||
// if(getPlayerVehicleSeat(client) == VRR_VEHSEAT_DRIVER) {
|
||||
// vehicle.setSyncer(client, true);
|
||||
// }
|
||||
//}
|
||||
//if(vehicle.syncer != client.index) {
|
||||
// if(getPlayerVehicleSeat(client) == VRR_VEHSEAT_DRIVER) {
|
||||
// vehicle.setSyncer(client, true);
|
||||
// }
|
||||
//}
|
||||
|
||||
if(vehicle.owner != -1) {
|
||||
return false;
|
||||
}
|
||||
if(vehicle.owner != -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getVehicleData(vehicle)) {
|
||||
return false;
|
||||
}
|
||||
if(!getVehicleData(vehicle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//if(getPlayerData(client).enteringVehicle == null || getPlayerData(client).enteringVehicle != vehicle) {
|
||||
// messagePlayerError(client, "You can't enter this vehicle!");
|
||||
// removePlayerFromVehicle(client);
|
||||
// messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}tried to warp into a locked vehicle`);
|
||||
// return false;
|
||||
//}
|
||||
//if(getPlayerData(client).enteringVehicle == null || getPlayerData(client).enteringVehicle != vehicle) {
|
||||
// messagePlayerError(client, "You can't enter this vehicle!");
|
||||
// removePlayerFromVehicle(client);
|
||||
// messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}tried to warp into a locked vehicle`);
|
||||
// return false;
|
||||
//}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
|
||||
getPlayerData(client).lastVehicle = vehicle;
|
||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||
getPlayerData(client).lastVehicle = vehicle;
|
||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||
|
||||
if(getPlayerVehicleSeat(client) == VRR_VEHSEAT_DRIVER) {
|
||||
vehicle.engine = getVehicleData(vehicle).engine;
|
||||
if(getPlayerVehicleSeat(client) == VRR_VEHSEAT_DRIVER) {
|
||||
vehicle.engine = getVehicleData(vehicle).engine;
|
||||
|
||||
if(getVehicleData(vehicle).buyPrice > 0) {
|
||||
messagePlayerAlert(client, getLocaleString(client, "VehicleForSale", getVehicleName(vehicle), `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).buyPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehbuy{MAINCOLOUR}`));
|
||||
resetVehiclePosition(vehicle);
|
||||
} else if(getVehicleData(vehicle).rentPrice > 0) {
|
||||
if(getVehicleData(vehicle).rentedBy != client) {
|
||||
messagePlayerAlert(client, getLocaleString(client, "VehicleForRent", getVehicleName(vehicle), `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehrent{MAINCOLOUR}`));
|
||||
resetVehiclePosition(vehicle);
|
||||
} else {
|
||||
messagePlayerAlert(client, `You are renting this ${getVehicleName(vehicle)} for {ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)} per minute. {MAINCOLOUR}Use {ALTCOLOUR}/stoprent {MAINCOLOUR}if you want to stop renting it.`);
|
||||
}
|
||||
} else {
|
||||
let ownerName = "Nobody";
|
||||
let ownerType = "None";
|
||||
ownerType = toLowerCase(getVehicleOwnerTypeText(getVehicleData(vehicle).ownerType));
|
||||
switch(getVehicleData(vehicle).ownerType) {
|
||||
case VRR_VEHOWNER_CLAN:
|
||||
ownerName = getClanData(getClanIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
||||
ownerType = "clan";
|
||||
break;
|
||||
if(getVehicleData(vehicle).buyPrice > 0) {
|
||||
messagePlayerAlert(client, getLocaleString(client, "VehicleForSale", getVehicleName(vehicle), `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).buyPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehbuy{MAINCOLOUR}`));
|
||||
resetVehiclePosition(vehicle);
|
||||
} else if(getVehicleData(vehicle).rentPrice > 0) {
|
||||
if(getVehicleData(vehicle).rentedBy != client) {
|
||||
messagePlayerAlert(client, getLocaleString(client, "VehicleForRent", getVehicleName(vehicle), `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehrent{MAINCOLOUR}`));
|
||||
resetVehiclePosition(vehicle);
|
||||
} else {
|
||||
messagePlayerAlert(client, `You are renting this ${getVehicleName(vehicle)} for {ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)} per minute. {MAINCOLOUR}Use {ALTCOLOUR}/stoprent {MAINCOLOUR}if you want to stop renting it.`);
|
||||
}
|
||||
} else {
|
||||
let ownerName = "Nobody";
|
||||
let ownerType = "None";
|
||||
ownerType = toLowerCase(getVehicleOwnerTypeText(getVehicleData(vehicle).ownerType));
|
||||
switch(getVehicleData(vehicle).ownerType) {
|
||||
case VRR_VEHOWNER_CLAN:
|
||||
ownerName = getClanData(getClanIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
||||
ownerType = "clan";
|
||||
break;
|
||||
|
||||
case VRR_VEHOWNER_JOB:
|
||||
ownerName = getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
||||
ownerType = "job";
|
||||
break;
|
||||
case VRR_VEHOWNER_JOB:
|
||||
ownerName = getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
||||
ownerType = "job";
|
||||
break;
|
||||
|
||||
case VRR_VEHOWNER_PLAYER:
|
||||
let subAccountData = loadSubAccountFromId(getVehicleData(vehicle).ownerId);
|
||||
ownerName = `${subAccountData.firstName} ${subAccountData.lastName}`;
|
||||
ownerType = "player";
|
||||
break;
|
||||
case VRR_VEHOWNER_PLAYER:
|
||||
let subAccountData = loadSubAccountFromId(getVehicleData(vehicle).ownerId);
|
||||
ownerName = `${subAccountData.firstName} ${subAccountData.lastName}`;
|
||||
ownerType = "player";
|
||||
break;
|
||||
|
||||
case VRR_VEHOWNER_BIZ:
|
||||
ownerName = getBusinessData(getVehicleData(vehicle).ownerId).name;
|
||||
ownerType = "business";
|
||||
break;
|
||||
case VRR_VEHOWNER_BIZ:
|
||||
ownerName = getBusinessData(getVehicleData(vehicle).ownerId).name;
|
||||
ownerType = "business";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)} belongs to {ALTCOLOUR}${ownerName} (${ownerType})`);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)} belongs to {ALTCOLOUR}${ownerName} (${ownerType})`);
|
||||
}
|
||||
|
||||
if(!getVehicleData(vehicle).engine) {
|
||||
if(getVehicleData(vehicle).buyPrice == 0 && getVehicleData(vehicle).rentPrice == 0) {
|
||||
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "engine")) {
|
||||
messagePlayerTip(client, `This ${getVehicleName(vehicle)}'s engine is off. Press {ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "engine").key))} {MAINCOLOUR}to start it.`);
|
||||
} else {
|
||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off. Use /engine to start it`);
|
||||
}
|
||||
} else {
|
||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off and you don't have the keys to start it`);
|
||||
if(!getVehicleData(vehicle).engine) {
|
||||
if(getVehicleData(vehicle).buyPrice == 0 && getVehicleData(vehicle).rentPrice == 0) {
|
||||
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "engine")) {
|
||||
messagePlayerTip(client, `This ${getVehicleName(vehicle)}'s engine is off. Press {ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "engine").key))} {MAINCOLOUR}to start it.`);
|
||||
} else {
|
||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off. Use /engine to start it`);
|
||||
}
|
||||
} else {
|
||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off and you don't have the keys to start it`);
|
||||
|
||||
}
|
||||
}
|
||||
resetVehiclePosition(vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
resetVehiclePosition(vehicle);
|
||||
}
|
||||
|
||||
let currentSubAccount = getPlayerCurrentSubAccount(client);
|
||||
let currentSubAccount = getPlayerCurrentSubAccount(client);
|
||||
|
||||
if(isPlayerWorking(client)) {
|
||||
if(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_JOB) {
|
||||
if(getVehicleData(vehicle).ownerId == getPlayerCurrentSubAccount(client).job) {
|
||||
getPlayerCurrentSubAccount(client).lastJobVehicle = vehicle;
|
||||
messagePlayerInfo(client, `Use /startroute to start working in this vehicle`);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isPlayerWorking(client)) {
|
||||
if(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_JOB) {
|
||||
if(getVehicleData(vehicle).ownerId == getPlayerCurrentSubAccount(client).job) {
|
||||
getPlayerCurrentSubAccount(client).lastJobVehicle = vehicle;
|
||||
messagePlayerInfo(client, `Use /startroute to start working in this vehicle`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isPlayerWorking(client)) {
|
||||
if(isPlayerOnJobRoute(client)) {
|
||||
if(vehicle == getPlayerJobRouteVehicle(client)) {
|
||||
stopReturnToJobVehicleCountdown(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isPlayerWorking(client)) {
|
||||
if(isPlayerOnJobRoute(client)) {
|
||||
if(vehicle == getPlayerJobRouteVehicle(client)) {
|
||||
stopReturnToJobVehicleCountdown(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(getVehicleData(vehicle).streamingRadioStation != -1) {
|
||||
if(getPlayerData(client).streamingRadioStation != getVehicleData(vehicle).streamingRadioStation) {
|
||||
playRadioStreamForPlayer(client, radioStations[getVehicleData(vehicle).streamingRadioStation].url, true, getPlayerStreamingRadioVolume(client));
|
||||
}
|
||||
}
|
||||
//}, client.ping+500);
|
||||
if(getVehicleData(vehicle).streamingRadioStation != -1) {
|
||||
if(getPlayerData(client).streamingRadioStation != getVehicleData(vehicle).streamingRadioStation) {
|
||||
playRadioStreamForPlayer(client, radioStations[getVehicleData(vehicle).streamingRadioStation].url, true, getPlayerStreamingRadioVolume(client));
|
||||
}
|
||||
}
|
||||
//}, client.ping+500);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerExitedVehicle(client, vehicle) {
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
|
||||
stopRadioStreamForPlayer(client);
|
||||
stopRadioStreamForPlayer(client);
|
||||
|
||||
if(!getVehicleData(vehicle)) {
|
||||
return false;
|
||||
}
|
||||
if(!getVehicleData(vehicle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isPlayerWorking(client)) {
|
||||
if(isPlayerOnJobRoute(client)) {
|
||||
if(vehicle == getPlayerJobRouteVehicle(client)) {
|
||||
startReturnToJobVehicleCountdown(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isPlayerWorking(client)) {
|
||||
if(isPlayerOnJobRoute(client)) {
|
||||
if(vehicle == getPlayerJobRouteVehicle(client)) {
|
||||
startReturnToJobVehicleCountdown(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerDeath(client, position) {
|
||||
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} died.`);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_DEAD;
|
||||
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} died.`);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_DEAD;
|
||||
updatePlayerSpawnedState(client, false);
|
||||
setPlayerControlState(client, false);
|
||||
setPlayerControlState(client, false);
|
||||
setTimeout(function() {
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, false, 1.0);
|
||||
}
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, false, 1.0);
|
||||
}
|
||||
setTimeout(function() {
|
||||
if(getPlayerCurrentSubAccount(client).inJail) {
|
||||
let closestJail = getClosestPoliceStation(getPlayerPosition(client));
|
||||
client.despawnPlayer();
|
||||
getPlayerCurrentSubAccount(client).interior = closestJail.interior;
|
||||
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
|
||||
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
let closestJail = getClosestPoliceStation(getPlayerPosition(client));
|
||||
client.despawnPlayer();
|
||||
getPlayerCurrentSubAccount(client).interior = closestJail.interior;
|
||||
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
|
||||
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
updatePlayerSpawnedState(client, true);
|
||||
makePlayerStopAnimation(client);
|
||||
setPlayerControlState(client, true);
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
updatePlayerSpawnedState(client, true);
|
||||
makePlayerStopAnimation(client);
|
||||
setPlayerControlState(client, true);
|
||||
} else {
|
||||
let closestHospital = getClosestHospital(getPlayerPosition(client));
|
||||
client.despawnPlayer();
|
||||
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
|
||||
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
|
||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
let closestHospital = getClosestHospital(getPlayerPosition(client));
|
||||
client.despawnPlayer();
|
||||
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
|
||||
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
|
||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
updatePlayerSpawnedState(client, true);
|
||||
makePlayerStopAnimation(client);
|
||||
setPlayerControlState(client, true);
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
updatePlayerSpawnedState(client, true);
|
||||
makePlayerStopAnimation(client);
|
||||
setPlayerControlState(client, true);
|
||||
}
|
||||
}, 2000);
|
||||
}, 1000);
|
||||
@@ -437,175 +437,175 @@ function onPlayerDeath(client, position) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedSpawn(ped) {
|
||||
if(ped.type == ELEMENT_PLAYER) {
|
||||
//setTimeout(onPlayerSpawn, 250, ped);
|
||||
onPlayerSpawn();
|
||||
}
|
||||
if(ped.type == ELEMENT_PLAYER) {
|
||||
//setTimeout(onPlayerSpawn, 250, ped);
|
||||
onPlayerSpawn();
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerSpawn(client) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
|
||||
//if(client.player == null) {
|
||||
// logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player element not set yet. Rechecking ...`);
|
||||
// setTimeout(onPlayerSpawn, 500, client);
|
||||
// return false;
|
||||
//}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
|
||||
//if(client.player == null) {
|
||||
// logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player element not set yet. Rechecking ...`);
|
||||
// setTimeout(onPlayerSpawn, 500, client);
|
||||
// return false;
|
||||
//}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player ped is valid. Continuing spawn processing ...`);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player ped is valid. Continuing spawn processing ...`);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
||||
if(!getPlayerData(client)) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
||||
client.disconnect();
|
||||
return false;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
||||
if(!getPlayerData(client)) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
||||
client.disconnect();
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
||||
if(!getPlayerData(client).loggedIn) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
||||
client.disconnect();
|
||||
return false;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
||||
if(!getPlayerData(client).loggedIn) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
||||
client.disconnect();
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
||||
if(getPlayerData(client).currentSubAccount == -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
||||
client.disconnect();
|
||||
return false;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
||||
if(getPlayerData(client).currentSubAccount == -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
||||
client.disconnect();
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
|
||||
|
||||
if(getServerGame() == VRR_GAME_GTA_IV) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped body parts and props`);
|
||||
setEntityData(client.player, "vrr.bodyParts", getPlayerCurrentSubAccount(client).bodyParts, true);
|
||||
setEntityData(client.player, "vrr.bodyProps", getPlayerCurrentSubAccount(client).bodyProps, true);
|
||||
}
|
||||
if(getServerGame() == VRR_GAME_GTA_IV) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped body parts and props`);
|
||||
setEntityData(client.player, "vrr.bodyParts", getPlayerCurrentSubAccount(client).bodyParts, true);
|
||||
setEntityData(client.player, "vrr.bodyProps", getPlayerCurrentSubAccount(client).bodyProps, true);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
||||
setEntityData(client.player, "vrr.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
||||
setEntityData(client.player, "vrr.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
||||
|
||||
if(isPlayerSwitchingCharacter(client) || isPlayerCreatingCharacter(client)) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s ped is being used for character selection/creation. No further spawn processing needed'`);
|
||||
return false;
|
||||
}
|
||||
if(isPlayerSwitchingCharacter(client) || isPlayerCreatingCharacter(client)) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s ped is being used for character selection/creation. No further spawn processing needed'`);
|
||||
return false;
|
||||
}
|
||||
|
||||
//logToConsole(LOG_DEBUG, `[VRR.Event] Setting player skin for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).skin}`);
|
||||
//setPlayerSkin(client, getPlayerCurrentSubAccount(client).skin);
|
||||
//logToConsole(LOG_DEBUG, `[VRR.Event] Setting player skin for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).skin}`);
|
||||
//setPlayerSkin(client, getPlayerCurrentSubAccount(client).skin);
|
||||
|
||||
//if(getPlayerData(client).pedState != VRR_PEDSTATE_READY) {
|
||||
restorePlayerCamera(client);
|
||||
//if(getPlayerData(client).pedState != VRR_PEDSTATE_READY) {
|
||||
restorePlayerCamera(client);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
|
||||
getPlayerData(client).ped = client.player;
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
|
||||
getPlayerData(client).ped = client.player;
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending ${getPlayerDisplayForConsole(client)} the 'now playing as' message`);
|
||||
messagePlayerAlert(client, `You are now playing as: {businessBlue}${getCharacterFullName(client)}`, getColourByName("white"));
|
||||
messagePlayerNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange"));
|
||||
messagePlayerNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending ${getPlayerDisplayForConsole(client)} the 'now playing as' message`);
|
||||
messagePlayerAlert(client, `You are now playing as: {businessBlue}${getCharacterFullName(client)}`, getColourByName("white"));
|
||||
messagePlayerNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange"));
|
||||
messagePlayerNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
|
||||
updatePlayerSpawnedState(client, true);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
|
||||
updatePlayerSpawnedState(client, true);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
|
||||
setPlayerInterior(client, getPlayerCurrentSubAccount(client).interior);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
|
||||
setPlayerInterior(client, getPlayerCurrentSubAccount(client).interior);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player dimension for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).dimension}`);
|
||||
setPlayerDimension(client, getPlayerCurrentSubAccount(client).dimension);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player dimension for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).dimension}`);
|
||||
setPlayerDimension(client, getPlayerCurrentSubAccount(client).dimension);
|
||||
|
||||
//if(getPlayerCurrentSubAccount(client).interior != 0 || getPlayerCurrentSubAccount(client).dimension != 0) {
|
||||
// updateAllInteriorVehiclesForPlayer(client, getPlayerCurrentSubAccount(client).interior, getPlayerCurrentSubAccount(client).dimension);
|
||||
//}
|
||||
//if(getPlayerCurrentSubAccount(client).interior != 0 || getPlayerCurrentSubAccount(client).dimension != 0) {
|
||||
// updateAllInteriorVehiclesForPlayer(client, getPlayerCurrentSubAccount(client).interior, getPlayerCurrentSubAccount(client).dimension);
|
||||
//}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player health for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).health}`);
|
||||
setPlayerHealth(client, getPlayerCurrentSubAccount(client).health);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player health for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).health}`);
|
||||
setPlayerHealth(client, getPlayerCurrentSubAccount(client).health);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player armour for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).armour}`);
|
||||
setPlayerArmour(client, getPlayerCurrentSubAccount(client).armour);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player armour for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).armour}`);
|
||||
setPlayerArmour(client, getPlayerCurrentSubAccount(client).armour);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending ${getPlayerDisplayForConsole(client)}'s job type to their client (${getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client))})`);
|
||||
sendPlayerJobType(client, getPlayerCurrentSubAccount(client).job);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending ${getPlayerDisplayForConsole(client)}'s job type to their client (${getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client))})`);
|
||||
sendPlayerJobType(client, getPlayerCurrentSubAccount(client).job);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Enabling all rendering states for ${getPlayerDisplayForConsole(client)}`);
|
||||
setPlayer2DRendering(client, true, true, true, true, true, true);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Enabling all rendering states for ${getPlayerDisplayForConsole(client)}`);
|
||||
setPlayer2DRendering(client, true, true, true, true, true, true);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
|
||||
updatePlayerSnowState(client);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
|
||||
updatePlayerSnowState(client);
|
||||
|
||||
if(getServerGame() == VRR_GAME_GTA_SA) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player walk and fightstyle for ${getPlayerDisplayForConsole(client)}`);
|
||||
setEntityData(client.player, "vrr.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
||||
if(getServerGame() == VRR_GAME_GTA_SA) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player walk and fightstyle for ${getPlayerDisplayForConsole(client)}`);
|
||||
setEntityData(client.player, "vrr.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
||||
|
||||
setPlayerFightStyle(client, getPlayerCurrentSubAccount(client).fightStyle);
|
||||
}
|
||||
setPlayerFightStyle(client, getPlayerCurrentSubAccount(client).fightStyle);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating logo state for ${getPlayerDisplayForConsole(client)}`);
|
||||
if(getServerConfig().showLogo && doesPlayerHaveLogoEnabled(client)) {
|
||||
updatePlayerShowLogoState(client, true);
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating logo state for ${getPlayerDisplayForConsole(client)}`);
|
||||
if(getServerConfig().showLogo && doesPlayerHaveLogoEnabled(client)) {
|
||||
updatePlayerShowLogoState(client, true);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Caching ${getPlayerDisplayForConsole(client)}'s hotbar items`);
|
||||
cachePlayerHotBarItems(client);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Caching ${getPlayerDisplayForConsole(client)}'s hotbar items`);
|
||||
cachePlayerHotBarItems(client);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s hotbar`);
|
||||
updatePlayerHotBar(client);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s hotbar`);
|
||||
updatePlayerHotBar(client);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s switchchar state to false`);
|
||||
getPlayerData(client).switchingCharacter = false;
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s switchchar state to false`);
|
||||
getPlayerData(client).switchingCharacter = false;
|
||||
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
}
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
}
|
||||
|
||||
//if(isGTAIV()) {
|
||||
// setEntityData(client.player, "vrr.bodyPartHair", getPlayerCurrentSubAccount(client).bodyParts.hair, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyParts.head, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartUpper", getPlayerCurrentSubAccount(client).bodyParts.upper, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartLower", getPlayerCurrentSubAccount(client).bodyParts.lower, true);
|
||||
// setEntityData(client.player, "vrr.bodyPropHair", getPlayerCurrentSubAccount(client).bodyProps.hair, true);
|
||||
// setEntityData(client.player, "vrr.bodyPropEyes", getPlayerCurrentSubAccount(client).bodyProps.eyes, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyProps.head, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartLeftHand", getPlayerCurrentSubAccount(client).bodyProps.leftHand, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartRightHand", getPlayerCurrentSubAccount(client).bodyProps.rightHand, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartLeftWrist", getPlayerCurrentSubAccount(client).bodyProps.leftWrist, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartRightWrist", getPlayerCurrentSubAccount(client).bodyProps.rightWrist, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartHip", getPlayerCurrentSubAccount(client).bodyProps.hip, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartLeftFoot", getPlayerCurrentSubAccount(client).bodyProps.leftFoot, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartRightFoot", getPlayerCurrentSubAccount(client).bodyProps.rightFoot, true);
|
||||
//}
|
||||
//if(isGTAIV()) {
|
||||
// setEntityData(client.player, "vrr.bodyPartHair", getPlayerCurrentSubAccount(client).bodyParts.hair, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyParts.head, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartUpper", getPlayerCurrentSubAccount(client).bodyParts.upper, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartLower", getPlayerCurrentSubAccount(client).bodyParts.lower, true);
|
||||
// setEntityData(client.player, "vrr.bodyPropHair", getPlayerCurrentSubAccount(client).bodyProps.hair, true);
|
||||
// setEntityData(client.player, "vrr.bodyPropEyes", getPlayerCurrentSubAccount(client).bodyProps.eyes, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyProps.head, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartLeftHand", getPlayerCurrentSubAccount(client).bodyProps.leftHand, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartRightHand", getPlayerCurrentSubAccount(client).bodyProps.rightHand, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartLeftWrist", getPlayerCurrentSubAccount(client).bodyProps.leftWrist, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartRightWrist", getPlayerCurrentSubAccount(client).bodyProps.rightWrist, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartHip", getPlayerCurrentSubAccount(client).bodyProps.hip, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartLeftFoot", getPlayerCurrentSubAccount(client).bodyProps.leftFoot, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartRightFoot", getPlayerCurrentSubAccount(client).bodyProps.rightFoot, true);
|
||||
//}
|
||||
|
||||
if(isGTAIV()) {
|
||||
sendPlayerPedPartsAndProps(client);
|
||||
}
|
||||
if(isGTAIV()) {
|
||||
sendPlayerPedPartsAndProps(client);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
|
||||
syncPlayerProperties(client);
|
||||
//setTimeout(function() {
|
||||
// syncPlayerProperties(client);
|
||||
//}, 1000);
|
||||
syncPlayerProperties(client);
|
||||
//setTimeout(function() {
|
||||
// syncPlayerProperties(client);
|
||||
//}, 1000);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
|
||||
updatePlayerCash(client);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
|
||||
updatePlayerCash(client);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating all player name tags`);
|
||||
updateAllPlayerNameTags();
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating all player name tags`);
|
||||
updateAllPlayerNameTags();
|
||||
|
||||
if(!areServerElementsSupported()) {
|
||||
sendAllBusinessEntrancesToPlayer(client);
|
||||
sendAllHouseEntrancesToPlayer(client);
|
||||
//sendAllJobLocationsToPlayer(client);
|
||||
}
|
||||
if(!areServerElementsSupported()) {
|
||||
sendAllBusinessEntrancesToPlayer(client);
|
||||
sendAllHouseEntrancesToPlayer(client);
|
||||
//sendAllJobLocationsToPlayer(client);
|
||||
}
|
||||
|
||||
requestPlayerPedNetworkId(client);
|
||||
requestPlayerPedNetworkId(client);
|
||||
|
||||
getPlayerData(client).payDayTickStart = sdl.ticks;
|
||||
//}
|
||||
getPlayerData(client).payDayTickStart = sdl.ticks;
|
||||
//}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -15,121 +15,121 @@ function initGUIScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function playerPromptAnswerNo(client) {
|
||||
if(getPlayerData(client).promptType == VRR_PROMPT_NONE) {
|
||||
return false;
|
||||
}
|
||||
if(getPlayerData(client).promptType == VRR_PROMPT_NONE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} answered NO to their prompt (${getPlayerData(client).promptType})`);
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} answered NO to their prompt (${getPlayerData(client).promptType})`);
|
||||
|
||||
switch(getPlayerData(client).promptType) {
|
||||
case VRR_PROMPT_CREATEFIRSTCHAR:
|
||||
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");
|
||||
setTimeout(function() { client.disconnect(); }, 5000);
|
||||
break;
|
||||
switch(getPlayerData(client).promptType) {
|
||||
case VRR_PROMPT_CREATEFIRSTCHAR:
|
||||
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");
|
||||
setTimeout(function() { client.disconnect(); }, 5000);
|
||||
break;
|
||||
|
||||
case VRR_PROMPT_BIZORDER:
|
||||
if(getPlayerData(client).businessOrderAmount > 0) {
|
||||
if(canPlayerUseGUI(client)) {
|
||||
showPlayerErrorGUI(client, "You canceled the order.", "Business Order Canceled");
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} canceled the order of ${getPlayerData(client).businessOrderAmount} ${getPlayerData(client).businessOrderItem} at ${getPlayerData(client).businessOrderCost/getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness)}`);
|
||||
messagePlayerError(client, "You canceled the order!");
|
||||
}
|
||||
} else {
|
||||
showPlayerErrorGUI(client, "You aren't ordering anything for a business!", "Business Order Canceled");
|
||||
}
|
||||
break;
|
||||
case VRR_PROMPT_BIZORDER:
|
||||
if(getPlayerData(client).businessOrderAmount > 0) {
|
||||
if(canPlayerUseGUI(client)) {
|
||||
showPlayerErrorGUI(client, "You canceled the order.", "Business Order Canceled");
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} canceled the order of ${getPlayerData(client).businessOrderAmount} ${getPlayerData(client).businessOrderItem} at ${getPlayerData(client).businessOrderCost/getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness)}`);
|
||||
messagePlayerError(client, "You canceled the order!");
|
||||
}
|
||||
} else {
|
||||
showPlayerErrorGUI(client, "You aren't ordering anything for a business!", "Business Order Canceled");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
getPlayerData(client).promptType = VRR_PROMPT_NONE;
|
||||
getPlayerData(client).promptType = VRR_PROMPT_NONE;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playerPromptAnswerYes(client) {
|
||||
if(getPlayerData(client).promptType == VRR_PROMPT_NONE) {
|
||||
return false;
|
||||
}
|
||||
if(getPlayerData(client).promptType == VRR_PROMPT_NONE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} answered YES to their prompt (${getPlayerData(client).promptType})`);
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} answered YES to their prompt (${getPlayerData(client).promptType})`);
|
||||
|
||||
switch(getPlayerData(client).promptType) {
|
||||
case VRR_PROMPT_CREATEFIRSTCHAR:
|
||||
showPlayerNewCharacterGUI(client);
|
||||
break;
|
||||
switch(getPlayerData(client).promptType) {
|
||||
case VRR_PROMPT_CREATEFIRSTCHAR:
|
||||
showPlayerNewCharacterGUI(client);
|
||||
break;
|
||||
|
||||
case VRR_PROMPT_BIZORDER:
|
||||
if(getPlayerData(client).businessOrderAmount > 0) {
|
||||
if(getBusinessData(getPlayerData(client).businessOrderBusiness).till < getPlayerData(client).businessOrderCost) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} failed to order ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost/getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name} (Reason: Not enough money in business till)`);
|
||||
showPlayerErrorGUI(client, "This business doesn't have enough money! Deposit some using /bizdeposit", "Business Order Canceled");
|
||||
getPlayerData(client).businessOrderAmount = 0;
|
||||
getPlayerData(client).businessOrderBusiness = false;
|
||||
getPlayerData(client).businessOrderItem = -1;
|
||||
getPlayerData(client).businessOrderValue = -1;
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} successfully ordered ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost/getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name}`);
|
||||
showPlayerInfoGUI(client, `You ordered ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} (${getItemValueDisplay(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue)}) for ${getPlayerData(client).businessOrderCost}!`, "Business Order Successful");
|
||||
createItem(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue, VRR_ITEM_OWNER_BIZFLOOR, getBusinessData(getPlayerData(client).businessOrderBusiness).databaseId, getPlayerData(client).businessOrderAmount);
|
||||
cacheBusinessItems(getPlayerData(client).businessOrderBusiness);
|
||||
getBusinessData(getPlayerData(client).businessOrderBusiness).till -= getPlayerData(client).businessOrderCost;
|
||||
updateBusinessPickupLabelData(getPlayerData(client).businessOrderBusiness);
|
||||
getPlayerData(client).businessOrderAmount = 0;
|
||||
getPlayerData(client).businessOrderBusiness = false;
|
||||
getPlayerData(client).businessOrderItem = -1;
|
||||
getPlayerData(client).businessOrderValue = -1;
|
||||
case VRR_PROMPT_BIZORDER:
|
||||
if(getPlayerData(client).businessOrderAmount > 0) {
|
||||
if(getBusinessData(getPlayerData(client).businessOrderBusiness).till < getPlayerData(client).businessOrderCost) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} failed to order ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost/getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name} (Reason: Not enough money in business till)`);
|
||||
showPlayerErrorGUI(client, "This business doesn't have enough money! Deposit some using /bizdeposit", "Business Order Canceled");
|
||||
getPlayerData(client).businessOrderAmount = 0;
|
||||
getPlayerData(client).businessOrderBusiness = false;
|
||||
getPlayerData(client).businessOrderItem = -1;
|
||||
getPlayerData(client).businessOrderValue = -1;
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} successfully ordered ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost/getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name}`);
|
||||
showPlayerInfoGUI(client, `You ordered ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} (${getItemValueDisplay(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue)}) for ${getPlayerData(client).businessOrderCost}!`, "Business Order Successful");
|
||||
createItem(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue, VRR_ITEM_OWNER_BIZFLOOR, getBusinessData(getPlayerData(client).businessOrderBusiness).databaseId, getPlayerData(client).businessOrderAmount);
|
||||
cacheBusinessItems(getPlayerData(client).businessOrderBusiness);
|
||||
getBusinessData(getPlayerData(client).businessOrderBusiness).till -= getPlayerData(client).businessOrderCost;
|
||||
updateBusinessPickupLabelData(getPlayerData(client).businessOrderBusiness);
|
||||
getPlayerData(client).businessOrderAmount = 0;
|
||||
getPlayerData(client).businessOrderBusiness = false;
|
||||
getPlayerData(client).businessOrderItem = -1;
|
||||
getPlayerData(client).businessOrderValue = -1;
|
||||
|
||||
}
|
||||
} else {
|
||||
showPlayerErrorGUI(client, `You aren't ordering anything for a business!`, `Business Order Canceled`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
showPlayerErrorGUI(client, `You aren't ordering anything for a business!`, `Business Order Canceled`);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
getPlayerData(client).promptType = VRR_PROMPT_NONE;
|
||||
getPlayerData(client).promptType = VRR_PROMPT_NONE;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function canPlayerUseGUI(client) {
|
||||
return (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client));
|
||||
return (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playerPromptAnswerYesCommand(command, params, client) {
|
||||
playerPromptAnswerYes(client);
|
||||
playerPromptAnswerYes(client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playerPromptAnswerNoCommand(command, params, client) {
|
||||
playerPromptAnswerNo(client);
|
||||
playerPromptAnswerNo(client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playerToggledGUI(client) {
|
||||
toggleAccountGUICommand("gui", "", client);
|
||||
toggleAccountGUICommand("gui", "", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerChangePasswordGUI(client) {
|
||||
sendNetworkEventToPlayer("vrr.changePassword", client);
|
||||
sendNetworkEventToPlayer("vrr.changePassword", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerTwoFactorAuthenticationGUI(client) {
|
||||
sendNetworkEventToPlayer("vrr.2fa", client);
|
||||
sendNetworkEventToPlayer("vrr.2fa", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -15,144 +15,144 @@ function initHelpScript() {
|
||||
// ===========================================================================
|
||||
|
||||
let randomTips = [
|
||||
`{MAINCOLOUR}Look for yellow dots on your map for job locations.`,
|
||||
`{MAINCOLOUR}You can set custom key binds. Use {ALTCOLOUR}/help keys {MAINCOLOUR} for details.`,
|
||||
`{MAINCOLOUR}Use /notips if you don't want to see tips and extra information`,
|
||||
`{MAINCOLOUR}You can edit your keybinds using {ALTCOLOUR}/bindkey and /unbindkey`,
|
||||
`{MAINCOLOUR}Press ℹ️ to see your inventory, and use number keys to select an item`,
|
||||
`{MAINCOLOUR}Use /buy at a business to purchase items.`,
|
||||
`{MAINCOLOUR}Found a bug? Report it with {ALTCOLOUR}/bug`,
|
||||
`{MAINCOLOUR}Have an idea or suggestion for the server? Let the devs know using {ALTCOLOUR}/idea`,
|
||||
`{MAINCOLOUR}Want to buy a business? Use /bizbuy at one for sale`,
|
||||
`{MAINCOLOUR}Want to buy a house? Use /housebuy at one for sale`,
|
||||
`{MAINCOLOUR}Want to buy a vehicle? Visit a dealership and enter one for info on how to buy it!`,
|
||||
`{MAINCOLOUR}Switch to any of your characters with {ALTCOLOUR}/switchchar`,
|
||||
`{MAINCOLOUR}Use {ALTCOLOUR}/iplogin {MAINCOLOUR}to automatically login when connecting with the same IP`,
|
||||
`{MAINCOLOUR}Use {ALTCOLOUR}/houselights or /bizlights {MAINCOLOUR}to turn on/off the lights in your house or business`,
|
||||
`{MAINCOLOUR}Use {ALTCOLOUR}/radiostation {MAINCOLOUR}to play an internet radio station in your car, house, or business`,
|
||||
//`{MAINCOLOUR}Lower your car windows with /windows {ALTCOLOUR} to play the vehicle's internet radio station {ALTCOLOUR}(/radiostation) {MAINCOLOUR}to nearby players`,
|
||||
//`{MAINCOLOUR}Lower your car windows with /windows {ALTCOLOUR} to play the vehicle's internet radio station {ALTCOLOUR}(/radiostation) {MAINCOLOUR}to nearby players`,
|
||||
//`{MAINCOLOUR}Tax is based on your total wealth. This includes money, vehicles, businesses and more.`,
|
||||
//`{MAINCOLOUR}Don't go broke because of a hospital bill! Get insured today by visiting an insurance agency!`,
|
||||
//`{MAINCOLOUR}Don't go broke because your car was destroyed. Visit an insurance agency today!`,
|
||||
//`{MAINCOLOUR}You can find most locations by using {ALTCOLOUR}/gps`,
|
||||
//`{MAINCOLOUR}Want to advertise your business? Visit the news station and place an /ad today!`,
|
||||
//`{MAINCOLOUR}You can change your quick item display. Choices are GTAV-style pie menu or Minecraft-style hotbar`,
|
||||
//`{MAINCOLOUR}Hold [#0066FF]E {MAINCOLOUR}to hail a nearby taxi if you need a ride.`,
|
||||
//`{MAINCOLOUR}Press [#0066FF]G {MAINCOLOUR}to enter a vehicle as passenger.`,
|
||||
//`{MAINCOLOUR}Banks can provide loans. Use {ALTCOLOUR}/help loans {MAINCOLOUR} for more details.`,
|
||||
`{MAINCOLOUR}Want to make a clan? Use {ALTCOLOUR}/help clans {MAINCOLOUR} for details.`,
|
||||
`{MAINCOLOUR}Legal weapons can be purchased at any ammunation.`,
|
||||
`{MAINCOLOUR}Look for yellow dots on your map for job locations.`,
|
||||
`{MAINCOLOUR}You can set custom key binds. Use {ALTCOLOUR}/help keys {MAINCOLOUR} for details.`,
|
||||
`{MAINCOLOUR}Use /notips if you don't want to see tips and extra information`,
|
||||
`{MAINCOLOUR}You can edit your keybinds using {ALTCOLOUR}/bindkey and /unbindkey`,
|
||||
`{MAINCOLOUR}Press ℹ️ to see your inventory, and use number keys to select an item`,
|
||||
`{MAINCOLOUR}Use /buy at a business to purchase items.`,
|
||||
`{MAINCOLOUR}Found a bug? Report it with {ALTCOLOUR}/bug`,
|
||||
`{MAINCOLOUR}Have an idea or suggestion for the server? Let the devs know using {ALTCOLOUR}/idea`,
|
||||
`{MAINCOLOUR}Want to buy a business? Use /bizbuy at one for sale`,
|
||||
`{MAINCOLOUR}Want to buy a house? Use /housebuy at one for sale`,
|
||||
`{MAINCOLOUR}Want to buy a vehicle? Visit a dealership and enter one for info on how to buy it!`,
|
||||
`{MAINCOLOUR}Switch to any of your characters with {ALTCOLOUR}/switchchar`,
|
||||
`{MAINCOLOUR}Use {ALTCOLOUR}/iplogin {MAINCOLOUR}to automatically login when connecting with the same IP`,
|
||||
`{MAINCOLOUR}Use {ALTCOLOUR}/houselights or /bizlights {MAINCOLOUR}to turn on/off the lights in your house or business`,
|
||||
`{MAINCOLOUR}Use {ALTCOLOUR}/radiostation {MAINCOLOUR}to play an internet radio station in your car, house, or business`,
|
||||
//`{MAINCOLOUR}Lower your car windows with /windows {ALTCOLOUR} to play the vehicle's internet radio station {ALTCOLOUR}(/radiostation) {MAINCOLOUR}to nearby players`,
|
||||
//`{MAINCOLOUR}Lower your car windows with /windows {ALTCOLOUR} to play the vehicle's internet radio station {ALTCOLOUR}(/radiostation) {MAINCOLOUR}to nearby players`,
|
||||
//`{MAINCOLOUR}Tax is based on your total wealth. This includes money, vehicles, businesses and more.`,
|
||||
//`{MAINCOLOUR}Don't go broke because of a hospital bill! Get insured today by visiting an insurance agency!`,
|
||||
//`{MAINCOLOUR}Don't go broke because your car was destroyed. Visit an insurance agency today!`,
|
||||
//`{MAINCOLOUR}You can find most locations by using {ALTCOLOUR}/gps`,
|
||||
//`{MAINCOLOUR}Want to advertise your business? Visit the news station and place an /ad today!`,
|
||||
//`{MAINCOLOUR}You can change your quick item display. Choices are GTAV-style pie menu or Minecraft-style hotbar`,
|
||||
//`{MAINCOLOUR}Hold [#0066FF]E {MAINCOLOUR}to hail a nearby taxi if you need a ride.`,
|
||||
//`{MAINCOLOUR}Press [#0066FF]G {MAINCOLOUR}to enter a vehicle as passenger.`,
|
||||
//`{MAINCOLOUR}Banks can provide loans. Use {ALTCOLOUR}/help loans {MAINCOLOUR} for more details.`,
|
||||
`{MAINCOLOUR}Want to make a clan? Use {ALTCOLOUR}/help clans {MAINCOLOUR} for details.`,
|
||||
`{MAINCOLOUR}Legal weapons can be purchased at any ammunation.`,
|
||||
];
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function helpCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
showMainHelpMessage(client);
|
||||
return false;
|
||||
}
|
||||
showMainHelpMessage(client);
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
switch(toLowerCase(getParam(params, " ", 1))) {
|
||||
case "account":
|
||||
showAccountHelpMessage(client);
|
||||
break;
|
||||
switch(toLowerCase(getParam(params, " ", 1))) {
|
||||
case "account":
|
||||
showAccountHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "vehicle":
|
||||
case "veh":
|
||||
case "vehs":
|
||||
case "vehicles":
|
||||
case "car":
|
||||
case "cars":
|
||||
showVehicleHelpMessage(client);
|
||||
break;
|
||||
case "vehicle":
|
||||
case "veh":
|
||||
case "vehs":
|
||||
case "vehicles":
|
||||
case "car":
|
||||
case "cars":
|
||||
showVehicleHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "dealership":
|
||||
showVehicleDealershipHelpMessage(client);
|
||||
break;
|
||||
case "dealership":
|
||||
showVehicleDealershipHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "business":
|
||||
showBusinessHelpMessage(client);
|
||||
break;
|
||||
case "business":
|
||||
showBusinessHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "job":
|
||||
showJobHelpMessage(client);
|
||||
break;
|
||||
case "job":
|
||||
showJobHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "chat":
|
||||
showChatHelpMessage(client);
|
||||
break;
|
||||
case "chat":
|
||||
showChatHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "rules":
|
||||
showRulesHelpMessage(client);
|
||||
break;
|
||||
case "rules":
|
||||
showRulesHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "website":
|
||||
showWebsiteHelpMessage(client);
|
||||
break;
|
||||
case "website":
|
||||
showWebsiteHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "discord":
|
||||
showDiscordHelpMessage(client);
|
||||
break;
|
||||
case "discord":
|
||||
showDiscordHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "anim":
|
||||
case "anims":
|
||||
case "animation":
|
||||
case "animations":
|
||||
showAnimationHelpMessage(client);
|
||||
break;
|
||||
case "anim":
|
||||
case "anims":
|
||||
case "animation":
|
||||
case "animations":
|
||||
showAnimationHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "skin":
|
||||
case "skins":
|
||||
case "clothes":
|
||||
showClothesHelpMessage(client);
|
||||
break;
|
||||
case "skin":
|
||||
case "skins":
|
||||
case "clothes":
|
||||
showClothesHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "key":
|
||||
case "keys":
|
||||
case "keybinds":
|
||||
case "keybind":
|
||||
case "bindkey":
|
||||
case "bindkeys":
|
||||
showBindKeysHelpMessage(client);
|
||||
break;
|
||||
case "key":
|
||||
case "keys":
|
||||
case "keybinds":
|
||||
case "keybind":
|
||||
case "bindkey":
|
||||
case "bindkeys":
|
||||
showBindKeysHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "command":
|
||||
case "cmd":
|
||||
showCommandHelpMessage(client, getParam(params, " ", 2));
|
||||
break;
|
||||
case "command":
|
||||
case "cmd":
|
||||
showCommandHelpMessage(client, getParam(params, " ", 2));
|
||||
break;
|
||||
|
||||
case "clan":
|
||||
case "clans":
|
||||
case "group":
|
||||
case "groups":
|
||||
case "faction":
|
||||
case "factions":
|
||||
case "family":
|
||||
case "families":
|
||||
showClanHelpMessage(client);
|
||||
break;
|
||||
case "clan":
|
||||
case "clans":
|
||||
case "group":
|
||||
case "groups":
|
||||
case "faction":
|
||||
case "factions":
|
||||
case "family":
|
||||
case "families":
|
||||
showClanHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "radio":
|
||||
case "radiostations":
|
||||
case "music":
|
||||
showRadioHelpMessage(client);
|
||||
break;
|
||||
case "radio":
|
||||
case "radiostations":
|
||||
case "music":
|
||||
showRadioHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "economy":
|
||||
case "wealth":
|
||||
case "tax":
|
||||
case "taxes":
|
||||
case "payday":
|
||||
showWealthAndTaxHelpMessage(client);
|
||||
break;
|
||||
case "economy":
|
||||
case "wealth":
|
||||
case "tax":
|
||||
case "taxes":
|
||||
case "payday":
|
||||
showWealthAndTaxHelpMessage(client);
|
||||
break;
|
||||
|
||||
default:
|
||||
showMainHelpMessage(client);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
showMainHelpMessage(client);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// == Account Help =============================
|
||||
@@ -184,152 +184,152 @@ function helpCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function showMainHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderHelpMainList")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use /help <category> for commands and info. Example: {ALTCOLOUR}/help vehicle`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Help Categories: [#A9A9A9]account, command, vehicle, job, chat, rules, website, animation`);
|
||||
messagePlayerNormal(client, `{clanOrange}• [#A9A9A9]skin, mechanic, dealership, discord, colour, keybind`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderHelpMainList")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use /help <category> for commands and info. Example: {ALTCOLOUR}/help vehicle`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Help Categories: [#A9A9A9]account, command, vehicle, job, chat, rules, website, animation`);
|
||||
messagePlayerNormal(client, `{clanOrange}• [#A9A9A9]skin, mechanic, dealership, discord, colour, keybind`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showAccountHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAccountHelp")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Do not share your password with anybody else.`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/changepass{MAINCOLOUR} to change your password.`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some settings you can use: {ALTCOLOUR}/gui, /logo, /iplogin, /autolastchar, /2fa, /loginalert`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAccountHelp")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Do not share your password with anybody else.`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/changepass{MAINCOLOUR} to change your password.`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some settings you can use: {ALTCOLOUR}/gui, /logo, /iplogin, /autolastchar, /2fa, /loginalert`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showVehicleHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderVehicleHelp")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit dealerships to buy new vehicles (Use {ALTCOLOUR}/help dealership {MAINCOLOUR}for more info.)`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some commands: {ALTCOLOUR}/lock, /engine, /lights, /trunk, /rentveh, /buyveh, /rentprice, /buyprice`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Your personal vehicles will save wherever you or somebody else leaves them!`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit a mechanic garage to repair, colour, and tune up your car! {ALTCOLOUR}/help mechanic {MAINCOLOUR} for info`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Don't forget to register and insure your vehicle! Use {ALTCOLOUR}/gps {MAINCOLOUR}to find a DMV for this.`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderVehicleHelp")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit dealerships to buy new vehicles (Use {ALTCOLOUR}/help dealership {MAINCOLOUR}for more info.)`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some commands: {ALTCOLOUR}/lock, /engine, /lights, /trunk, /rentveh, /buyveh, /rentprice, /buyprice`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Your personal vehicles will save wherever you or somebody else leaves them!`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit a mechanic garage to repair, colour, and tune up your car! {ALTCOLOUR}/help mechanic {MAINCOLOUR} for info`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Don't forget to register and insure your vehicle! Use {ALTCOLOUR}/gps {MAINCOLOUR}to find a DMV for this.`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showVehicleDealershipHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderVehicleDealershipHelp")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit a vehicle dealer to buy new vehicles. Use {ALTCOLOUR}/gps {MAINCOLOUR}to find one.`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}At the dealer, simply enter a car you want to buy, and the price will be shown to you`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}If you want to buy the vehicle and have enough money, use {ALTCOLOUR}/buyveh {MAINCOLOUR}and you will be given keys`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}A new car for sale will appear when you drive away from the dealer.`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderVehicleDealershipHelp")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit a vehicle dealer to buy new vehicles. Use {ALTCOLOUR}/gps {MAINCOLOUR}to find one.`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}At the dealer, simply enter a car you want to buy, and the price will be shown to you`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}If you want to buy the vehicle and have enough money, use {ALTCOLOUR}/buyveh {MAINCOLOUR}and you will be given keys`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}A new car for sale will appear when you drive away from the dealer.`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showJobHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderJobHelp")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit job locations get a job and earn money. Look for yellow spots on the map`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}At a job location, use {ALTCOLOUR}/takejob {MAINCOLOUR}to get the job. Use {ALTCOLOUR}/quitjob {MAINCOLOUR}to quit your job`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/startwork {MAINCOLOUR}to begin working. You can also get a job {ALTCOLOUR}/uniform and {ALTCOLOUR}/equipment`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Most job vehicles are locked. Use {ALTCOLOUR}/lock {MAINCOLOUR}near one to enter it.`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}When entering a job vehicle, information on how to do the job will be shown to you.`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderJobHelp")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit job locations get a job and earn money. Look for yellow spots on the map`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}At a job location, use {ALTCOLOUR}/takejob {MAINCOLOUR}to get the job. Use {ALTCOLOUR}/quitjob {MAINCOLOUR}to quit your job`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/startwork {MAINCOLOUR}to begin working. You can also get a job {ALTCOLOUR}/uniform and {ALTCOLOUR}/equipment`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Most job vehicles are locked. Use {ALTCOLOUR}/lock {MAINCOLOUR}near one to enter it.`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}When entering a job vehicle, information on how to do the job will be shown to you.`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showChatHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderChatHelp")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}There are two main types of chat: out-of-character (OOC) and in-character (IC)`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Mixing these two types is not proper roleplay. See {ALTCOLOUR}/rules {MAINCOLOUR}for info.`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some chat commands: {ALTCOLOUR}/dm /whisper /talk /shout /me.`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some have shorter names available ({ALTCOLOUR}/t {MAINCOLOUR}for talk, {ALTCOLOUR}/s {MAINCOLOUR}for shout, etc)`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderChatHelp")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}There are two main types of chat: out-of-character (OOC) and in-character (IC)`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Mixing these two types is not proper roleplay. See {ALTCOLOUR}/rules {MAINCOLOUR}for info.`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some chat commands: {ALTCOLOUR}/dm /whisper /talk /shout /me.`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some have shorter names available ({ALTCOLOUR}/t {MAINCOLOUR}for talk, {ALTCOLOUR}/s {MAINCOLOUR}for shout, etc)`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showRulesHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderServerRulesList")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 0));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 1));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 2));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 3));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 4), `{ALTCOLOUR}/help language {MAINCOLOUR}`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderServerRulesList")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 0));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 1));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 2));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 3));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 4), `{ALTCOLOUR}/help language {MAINCOLOUR}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showWebsiteHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderWebsiteInfo")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${server.getRule("Website")}`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderWebsiteInfo")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${server.getRule("Website")}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showDiscordHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderDiscordInfo")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${server.getRule("Website")}`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderDiscordInfo")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${server.getRule("Website")}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showAnimationHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAnimationHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "AnimationHelp", 0, `{ALTCOLOUR}/buy {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "AnimationHelp", 1, `{ALTCOLOUR}/an {MAINCOLOUR}`, `{ALTCOLOUR}/anim {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "AnimationHelp", 2, `{ALTCOLOUR}/animlist {MAINCOLOUR}`));
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAnimationHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "AnimationHelp", 0, `{ALTCOLOUR}/buy {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "AnimationHelp", 1, `{ALTCOLOUR}/an {MAINCOLOUR}`, `{ALTCOLOUR}/anim {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "AnimationHelp", 2, `{ALTCOLOUR}/animlist {MAINCOLOUR}`));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showClothesHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderSkinHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 0, `{ALTCOLOUR}/buy {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 1, `{ALTCOLOUR}/help items {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 2));
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderSkinHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 0, `{ALTCOLOUR}/buy {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 1, `{ALTCOLOUR}/help items {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 2));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showBindKeysHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBindableKeysHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 0, `{ALTCOLOUR}/keybinds {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 1, `{ALTCOLOUR}/bindkey {MAINCOLOUR}`, `{ALTCOLOUR}/unbindkey {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 2, `{ALTCOLOUR}K {MAINCOLOUR}`, `{ALTCOLOUR}L {MAINCOLOUR}`, `{ALTCOLOUR}J {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 3, `{ALTCOLOUR}I {MAINCOLOUR}`, `{ALTCOLOUR}1-9 {MAINCOLOUR}`, `{ALTCOLOUR}0 {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 4, `{ALTCOLOUR}U {MAINCOLOUR}`, `{ALTCOLOUR}O {MAINCOLOUR}`, `{ALTCOLOUR}P {MAINCOLOUR}`));
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBindableKeysHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 0, `{ALTCOLOUR}/keybinds {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 1, `{ALTCOLOUR}/bindkey {MAINCOLOUR}`, `{ALTCOLOUR}/unbindkey {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 2, `{ALTCOLOUR}K {MAINCOLOUR}`, `{ALTCOLOUR}L {MAINCOLOUR}`, `{ALTCOLOUR}J {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 3, `{ALTCOLOUR}I {MAINCOLOUR}`, `{ALTCOLOUR}1-9 {MAINCOLOUR}`, `{ALTCOLOUR}0 {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 4, `{ALTCOLOUR}U {MAINCOLOUR}`, `{ALTCOLOUR}O {MAINCOLOUR}`, `{ALTCOLOUR}P {MAINCOLOUR}`));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showBusinessHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBusinessHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 0));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 1));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 2, `{ALTCOLOUR}/bizorder, /bizlock, /bizlights, /radiostation, /bizitemprice, /bizbuyprice, /bizfee, /biztill, /bizwithdraw, /bizdeposit`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 3));
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBusinessHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 0));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 1));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 2, `{ALTCOLOUR}/bizorder, /bizlock, /bizlights, /radiostation, /bizitemprice, /bizbuyprice, /bizfee, /biztill, /bizwithdraw, /bizdeposit`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 3));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showClanHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderClanHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 0));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 1));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 2, `{ALTCOLOUR}/clan, /clanmotd, /clanname, /clanowner, /clanhouse, /clanbiz, /claninvite, /clanuninvite, /clansetrank`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 3, `{ALTCOLOUR}/clanranks, /clanflags, /clanaddrank, /clandelrank, /clanaddrankflag, /clandelrankflag, /clanaddmemberflag, /clandelmemberflag`));
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderClanHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 0));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 1));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 2, `{ALTCOLOUR}/clan, /clanmotd, /clanname, /clanowner, /clanhouse, /clanbiz, /claninvite, /clanuninvite, /clansetrank`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 3, `{ALTCOLOUR}/clanranks, /clanflags, /clanaddrank, /clandelrank, /clanaddrankflag, /clandelrankflag, /clanaddmemberflag, /clandelmemberflag`));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showRadioHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderRadioHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 0, `{ALTCOLOUR}/radiostation {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 1, `{ALTCOLOUR}/radiostations {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 2, `{ALTCOLOUR}/radiovolume {MAINCOLOUR}`));
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderRadioHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 0, `{ALTCOLOUR}/radiostation {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 1, `{ALTCOLOUR}/radiostations {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 2, `{ALTCOLOUR}/radiovolume {MAINCOLOUR}`));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showWealthAndTaxHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderWealthandTaxHelp")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Your taxes on payday are ${100*getGlobalConfig().economy.incomeTaxRate}% of your calculated wealth.`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Your calculated wealth is a total sum based on how many vehicles, houses, and businesses you have.`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderWealthandTaxHelp")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Your taxes on payday are ${100*getGlobalConfig().economy.incomeTaxRate}% of your calculated wealth.`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Your calculated wealth is a total sum based on how many vehicles, houses, and businesses you have.`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Each vehicle is {ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerVehicle}, {MAINCOLOUR}each house is {ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerHouse}, {MAINCOLOUR}and each business is {ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerBusiness}`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/wealth {MAINCOLOUR}to see your current wealth, and {ALTCOLOUR}/tax {MAINCOLOUR}to see how much you'll pay in tax each payday`);
|
||||
}
|
||||
@@ -337,35 +337,35 @@ function showWealthAndTaxHelpMessage(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function showCommandHelpMessage(client, commandName) {
|
||||
if(!commandName) {
|
||||
messagePlayerSyntax(client, `${getCommandSyntaxText("help")}command <command name>`);
|
||||
return false;
|
||||
}
|
||||
if(!commandName) {
|
||||
messagePlayerSyntax(client, `${getCommandSyntaxText("help")}command <command name>`);
|
||||
return false;
|
||||
}
|
||||
|
||||
commandName = toLowerCase(commandName);
|
||||
commandName = commandName.trim();
|
||||
commandName = toLowerCase(commandName);
|
||||
commandName = commandName.trim();
|
||||
|
||||
if(commandName.slice(0, 1) == "/") {
|
||||
commandName = commandName.slice(1);
|
||||
}
|
||||
if(commandName.slice(0, 1) == "/") {
|
||||
commandName = commandName.slice(1);
|
||||
}
|
||||
|
||||
let command = getCommandData(commandName);
|
||||
let aliases = getCommandAliasesNames(command);
|
||||
let command = getCommandData(commandName);
|
||||
let aliases = getCommandAliasesNames(command);
|
||||
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderCommandInfo", commandName)));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Description: ${command.description}`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderCommandInfo", commandName)));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Description: ${command.description}`);
|
||||
|
||||
if(aliases.length > 0) {
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: ${aliases.join(", ")}`);
|
||||
} else {
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: (None)`);
|
||||
}
|
||||
if(aliases.length > 0) {
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: ${aliases.join(", ")}`);
|
||||
} else {
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: (None)`);
|
||||
}
|
||||
|
||||
//messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Usable on Discord: ${getYesNoFromBool(command.allowOnDiscord)}`);
|
||||
//messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Usable on Discord: ${getYesNoFromBool(command.allowOnDiscord)}`);
|
||||
|
||||
//if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("BasicModeration"))) {
|
||||
// messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Usable on Discord: ${getYesNoFromBool(command.allowOnDiscord)}`);
|
||||
//}
|
||||
//if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("BasicModeration"))) {
|
||||
// messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Usable on Discord: ${getYesNoFromBool(command.allowOnDiscord)}`);
|
||||
//}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -10,27 +10,27 @@
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerHandCuffed(client) {
|
||||
return (getPlayerData(client).pedState == VRR_PEDSTATE_BINDED);
|
||||
return (getPlayerData(client).pedState == VRR_PEDSTATE_BINDED);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function handCuffPlayer(client) {
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_BINDED;
|
||||
setPlayerControlState(client, false);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_BINDED;
|
||||
setPlayerControlState(client, false);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function unHandCuffPlayer(client) {
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
setPlayerControlState(client, true);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
setPlayerControlState(client, true);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerSurrendered(client) {
|
||||
return true; //(getPlayerData(client).pedState == VRR_PEDSTATE_TAZED || getPlayerData(client).pedState == VRR_PEDSTATE_HANDSUP);
|
||||
return true; //(getPlayerData(client).pedState == VRR_PEDSTATE_TAZED || getPlayerData(client).pedState == VRR_PEDSTATE_HANDSUP);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -8,48 +8,48 @@
|
||||
// ===========================================================================
|
||||
|
||||
function getItemWithPhoneNumber(phoneNumber) {
|
||||
for(let i in getServerData().items) {
|
||||
if(getItemTypeData(getItemData(i).itemTypeIndex).useType == VRR_ITEM_USETYPE_PHONE) {
|
||||
if(getItemData(i).value == phoneNumber) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
for(let i in getServerData().items) {
|
||||
if(getItemTypeData(getItemData(i).itemTypeIndex).useType == VRR_ITEM_USETYPE_PHONE) {
|
||||
if(getItemData(i).value == phoneNumber) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isPhoneItemEnabled(itemIndex) {
|
||||
return getItemData(itemIndex).enabled;
|
||||
return getItemData(itemIndex).enabled;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function ringPhoneForNearbyPlayers(itemIndex) {
|
||||
/*
|
||||
if(isPhoneItemEnabled(itemIndex)) {
|
||||
switch(getItemData(itemIndex).ownerType) {
|
||||
case VRR_ITEM_OWNER_GROUND:
|
||||
playRingtoneForPlayersInRange(getItemData(itemIndex).position, getItemData(i).extra);
|
||||
break;
|
||||
/*
|
||||
if(isPhoneItemEnabled(itemIndex)) {
|
||||
switch(getItemData(itemIndex).ownerType) {
|
||||
case VRR_ITEM_OWNER_GROUND:
|
||||
playRingtoneForPlayersInRange(getItemData(itemIndex).position, getItemData(i).extra);
|
||||
break;
|
||||
|
||||
case VRR_ITEM_OWNER_VEHTRUNK:
|
||||
playRingtoneForPlayersInRange(getVehiclePosition(getItemData(itemIndex).ownerId), getItemData(i).extra);
|
||||
break;
|
||||
case VRR_ITEM_OWNER_VEHTRUNK:
|
||||
playRingtoneForPlayersInRange(getVehiclePosition(getItemData(itemIndex).ownerId), getItemData(i).extra);
|
||||
break;
|
||||
|
||||
case VRR_ITEM_OWNER_VEHDASH:
|
||||
playRingtoneForPlayersInRange(getVehiclePosition(getItemData(itemIndex).ownerId), getItemData(i).extra);
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
case VRR_ITEM_OWNER_VEHDASH:
|
||||
playRingtoneForPlayersInRange(getVehiclePosition(getItemData(itemIndex).ownerId), getItemData(i).extra);
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function phoneTransmit(radioFrequency, messageText, transmittingPlayer) {
|
||||
phoneOutgoingToNearbyPlayers(transmittingPlayer, messageText);
|
||||
phoneOutgoingToNearbyPlayers(transmittingPlayer, messageText);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -10,21 +10,21 @@
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerTied(client) {
|
||||
return (getPlayerData(client).pedState == VRR_PEDSTATE_BINDED);
|
||||
return (getPlayerData(client).pedState == VRR_PEDSTATE_BINDED);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function ropeTiePlayer(client) {
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_BINDED;
|
||||
setPlayerControlState(client, false);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_BINDED;
|
||||
setPlayerControlState(client, false);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function ropeUnTiePlayer(client) {
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
setPlayerControlState(client, true);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
setPlayerControlState(client, true);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -10,34 +10,34 @@
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerTazed(client) {
|
||||
return (getPlayerData(client).pedState == VRR_PEDSTATE_TAZED);
|
||||
return (getPlayerData(client).pedState == VRR_PEDSTATE_TAZED);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function tazePlayer(client) {
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_TAZED;
|
||||
setPlayerControlState(client, false);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_TAZED;
|
||||
setPlayerControlState(client, false);
|
||||
|
||||
let animationId = getAnimationFromParams("tazed");
|
||||
if(animationId != false) {
|
||||
forcePlayerPlayAnimation(client, animationId);
|
||||
}
|
||||
let animationId = getAnimationFromParams("tazed");
|
||||
if(animationId != false) {
|
||||
forcePlayerPlayAnimation(client, animationId);
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
unTazePlayer(client);
|
||||
doActionToNearbyPlayers(client, `The tazer effect wears off`);
|
||||
}, getGlobalConfig().tazerEffectDuration);
|
||||
setTimeout(function() {
|
||||
unTazePlayer(client);
|
||||
doActionToNearbyPlayers(client, `The tazer effect wears off`);
|
||||
}, getGlobalConfig().tazerEffectDuration);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function unTazePlayer(client) {
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
|
||||
setPlayerControlState(client, true);
|
||||
setPlayerPosition(client, getPlayerData(client).currentAnimationPositionReturnTo);
|
||||
makePedStopAnimation(getPlayerData(client).ped);
|
||||
setPlayerControlState(client, true);
|
||||
setPlayerPosition(client, getPlayerData(client).currentAnimationPositionReturnTo);
|
||||
makePedStopAnimation(getPlayerData(client).ped);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -9,13 +9,6 @@
|
||||
|
||||
function initJobScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Job]: Initializing job script ...");
|
||||
getServerData().jobs = loadJobsFromDatabase();
|
||||
|
||||
createAllJobPickups();
|
||||
createAllJobBlips();
|
||||
|
||||
setAllJobDataIndexes();
|
||||
|
||||
logToConsole(LOG_INFO, "[VRR.Job]: Job script initialized successfully!");
|
||||
return true;
|
||||
}
|
||||
@@ -39,7 +32,7 @@ function loadJobsFromDatabase() {
|
||||
tempJobData.locations = loadJobLocationsFromDatabase(tempJobData.databaseId);
|
||||
tempJobData.equipment = loadJobEquipmentsFromDatabase(tempJobData.databaseId);
|
||||
tempJobData.uniforms = loadJobUniformsFromDatabase(tempJobData.databaseId);
|
||||
tempJobData.routes = loadJobRoutesFromDatabase(tempJobData.databaseId);
|
||||
//tempJobData.routes = loadJobRoutesFromDatabase(tempJobData.databaseId);
|
||||
tempJobs.push(tempJobData);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job]: Job '${tempJobData.name}' loaded from database successfully!`);
|
||||
}
|
||||
@@ -617,9 +610,9 @@ function stopWorking(client) {
|
||||
|
||||
let jobVehicle = getPlayerData(client).lastJobVehicle;
|
||||
if(jobVehicle) {
|
||||
if(client.player.vehicle) {
|
||||
if(getPlayerVehicle(client) == jobVehicle) {
|
||||
removePlayerFromVehicle(client);
|
||||
//client.player.removeFromVehicle();
|
||||
//getPlayerPed(client).removeFromVehicle();
|
||||
}
|
||||
|
||||
respawnVehicle(jobVehicle);
|
||||
@@ -631,7 +624,7 @@ function stopWorking(client) {
|
||||
deleteJobItems(client);
|
||||
restorePlayerJobLockerItems(client);
|
||||
respawnJobVehicle(client);
|
||||
sendPlayerStopJobRoute(client);
|
||||
sendPlayerStopJobRoute(client);
|
||||
|
||||
let jobId = getPlayerJob(client);
|
||||
switch(getJobType(jobId)) {
|
||||
@@ -665,9 +658,9 @@ function stopWorking(client) {
|
||||
case VRR_JOB_DRUG:
|
||||
break;
|
||||
|
||||
case VRR_JOB_GENERIC:
|
||||
messagePlayerInfo(client, "Your vehicle has been respawned at your job location");
|
||||
break;
|
||||
case VRR_JOB_GENERIC:
|
||||
messagePlayerInfo(client, "Your vehicle has been respawned at your job location");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -753,13 +746,13 @@ function jobUniformCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(uniformId == 0) {
|
||||
setPlayerSkin(client, getPlayerCurrentSubAccount(client).skin);
|
||||
meActionToNearbyPlayers(client, `takes off their uniform`);
|
||||
} else {
|
||||
setPlayerSkin(client, jobData.uniforms[uniformId-1].skin);
|
||||
meActionToNearbyPlayers(client, `puts on ${getProperDeterminerForName(jobData.uniforms[uniformId-1].name)} ${jobData.uniforms[uniformId-1].name} uniform`);
|
||||
}
|
||||
if(uniformId == 0) {
|
||||
setPlayerSkin(client, getPlayerCurrentSubAccount(client).skin);
|
||||
meActionToNearbyPlayers(client, `takes off their uniform`);
|
||||
} else {
|
||||
setPlayerSkin(client, jobData.uniforms[uniformId-1].skin);
|
||||
meActionToNearbyPlayers(client, `puts on ${getProperDeterminerForName(jobData.uniforms[uniformId-1].name)} ${jobData.uniforms[uniformId-1].name} uniform`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -942,7 +935,7 @@ function reloadAllJobsCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
messageAdminAction(`All server jobs have been reloaded by an admin!`);
|
||||
announceAdminAction("AllJobsReloaded");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -966,8 +959,8 @@ function createJob(name) {
|
||||
tempJobData.pickupModel = getGameConfig().pickupModels[getGame()].job;
|
||||
|
||||
getServerData().jobs.push(tempJobData);
|
||||
saveJobToDatabase(tempJobData);
|
||||
setAllJobDataIndexes();
|
||||
saveJobToDatabase(tempJobData);
|
||||
setAllJobDataIndexes();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -986,7 +979,7 @@ function createJobLocationCommand(command, params, client) {
|
||||
}
|
||||
|
||||
createJobLocation(jobId, getPlayerPosition(client), getPlayerInterior(client), getPlayerDimension(client));
|
||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}created a location for the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} created a location for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -995,7 +988,7 @@ function createJobLocationCommand(command, params, client) {
|
||||
function deleteJobLocationCommand(command, params, client) {
|
||||
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client));
|
||||
|
||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}deleted location {ALTCOLOUR}${closestJobLocation.index} (DB ID ${closestJobLocation.databaseId}) {MAINCOLOUR}for the {jobYellow}${getJobData(closestJobLocation.jobIndex).name} {MAINCOLOUR}job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} deleted location {ALTCOLOUR}${closestJobLocation.index} (DB ID ${closestJobLocation.databaseId}){MAINCOLOUR} for the {jobYellow}${getJobData(closestJobLocation.jobIndex).name}{MAINCOLOUR} job`);
|
||||
|
||||
|
||||
deleteJobLocation(closestJobLocation);
|
||||
@@ -1012,7 +1005,7 @@ function toggleJobLocationEnabledCommand(command, params, client) {
|
||||
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client));
|
||||
|
||||
closestJobLocation.enabled = !closestJobLocation.enabled;
|
||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(closestJobLocation.enabled)} location {ALTCOLOUR}${closestJobLocation.databaseId} {MAINCOLOUR}for the {jobYellow}${getJobData(closestJobLocation.jobIndex).name} {MAINCOLOUR}job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} ${getEnabledDisabledFromBool(closestJobLocation.enabled)} location {ALTCOLOUR}${closestJobLocation.databaseId} {MAINCOLOUR}for the {jobYellow}${getJobData(closestJobLocation.jobIndex).name}{MAINCOLOUR} job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1026,7 +1019,7 @@ function toggleJobEnabledCommand(command, params, client) {
|
||||
let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
||||
|
||||
getJobData(jobId).enabled = !getJobData(jobId).enabled;
|
||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1049,7 +1042,7 @@ function setJobColourCommand(command, params, client) {
|
||||
|
||||
getJobData(jobId).colour = toColour(toInteger(red), toInteger(green), toInteger(blue), 255);
|
||||
getJobData(jobId).needsSaved = true;
|
||||
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} colour to ${red}, ${green}, ${blue}`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} colour to ${red}, ${green}, ${blue}`);
|
||||
|
||||
// Force nametag update in case somebody is using this job
|
||||
updateAllPlayerNameTags();
|
||||
@@ -1096,7 +1089,7 @@ function setJobBlipCommand(command, params, client) {
|
||||
|
||||
getJobData(jobId).blipModel = blipId;
|
||||
getJobData(jobId).needsSaved = true;
|
||||
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} blip model to ${blipString}`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} blip model to ${blipString}`);
|
||||
resetAllJobBlips();
|
||||
}
|
||||
|
||||
@@ -1141,7 +1134,7 @@ function setJobPickupCommand(command, params, client) {
|
||||
|
||||
getJobData(jobId).pickupModel = pickupId;
|
||||
getJobData(jobId).needsSaved = true;
|
||||
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} pickup to ${pickupString}`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} pickup to ${pickupString}`);
|
||||
resetAllJobPickups();
|
||||
}
|
||||
|
||||
@@ -1164,7 +1157,7 @@ function toggleJobRouteEnabledCommand(command, params, client) {
|
||||
}
|
||||
|
||||
getJobData(jobId).routes[jobRoute].enabled = !getJobData(jobId).routes[jobRoute].enabled;
|
||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} ${getEnabledDisabledFromBool(getJobRouteData(jobId, jobRoute).enabled)} route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1190,7 +1183,7 @@ function setJobRouteNameCommand(command, params, client) {
|
||||
|
||||
let oldName = getJobData(jobId).routes[jobRoute].name;
|
||||
getJobData(jobId).routes[jobRoute].name = params;
|
||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set route {ALTCOLOUR}${oldName}{MAINCOLOUR} to {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set route {ALTCOLOUR}${oldName}{MAINCOLOUR} to {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1213,19 +1206,19 @@ function setJobRouteAllLocationDelaysCommand(command, params, client) {
|
||||
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobRoute = getPlayerJobRoute(client);
|
||||
let delay = getParam(params, " ", 1);
|
||||
let delay = getParam(params, " ", 1);
|
||||
|
||||
if(isNaN(delay)) {
|
||||
messagePlayerError(client, getLocaleString(client, "TimeNotNumber"))
|
||||
return false;
|
||||
}
|
||||
if(isNaN(delay)) {
|
||||
messagePlayerError(client, getLocaleString(client, "TimeNotNumber"))
|
||||
return false;
|
||||
}
|
||||
|
||||
for(let i in getJobData(jobId).routes[jobRoute].locations) {
|
||||
getJobData(jobId).routes[jobRoute].locations[i].stopDelay = delay;
|
||||
getJobData(jobId).routes[jobRoute].locations[i].needsSaved = true;
|
||||
}
|
||||
getJobData(jobId).routes[jobRoute].locations[i].stopDelay = delay;
|
||||
getJobData(jobId).routes[jobRoute].locations[i].needsSaved = true;
|
||||
}
|
||||
|
||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set route {ALTCOLOUR}${oldName}{MAINCOLOUR} location's stop delays to {ALTCOLOUR}${delay/1000}{MAINCOLOUR} seconds for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set route {ALTCOLOUR}${oldName}{MAINCOLOUR} location's stop delays to {ALTCOLOUR}${delay/1000}{MAINCOLOUR} seconds for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1269,7 +1262,7 @@ function setJobRouteVehicleColoursCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the vehicle colours to {ALTCOLOUR}${colour1}, ${colour2}{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set the vehicle colours to {ALTCOLOUR}${colour1}, ${colour2}{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1295,7 +1288,7 @@ function setJobRouteFinishMessageCommand(command, params, client) {
|
||||
|
||||
getJobData(jobId).routes[jobRoute].finishMessage = params;
|
||||
getJobData(jobId).routes[jobRoute].needsSaved = true;
|
||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the finish message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set the finish message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1321,7 +1314,7 @@ function setJobRouteStartMessageCommand(command, params, client) {
|
||||
|
||||
getJobData(jobId).routes[jobRoute].startMessage = params;
|
||||
getJobData(jobId).routes[jobRoute].needsSaved = true;
|
||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the start message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set the start message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1347,7 +1340,7 @@ function setJobRouteLocationArriveMessageCommand(command, params, client) {
|
||||
|
||||
getJobData(jobId).routes[jobRoute].locationArriveMessage = params;
|
||||
getJobData(jobId).routes[jobRoute].needsSaved = true;
|
||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the location arrival message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} ${getEnabledDisabledFromBool(getJobData(jobId).enabled)} set the location arrival message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1373,7 +1366,7 @@ function setJobRouteLocationNextMessageCommand(command, params, client) {
|
||||
|
||||
getJobData(jobId).routes[jobRoute].locationNextMessage = params;
|
||||
getJobData(jobId).routes[jobRoute].needsSaved = true;
|
||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the location next message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} ${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the location next message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1405,7 +1398,7 @@ function setJobRoutePayCommand(command, params, client) {
|
||||
|
||||
getJobData(jobId).routes[jobRoute].pay = amount;
|
||||
getJobData(jobId).routes[jobRoute].needsSaved = true;
|
||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the start message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set the start message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1419,7 +1412,7 @@ function toggleJobWhiteListCommand(command, params, client) {
|
||||
let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
||||
|
||||
getJobData(jobId).whiteListEnabled = !getJobData(jobId).whiteListEnabled;
|
||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).whiteListEnabled)} {MAINCOLOUR}the whitelist for the {ALTCOLOUR}${getJobData(jobId).name} {MAINCOLOUR}job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).whiteListEnabled)} {MAINCOLOUR}the whitelist for the {ALTCOLOUR}${getJobData(jobId).name} {MAINCOLOUR}job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1433,7 +1426,7 @@ function toggleJobBlackListCommand(command, params, client) {
|
||||
let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
||||
|
||||
getJobData(jobId).blackListEnabled = !getJobData(jobId).blackListEnabled;
|
||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).blackListEnabled)} {MAINCOLOUR}the blacklist for the {ALTCOLOUR}${getJobData(jobId).name} {MAINCOLOUR}job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} ${getEnabledDisabledFromBool(getJobData(jobId).blackListEnabled)} the blacklist for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1463,7 +1456,7 @@ function addPlayerToJobBlackListCommand(command, params, client) {
|
||||
}
|
||||
|
||||
addPlayerToJobBlackList(targetClient, jobId);
|
||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}added ${getCharacterFullName(targetClient)} {MAINCOLOUR}to the blacklist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} added {ALTCOLOUR}${getCharacterFullName(targetClient)}{MAINCOLOUR} to the blacklist for the {jobYellow}${jobData.name}{MAINCOLOUR} job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1493,7 +1486,7 @@ function removePlayerFromJobBlackListCommand(command, params, client) {
|
||||
}
|
||||
|
||||
removePlayerFromJobBlackList(targetClient, jobId);
|
||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}removed ${getCharacterFullName(targetClient)} {MAINCOLOUR}from the blacklist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} removed {ALTCOLOUR}${getCharacterFullName(targetClient)}{MAINCOLOUR} from the blacklist for the {jobYellow}${jobData.name}{MAINCOLOUR} job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1523,7 +1516,7 @@ function addPlayerToJobWhiteListCommand(command, params, client) {
|
||||
}
|
||||
|
||||
addPlayerToJobWhiteList(targetClient, jobId);
|
||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}added ${getCharacterFullName(targetClient)} {MAINCOLOUR}to the whitelist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)} {MAINCOLOUR}added {ALTCOLOUR}${getCharacterFullName(targetClient)}{MAINCOLOUR} to the whitelist for the {jobYellow}${jobData.name}{MAINCOLOUR} job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1553,7 +1546,7 @@ function removePlayerFromJobWhiteListCommand(command, params, client) {
|
||||
}
|
||||
|
||||
removePlayerFromJobWhiteList(targetClient, jobId);
|
||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}removed ${getCharacterFullName(targetClient)} {MAINCOLOUR}from the whitelist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} removed {ALTCOLOUR}${getCharacterFullName(targetClient)}{MAINCOLOUR} from the whitelist for the {jobYellow}${jobData.name}{MAINCOLOUR} job`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1569,40 +1562,40 @@ function forceAllPlayersToStopWorking() {
|
||||
// ===========================================================================
|
||||
|
||||
function jobStartRouteCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerWorking(client)) {
|
||||
if(!isPlayerWorking(client)) {
|
||||
messagePlayerError(client, "You aren't working yet! Use /startwork first.");
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getJobData(getPlayerJob(client)).routes.length == 0) {
|
||||
if(getJobData(getPlayerJob(client)).routes.length == 0) {
|
||||
messagePlayerError(client, "Your job doesn't have any routes for this location!");
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerInJobVehicle(client)) {
|
||||
messagePlayerError(client, "You need to be in a vehicle that belongs to your job!");
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isPlayerOnJobRoute(client)) {
|
||||
if(isPlayerOnJobRoute(client)) {
|
||||
messagePlayerError(client, "You're already on a job route! Finish the route or use /stoproute");
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
let forceRoute = -1;
|
||||
if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageJobs"))) {
|
||||
if(!areParamsEmpty(params)) {
|
||||
let tempRoute = getJobRouteFromParams(params, getPlayerJob(client));
|
||||
if(tempRoute != false) {
|
||||
forceRoute = tempRoute;
|
||||
}
|
||||
}
|
||||
}
|
||||
let forceRoute = -1;
|
||||
if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageJobs"))) {
|
||||
if(!areParamsEmpty(params)) {
|
||||
let tempRoute = getJobRouteFromParams(params, getPlayerJob(client));
|
||||
if(tempRoute != false) {
|
||||
forceRoute = tempRoute;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
startJobRoute(client, forceRoute);
|
||||
return true;
|
||||
@@ -1611,24 +1604,24 @@ function jobStartRouteCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function jobStopRouteCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerWorking(client)) {
|
||||
if(!isPlayerWorking(client)) {
|
||||
messagePlayerError(client, "You aren't working yet! Use /startwork first.");
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//if(!doesPlayerHaveJobType(client, VRR_JOB_BUS) && !doesPlayerHaveJobType(client, VRR_JOB_GARBAGE)) {
|
||||
//if(!doesPlayerHaveJobType(client, VRR_JOB_BUS) && !doesPlayerHaveJobType(client, VRR_JOB_GARBAGE)) {
|
||||
// messagePlayerError(client, "Your job doesn't use a route!");
|
||||
// return false;
|
||||
// return false;
|
||||
//}
|
||||
|
||||
if(!isPlayerOnJobRoute(client)) {
|
||||
messagePlayerError(client, "You aren't on a job route!");
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
stopJobRoute(client, false, false);
|
||||
@@ -1660,21 +1653,21 @@ function isPlayerWorking(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function startJobRoute(client, forceRoute = -1) {
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobRoute = 0;
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobRoute = 0;
|
||||
|
||||
if(forceRoute == -1) {
|
||||
jobRoute = getRandomJobRouteForLocation(getClosestJobLocationForJob(getPlayerPosition(client), jobId));
|
||||
} else {
|
||||
jobRoute = forceRoute;
|
||||
}
|
||||
if(forceRoute == -1) {
|
||||
jobRoute = getRandomJobRouteForLocation(getClosestJobLocationForJob(getPlayerPosition(client), jobId));
|
||||
} else {
|
||||
jobRoute = forceRoute;
|
||||
}
|
||||
|
||||
if(jobRoute == -1) {
|
||||
messagePlayerError(client, `There are no routes for this location.`);
|
||||
return false;
|
||||
}
|
||||
if(jobRoute == -1) {
|
||||
messagePlayerError(client, `There are no routes for this location.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} is starting job route ${jobRoute} for job ${jobId}`);
|
||||
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} is starting job route ${jobRoute} for job ${jobId}`);
|
||||
|
||||
getPlayerData(client).jobRoute = jobRoute;
|
||||
getPlayerData(client).jobRouteLocation = 0;
|
||||
@@ -1684,26 +1677,26 @@ function startJobRoute(client, forceRoute = -1) {
|
||||
getPlayerVehicle(client).colour2 = getJobRouteData(jobId, jobRoute).vehicleColour2;
|
||||
|
||||
messagePlayerNormal(client, replaceJobRouteStringsInMessage(getJobRouteData(jobId, jobRoute).startMessage, jobId, jobRoute));
|
||||
if(getJobRouteData(jobId, jobRoute).locations.length > 0) {
|
||||
if(getJobRouteData(jobId, jobRoute).locations.length > 0) {
|
||||
showCurrentJobLocation(client);
|
||||
} else {
|
||||
messagePlayerError(client, `There are no locations for this route.`);
|
||||
}
|
||||
messagePlayerError(client, `There are no locations for this route.`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function stopJobRoute(client, successful = false, alertPlayer = true) {
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobId = getPlayerJob(client);
|
||||
|
||||
if(alertPlayer) {
|
||||
messagePlayerAlert(client, replaceJobRouteStringsInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).finishMessage), jobId, getPlayerJobRoute(client));
|
||||
}
|
||||
|
||||
if(successful == true) {
|
||||
finishSuccessfulJobRoute(client);
|
||||
return false;
|
||||
}
|
||||
if(successful == true) {
|
||||
finishSuccessfulJobRoute(client);
|
||||
return false;
|
||||
}
|
||||
|
||||
stopReturnToJobVehicleCountdown(client);
|
||||
sendPlayerStopJobRoute(client);
|
||||
@@ -1797,26 +1790,26 @@ function deleteJobLocation(jobLocationData) {
|
||||
quickDatabaseQuery(`DELETE FROM job_loc WHERE job_loc_id = ${jobLocationData.databaseId}`);
|
||||
}
|
||||
|
||||
deleteJobLocationBlip(tempJob, tempLocation);
|
||||
deleteJobLocationPickup(tempJob, tempLocation);
|
||||
deleteJobLocationBlip(tempJob, tempLocation);
|
||||
deleteJobLocationPickup(tempJob, tempLocation);
|
||||
getJobData(getJobIdFromDatabaseId(tempJob)).locations.splice(tempLocation, 1);
|
||||
setAllJobDataIndexes();
|
||||
setAllJobDataIndexes();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function freezePlayerJobVehicleForRouteLocation(client) {
|
||||
getVehicleData(getPlayerVehicle(client)).engine = false;
|
||||
getVehicleData(getPlayerVehicle(client)).engine = false;
|
||||
setVehicleEngine(getPlayerVehicle(client), getVehicleData(getPlayerVehicle(client)).engine);
|
||||
//setPlayerControlState(client, false);
|
||||
//setPlayerControlState(client, false);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function unFreezePlayerJobVehicleForRouteLocation(client) {
|
||||
getVehicleData(getPlayerVehicle(client)).engine = true;
|
||||
getVehicleData(getPlayerVehicle(client)).engine = true;
|
||||
setVehicleEngine(getPlayerVehicle(client), getVehicleData(getPlayerVehicle(client)).engine);
|
||||
//setPlayerControlState(client, true);
|
||||
//setPlayerControlState(client, true);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2291,24 +2284,33 @@ function createJobLocationPickup(jobId, locationId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getJobData(jobId).pickupModel != -1) {
|
||||
let tempJobData = getJobData(jobId);
|
||||
|
||||
if(tempJobData.pickupModel != -1) {
|
||||
let pickupModelId = getGameConfig().pickupModels[getServerGame()].Job;
|
||||
|
||||
if(getJobData(jobId).pickupModel != 0) {
|
||||
pickupModelId = getJobData(jobId).pickupModel;
|
||||
if(tempJobData.pickupModel != 0) {
|
||||
pickupModelId = tempJobData.pickupModel;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating pickup for location ${locationId} of the ${getServerData().jobs[jobId].name} job`);
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating pickup for location ${locationId} of the ${tempJobData.name} job`);
|
||||
|
||||
getJobData(jobId).locations[locationId].pickup = createGamePickup(pickupModelId, getJobData(jobId).locations[locationId].position, getGameConfig().pickupTypes[getServerGame()].job);
|
||||
setElementDimension(getJobData(jobId).locations[locationId].pickup, getJobData(jobId).locations[locationId].dimension);
|
||||
setElementOnAllDimensions(getJobData(jobId).locations[locationId].pickup, false);
|
||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.owner.type", VRR_PICKUP_JOB, false);
|
||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.owner.id", locationId, false);
|
||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.type", VRR_LABEL_JOB, true);
|
||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.name", getJobData(jobId).name, true);
|
||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.jobType", getJobData(jobId).databaseId, true);
|
||||
addToWorld(getJobData(jobId).locations[locationId].pickup);
|
||||
if(areServerElementsSupported()) {
|
||||
let pickup = createGamePickup(pickupModelId, tempJobData.locations[locationId].position, getGameConfig().pickupTypes[getServerGame()].job);
|
||||
if(pickup != false) {
|
||||
tempJobData.locations[locationId].pickup = pickup;
|
||||
setElementDimension(pickup, tempJobData.locations[locationId].dimension);
|
||||
setElementOnAllDimensions(pickup, false);
|
||||
setEntityData(pickup, "vrr.owner.type", VRR_PICKUP_JOB, false);
|
||||
setEntityData(pickup, "vrr.owner.id", locationId, false);
|
||||
setEntityData(pickup, "vrr.label.type", VRR_LABEL_JOB, true);
|
||||
setEntityData(pickup, "vrr.label.name", tempJobData.name, true);
|
||||
setEntityData(pickup, "vrr.label.jobType", tempJobData.databaseId, true);
|
||||
addToWorld(pickup);
|
||||
}
|
||||
} else {
|
||||
// sendJobToPlayer(null, jobId, tempJobData.name, tempJobData.locations[locationId].position, pickupModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2319,6 +2321,8 @@ function createJobLocationBlip(jobId, locationId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let tempJobData = getJobData(jobId);
|
||||
|
||||
if(getJobData(jobId).blipModel != -1) {
|
||||
let blipModelId = getGameConfig().blipSprites[getServerGame()].Job;
|
||||
|
||||
@@ -2326,12 +2330,17 @@ function createJobLocationBlip(jobId, locationId) {
|
||||
blipModelId = getJobData(jobId).blipModel;
|
||||
}
|
||||
|
||||
getJobData(jobId).locations[locationId].blip = createGameBlip(getJobData(jobId).locations[locationId].position, blipModelId, getColourByType("job"));
|
||||
//setElementStreamInDistance(getServerData().jobs[i].locations[j].blip, 30);
|
||||
//setElementStreamOutDistance(getServerData().jobs[i].locations[j].blip, 40);
|
||||
setElementOnAllDimensions(getJobData(jobId).locations[locationId].blip, false);
|
||||
setElementDimension(getJobData(jobId).locations[locationId].blip, getJobData(jobId).locations[locationId].dimension);
|
||||
addToWorld(getJobData(jobId).locations[locationId].blip);
|
||||
if(areServerElementsSupported()) {
|
||||
let blip = createGameBlip(tempJobData.locations[locationId].position, blipModelId, getColourByType("job"));
|
||||
if(blip != false) {
|
||||
tempJobData.locations[locationId].blip = blip;
|
||||
}
|
||||
setElementOnAllDimensions(blip, false);
|
||||
setElementDimension(blip, tempJobData.locations[locationId].dimension);
|
||||
addToWorld(blip);
|
||||
} else {
|
||||
sendJobToPlayer(null, jobId, tempJobData.name, tempJobData.locations[locationId].position, blipModelId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2408,31 +2417,31 @@ function isPlayerOnJobBlackList(client, jobId) {
|
||||
// ===========================================================================
|
||||
|
||||
function playerArrivedAtJobRouteLocation(client) {
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobId = getPlayerJob(client);
|
||||
|
||||
if(!isPlayerOnJobRoute(client)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isLastLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client))) {
|
||||
finishSuccessfulJobRoute(client);
|
||||
return false;
|
||||
}
|
||||
if(isLastLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client))) {
|
||||
finishSuccessfulJobRoute(client);
|
||||
return false;
|
||||
}
|
||||
|
||||
showGameMessage(client, replaceJobRouteStringsInMessage(removeColoursInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).locationArriveMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
||||
if(getJobRouteLocationData(jobId, getPlayerJobRoute(client),getPlayerJobRouteLocation(client)).stopDelay > 0) {
|
||||
freezePlayerJobVehicleForRouteLocation(client);
|
||||
getPlayerData(client).jobRouteLocation = getNextLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client));
|
||||
setTimeout(function() {
|
||||
showCurrentJobLocation(client);
|
||||
showGameMessage(client, replaceJobRouteStringsInMessage(removeColoursInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).locationNextMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
||||
unFreezePlayerJobVehicleForRouteLocation(client);
|
||||
}, getJobRouteLocationData(jobId, getPlayerJobRoute(client),getPlayerJobRouteLocation(client)).stopDelay);
|
||||
} else {
|
||||
getPlayerData(client).jobRouteLocation = getNextLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client));
|
||||
showCurrentJobLocation(client);
|
||||
showGameMessage(client, replaceJobRouteStringsInMessage(removeColoursInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).locationNextMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
||||
}
|
||||
showGameMessage(client, replaceJobRouteStringsInMessage(removeColoursInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).locationArriveMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
||||
if(getJobRouteLocationData(jobId, getPlayerJobRoute(client),getPlayerJobRouteLocation(client)).stopDelay > 0) {
|
||||
freezePlayerJobVehicleForRouteLocation(client);
|
||||
getPlayerData(client).jobRouteLocation = getNextLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client));
|
||||
setTimeout(function() {
|
||||
showCurrentJobLocation(client);
|
||||
showGameMessage(client, replaceJobRouteStringsInMessage(removeColoursInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).locationNextMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
||||
unFreezePlayerJobVehicleForRouteLocation(client);
|
||||
}, getJobRouteLocationData(jobId, getPlayerJobRoute(client),getPlayerJobRouteLocation(client)).stopDelay);
|
||||
} else {
|
||||
getPlayerData(client).jobRouteLocation = getNextLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client));
|
||||
showCurrentJobLocation(client);
|
||||
showGameMessage(client, replaceJobRouteStringsInMessage(removeColoursInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).locationNextMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2529,7 +2538,7 @@ function createJobRouteCommand(command, params, client) {
|
||||
}
|
||||
|
||||
createJobRoute(params, closestJobLocation);
|
||||
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} created route {ALTCOLOUR}${params}{MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} created route {ALTCOLOUR}${params}{MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2563,7 +2572,7 @@ function createJobRouteLocationCommand(command, params, client) {
|
||||
let routeLocationName = params;
|
||||
|
||||
createJobRouteLocation(routeLocationName, getPlayerPosition(client), jobRouteData);
|
||||
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} created location {ALTCOLOUR}${routeLocationName}{MAINCOLOUR} for route {ALTCOLOUR}${jobRouteData.name}{MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} created location {ALTCOLOUR}${routeLocationName}{MAINCOLOUR} for route {ALTCOLOUR}${jobRouteData.name}{MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2579,14 +2588,14 @@ function createJobRoute(routeName, closestJobLocation) {
|
||||
tempJobRouteData.vehicleColour1 = 1;
|
||||
tempJobRouteData.vehicleColour2 = 1;
|
||||
tempJobRouteData.pay = 500;
|
||||
tempJobRouteData.jobIndex = closestJobLocation.jobIndex;
|
||||
tempJobRouteData.jobIndex = closestJobLocation.jobIndex;
|
||||
tempJobRouteData.startMessage = `You are now on route {ALTCOLOUR}{JOBROUTENAME}{MAINCOLOUR} for the {jobYellow}{JOBNAME}{MAINCOLOUR} job!`;
|
||||
tempJobRouteData.finishMessage = `You have finished the {ALTCOLOUR}{JOBROUTENAME}{MAINCOLOUR} route and {ALTCOLOUR}{JOBROUTEPAY}{MAINCOLOUR} has been added to your next paycheck!`;
|
||||
tempJobRouteData.locationArriveMessage = `You arrived at a stop.`;
|
||||
tempJobRouteData.locationNextMessage = `Drive to the next stop.`;
|
||||
|
||||
getJobData(closestJobLocation.jobIndex).routes.push(tempJobRouteData);
|
||||
saveJobRouteToDatabase(tempJobRouteData);
|
||||
saveJobRouteToDatabase(tempJobRouteData);
|
||||
setAllJobDataIndexes();
|
||||
}
|
||||
|
||||
@@ -2599,10 +2608,10 @@ function createJobRouteLocation(routeLocationName, position, jobRouteData) {
|
||||
tempJobRouteLocationData.enabled = true;
|
||||
tempJobRouteLocationData.needsSaved = true;
|
||||
tempJobRouteLocationData.position = position;
|
||||
tempJobRouteLocationData.routeIndex = jobRouteData.index;
|
||||
tempJobRouteLocationData.routeIndex = jobRouteData.index;
|
||||
|
||||
getJobData(jobRouteData.jobIndex).routes[jobRouteData.index].locations.push(tempJobRouteLocationData);
|
||||
saveJobRouteLocationToDatabase(tempJobRouteLocationData);
|
||||
saveJobRouteLocationToDatabase(tempJobRouteLocationData);
|
||||
setAllJobDataIndexes();
|
||||
}
|
||||
|
||||
@@ -2611,7 +2620,7 @@ function createJobRouteLocation(routeLocationName, position, jobRouteData) {
|
||||
function deleteJobRouteLocationCommand(command, params, client) {
|
||||
let closestJobRouteLocation = getClosestJobRouteLocation(getPlayerPosition(client));
|
||||
|
||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR} deleted route location {ALTCOLOUR}${closestJobRouteLocation.index} (DB ID ${closestJobRouteLocation.databaseId}){MAINCOLOUR} for the {ALTCOLOUR}${closestJobRouteLocation.name}{jobYellow} route of the {jobYellow}${getJobData(closestJobLocation.jobIndex).name}{MAINCOLOUR} job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} deleted route location {ALTCOLOUR}${closestJobRouteLocation.index} (DB ID ${closestJobRouteLocation.databaseId}){MAINCOLOUR} for the {ALTCOLOUR}${closestJobRouteLocation.name}{jobYellow} route of the {jobYellow}${getJobData(closestJobLocation.jobIndex).name}{MAINCOLOUR} job`);
|
||||
|
||||
if(closestJobRouteLocation.databaseId > 0) {
|
||||
quickDatabaseQuery(`DELETE FROM job_route_loc WHERE job_route_loc_id = ${closestJobRouteLocation.databaseId}`);
|
||||
@@ -2622,7 +2631,7 @@ function deleteJobRouteLocationCommand(command, params, client) {
|
||||
|
||||
getJobData(getJobIdFromDatabaseId(tempJob)).routes[tempJobRoute].locations.splice(tempIndex, 1);
|
||||
setAllJobDataIndexes();
|
||||
collectAllGarbage();
|
||||
collectAllGarbage();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2631,9 +2640,9 @@ function deleteJobRouteCommand(command, params, client) {
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobRoute = getPlayerData(client).jobRoute;
|
||||
|
||||
if(!areParamsEmpty(client)) {
|
||||
jobRoute = getJobRouteFromParams(params, jobId);
|
||||
}
|
||||
if(!areParamsEmpty(client)) {
|
||||
jobRoute = getJobRouteFromParams(params, jobId);
|
||||
}
|
||||
|
||||
let jobRouteData = getServerData().jobs[jobId].routes[jobRoute];
|
||||
|
||||
@@ -2649,12 +2658,12 @@ function deleteJobRouteCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR} deleted route {ALTCOLOUR}${jobRouteData.name} (DB ID ${jobRouteData.databaseId}) {MAINCOLOUR}for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} deleted route {ALTCOLOUR}${jobRouteData.name} (DB ID ${jobRouteData.databaseId}){MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||
|
||||
if(jobRouteData.databaseId > 0) {
|
||||
quickDatabaseQuery(`DELETE FROM job_route WHERE job_route_id = ${jobRouteData.databaseId}`);
|
||||
quickDatabaseQuery(`DELETE FROM job_route_loc WHERE job_route_loc_route = ${jobRouteData.databaseId}`);
|
||||
}
|
||||
if(jobRouteData.databaseId > 0) {
|
||||
quickDatabaseQuery(`DELETE FROM job_route WHERE job_route_id = ${jobRouteData.databaseId}`);
|
||||
quickDatabaseQuery(`DELETE FROM job_route_loc WHERE job_route_loc_route = ${jobRouteData.databaseId}`);
|
||||
}
|
||||
|
||||
clearArray(getServerData().jobs[jobId].routes[jobRoute].locations);
|
||||
getServerData().jobs[jobId].routes.splice(jobRoute, 1);
|
||||
@@ -2728,7 +2737,7 @@ function getJobPointsInRange(position, distance) {
|
||||
// ===========================================================================
|
||||
|
||||
function respawnJobVehicle(client) {
|
||||
respawnVehicle(getPlayerJobVehicle(client));
|
||||
respawnVehicle(getPlayerJobVehicle(client));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2740,12 +2749,12 @@ function getPlayerJobVehicle(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function getRandomJobRouteForLocation(closestJobLocation) {
|
||||
if(closestJobLocation.routeCache.length > 0) {
|
||||
let randomRoute = getRandom(0, closestJobLocation.routeCache.length-1);
|
||||
let routeId = closestJobLocation.routeCache[randomRoute];
|
||||
return getJobRouteData(closestJobLocation.jobIndex, routeId).index;
|
||||
}
|
||||
return -1;
|
||||
if(closestJobLocation.routeCache.length > 0) {
|
||||
let randomRoute = getRandom(0, closestJobLocation.routeCache.length-1);
|
||||
let routeId = closestJobLocation.routeCache[randomRoute];
|
||||
return getJobRouteData(closestJobLocation.jobIndex, routeId).index;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2785,58 +2794,58 @@ function getClosestJobLocationForJob(position, jobId) {
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerJobRoute(client) {
|
||||
return getPlayerData(client).jobRoute;
|
||||
return getPlayerData(client).jobRoute;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerJobRouteLocation(client) {
|
||||
return getPlayerData(client).jobRouteLocation;
|
||||
return getPlayerData(client).jobRouteLocation;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showCurrentJobLocation(client) {
|
||||
let jobId = getPlayerJob(client);
|
||||
sendJobRouteLocationToPlayer(client, getJobRouteLocationData(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client)).position, getJobData(jobId).colour);
|
||||
let jobId = getPlayerJob(client);
|
||||
sendJobRouteLocationToPlayer(client, getJobRouteLocationData(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client)).position, getJobData(jobId).colour);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function finishSuccessfulJobRoute(client) {
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobRouteData = getJobRouteData(jobId, getPlayerJobRoute(client));
|
||||
let payout = toInteger(applyServerInflationMultiplier(jobRouteData.pay));
|
||||
getPlayerData(client).payDayAmount = getPlayerData(client).payDayAmount + payout;
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobRouteData = getJobRouteData(jobId, getPlayerJobRoute(client));
|
||||
let payout = toInteger(applyServerInflationMultiplier(jobRouteData.pay));
|
||||
getPlayerData(client).payDayAmount = getPlayerData(client).payDayAmount + payout;
|
||||
|
||||
messagePlayerSuccess(client, replaceJobRouteStringsInMessage(jobRouteData.finishMessage, jobId, jobRouteData.index));
|
||||
messagePlayerSuccess(client, replaceJobRouteStringsInMessage(jobRouteData.finishMessage, jobId, jobRouteData.index));
|
||||
|
||||
stopReturnToJobVehicleCountdown(client);
|
||||
sendPlayerStopJobRoute(client);
|
||||
respawnVehicle(getPlayerData(client).jobRouteVehicle);
|
||||
stopReturnToJobVehicleCountdown(client);
|
||||
sendPlayerStopJobRoute(client);
|
||||
respawnVehicle(getPlayerData(client).jobRouteVehicle);
|
||||
|
||||
getPlayerData(client).jobRouteVehicle = false;
|
||||
getPlayerData(client).jobRoute = -1;
|
||||
getPlayerData(client).jobRouteLocation = -1;
|
||||
getPlayerData(client).jobRouteVehicle = false;
|
||||
getPlayerData(client).jobRoute = -1;
|
||||
getPlayerData(client).jobRouteLocation = -1;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getNextLocationOnJobRoute(jobId, routeId, currentLocationId) {
|
||||
if(!isLastLocationOnJobRoute(jobId, routeId, currentLocationId)) {
|
||||
return currentLocationId+1;
|
||||
} else {
|
||||
return getJobRouteData(jobId, routeId).locations.length-1;
|
||||
}
|
||||
if(!isLastLocationOnJobRoute(jobId, routeId, currentLocationId)) {
|
||||
return currentLocationId+1;
|
||||
} else {
|
||||
return getJobRouteData(jobId, routeId).locations.length-1;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isLastLocationOnJobRoute(jobId, routeId, currentLocationId) {
|
||||
if(currentLocationId == getJobRouteData(jobId, routeId).locations.length-1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if(currentLocationId == getJobRouteData(jobId, routeId).locations.length-1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2860,21 +2869,21 @@ function getJobRouteFromParams(params, jobId) {
|
||||
// ===========================================================================
|
||||
|
||||
function replaceJobRouteStringsInMessage(messageText, jobId, jobRouteId) {
|
||||
let tempJobRouteData = getJobRouteData(jobId, jobRouteId);
|
||||
let tempJobRouteData = getJobRouteData(jobId, jobRouteId);
|
||||
|
||||
let tempFind = `{JOBROUTENAME}`;
|
||||
let tempRegex = new RegExp(tempFind, 'g');
|
||||
messageText = messageText.replace(tempRegex, tempJobRouteData.name);
|
||||
|
||||
tempFind = `{JOBROUTEPAY}`;
|
||||
tempFind = `{JOBROUTEPAY}`;
|
||||
tempRegex = new RegExp(tempFind, 'g');
|
||||
messageText = messageText.replace(tempRegex, `$${tempJobRouteData.pay}`);
|
||||
|
||||
tempFind = `{JOBNAME}`;
|
||||
tempFind = `{JOBNAME}`;
|
||||
tempRegex = new RegExp(tempFind, 'g');
|
||||
messageText = messageText.replace(tempRegex, getJobData(tempJobRouteData.jobIndex).name);
|
||||
|
||||
return messageText;
|
||||
return messageText;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"moduleResolution": "classic"
|
||||
},
|
||||
"include": [
|
||||
"*.js",
|
||||
"job/*.js",
|
||||
"business/*.js",
|
||||
"item/*.js",
|
||||
"npc/*.js",
|
||||
"native/*.js",
|
||||
"../shared/*.js"
|
||||
]
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"moduleResolution": "classic"
|
||||
},
|
||||
"include": [
|
||||
"*.js",
|
||||
"job/*.js",
|
||||
"business/*.js",
|
||||
"item/*.js",
|
||||
"npc/*.js",
|
||||
"native/*.js",
|
||||
"../shared/*.js"
|
||||
]
|
||||
}
|
||||
@@ -10,190 +10,190 @@
|
||||
|
||||
function initKeyBindScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.KeyBind]: Initializing key bind script ...");
|
||||
getGlobalConfig().keyBind = loadKeyBindConfiguration();
|
||||
getGlobalConfig().keyBind = loadKeyBindConfiguration();
|
||||
logToConsole(LOG_INFO, "[VRR.KeyBind]: Key bind script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addKeyBindCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
||||
let tempCommand = getParam(params, " ", 2);
|
||||
let tempParams = (splitParams.length > 2) ? splitParams.slice(2).join(" ") : "";
|
||||
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
||||
let tempCommand = getParam(params, " ", 2);
|
||||
let tempParams = (splitParams.length > 2) ? splitParams.slice(2).join(" ") : "";
|
||||
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "The key ID or name you input is invalid!");
|
||||
messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces.");
|
||||
messagePlayerInfo(client, `Examples: {ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`);
|
||||
return false;
|
||||
}
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "The key ID or name you input is invalid!");
|
||||
messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces.");
|
||||
messagePlayerInfo(client, `Examples: {ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "That key name/id is invalid!");
|
||||
return false;
|
||||
}
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "That key name/id is invalid!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(tempCommand)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
if(areParamsEmpty(tempCommand)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
addPlayerKeyBind(client, keyId, tempCommand, tempParams);
|
||||
messagePlayerSuccess(client, `You binded the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key to command: {ALTCOLOUR}/${tempCommand} ${tempParams}`);
|
||||
addPlayerKeyBind(client, keyId, tempCommand, tempParams);
|
||||
messagePlayerSuccess(client, `You binded the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key to command: {ALTCOLOUR}/${tempCommand} ${tempParams}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function removeKeyBindCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
||||
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
||||
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "The key ID or name you input is invalid!");
|
||||
messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces.");
|
||||
messagePlayerInfo(client, `Examples: {ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`);
|
||||
return false;
|
||||
}
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "The key ID or name you input is invalid!");
|
||||
messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces.");
|
||||
messagePlayerInfo(client, `Examples: {ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "That key name/id is invalid!");
|
||||
return false;
|
||||
}
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "That key name/id is invalid!");
|
||||
return false;
|
||||
}
|
||||
|
||||
removePlayerKeyBind(client, keyId);
|
||||
messagePlayerSuccess(client, `You removed the keybind for the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key`);
|
||||
removePlayerKeyBind(client, keyId);
|
||||
messagePlayerSuccess(client, `You removed the keybind for the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addPlayerKeyBind(client, keys, command, params, tempKey = false) {
|
||||
let keyBindData = new KeyBindData(false, keys, `${command} ${params}`);
|
||||
if(tempKey == true) {
|
||||
keyBindData.databaseId = -1;
|
||||
}
|
||||
let keyBindData = new KeyBindData(false, keys, `${command} ${params}`);
|
||||
if(tempKey == true) {
|
||||
keyBindData.databaseId = -1;
|
||||
}
|
||||
|
||||
getPlayerData(client).keyBinds.push(keyBindData);
|
||||
sendAddAccountKeyBindToClient(client, keys, (keys.length > 1) ? VRR_KEYSTATE_COMBO : VRR_KEYSTATE_UP);
|
||||
getPlayerData(client).keyBinds.push(keyBindData);
|
||||
sendAddAccountKeyBindToClient(client, keys, (keys.length > 1) ? VRR_KEYSTATE_COMBO : VRR_KEYSTATE_UP);
|
||||
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
} else {
|
||||
sendPlayerEnterPropertyKey(client, false);
|
||||
}
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
} else {
|
||||
sendPlayerEnterPropertyKey(client, false);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function removePlayerKeyBind(client, keyId) {
|
||||
if(isPlayerLoggedIn(client)) {
|
||||
quickDatabaseQuery(`DELETE FROM acct_hotkey WHERE acct_hotkey_acct = ${getPlayerData(client).accountData.databaseId} AND acct_hotkey_key = ${keyId}`);
|
||||
}
|
||||
if(isPlayerLoggedIn(client)) {
|
||||
quickDatabaseQuery(`DELETE FROM acct_hotkey WHERE acct_hotkey_acct = ${getPlayerData(client).accountData.databaseId} AND acct_hotkey_key = ${keyId}`);
|
||||
}
|
||||
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(getPlayerData(client).keyBinds[i].key == keyId) {
|
||||
getPlayerData(client).keyBinds.splice(i, 1);
|
||||
}
|
||||
}
|
||||
sendRemoveAccountKeyBindToClient(client, keyId);
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(getPlayerData(client).keyBinds[i].key == keyId) {
|
||||
getPlayerData(client).keyBinds.splice(i, 1);
|
||||
}
|
||||
}
|
||||
sendRemoveAccountKeyBindToClient(client, keyId);
|
||||
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
} else {
|
||||
sendPlayerEnterPropertyKey(client, false);
|
||||
}
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
} else {
|
||||
sendPlayerEnterPropertyKey(client, false);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveKeyBindForCommand(client, command) {
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(toLowerCase(getPlayerData(client).keyBinds[i].commandString.split(" ")[0]) == toLowerCase(command)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(toLowerCase(getPlayerData(client).keyBinds[i].commandString.split(" ")[0]) == toLowerCase(command)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerKeyBindForCommand(client, command) {
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(toLowerCase(getPlayerData(client).keyBinds[i].commandString.split(" ")[0]) == toLowerCase(command)) {
|
||||
return getPlayerData(client).keyBinds[i];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(toLowerCase(getPlayerData(client).keyBinds[i].commandString.split(" ")[0]) == toLowerCase(command)) {
|
||||
return getPlayerData(client).keyBinds[i];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveKeyBindForKey(client, key) {
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(getPlayerData(client).keyBinds[i].key == key) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(getPlayerData(client).keyBinds[i].key == key) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveKeyBindsDisabled(client) {
|
||||
return hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoKeyBinds"));
|
||||
return hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoKeyBinds"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerKeyBindForKey(client, key) {
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(getPlayerData(client).keyBinds[i].key == key) {
|
||||
return getPlayerData(client).keyBinds[i];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(getPlayerData(client).keyBinds[i].key == key) {
|
||||
return getPlayerData(client).keyBinds[i];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playerUsedKeyBind(client, key) {
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
return false;
|
||||
}
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerSpawned(client)) {
|
||||
return false;
|
||||
}
|
||||
if(!isPlayerSpawned(client)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind] ${getPlayerDisplayForConsole(client)} used keybind ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForKey(client, key)) {
|
||||
let keyBindData = getPlayerKeyBindForKey(client, key);
|
||||
if(keyBindData.enabled) {
|
||||
let splitCommandString = keyBindData.commandString.split(" ");
|
||||
let tempCommand = splitCommandString[0];
|
||||
let tempParams = "";
|
||||
if(splitCommandString.length > 1) {
|
||||
tempParams = splitCommandString.slice(1).join(" ");
|
||||
}
|
||||
getCommand(toLowerCase(tempCommand)).handlerFunction(tempCommand, tempParams, client);
|
||||
//triggerEvent("OnPlayerCommand", null, tempCommand, tempParams, client);
|
||||
}
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind] ${getPlayerDisplayForConsole(client)} used keybind ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForKey(client, key)) {
|
||||
let keyBindData = getPlayerKeyBindForKey(client, key);
|
||||
if(keyBindData.enabled) {
|
||||
let splitCommandString = keyBindData.commandString.split(" ");
|
||||
let tempCommand = splitCommandString[0];
|
||||
let tempParams = "";
|
||||
if(splitCommandString.length > 1) {
|
||||
tempParams = splitCommandString.slice(1).join(" ");
|
||||
}
|
||||
getCommand(toLowerCase(tempCommand)).handlerFunction(tempCommand, tempParams, client);
|
||||
//triggerEvent("OnPlayerCommand", null, tempCommand, tempParams, client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendAccountKeyBindsToClient(client) {
|
||||
sendClearKeyBindsToClient(client);
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
sendAddAccountKeyBindToClient(client, getPlayerData(client).keyBinds[i].key, getPlayerData(client).keyBinds[i].keyState);
|
||||
}
|
||||
sendClearKeyBindsToClient(client);
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
sendAddAccountKeyBindToClient(client, getPlayerData(client).keyBinds[i].key, getPlayerData(client).keyBinds[i].keyState);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -12,16 +12,16 @@ let translateURL = "http://api.mymemory.translated.net/get?de={3}&q={0}&langpair
|
||||
// ===========================================================================
|
||||
|
||||
function initLocaleScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Locale]: Initializing locale script ...");
|
||||
getServerData().localeStrings = loadAllLocaleStrings();
|
||||
logToConsole(LOG_INFO, "[VRR.Locale]: Initializing locale script ...");
|
||||
getServerData().localeStrings = loadAllLocaleStrings();
|
||||
|
||||
// Translation Cache
|
||||
getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom.fill([]);
|
||||
getServerData().cachedTranslations.fill(getServerData().cachedTranslationFrom);
|
||||
// Translation Cache
|
||||
getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom.fill([]);
|
||||
getServerData().cachedTranslations.fill(getServerData().cachedTranslationFrom);
|
||||
|
||||
getGlobalConfig().locale.defaultLanguageId = getLocaleFromParams(getGlobalConfig().locale.defaultLanguageId);
|
||||
getGlobalConfig().locale.defaultLanguageId = getLocaleFromParams(getGlobalConfig().locale.defaultLanguageId);
|
||||
|
||||
logToConsole(LOG_INFO, "[VRR.Locale]: Locale script initialized!");
|
||||
}
|
||||
@@ -29,68 +29,68 @@ function initLocaleScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function getLocaleString(client, stringName, ...args) {
|
||||
let tempString = getRawLocaleString(stringName, getPlayerData(client).locale);
|
||||
if(tempString == "") {
|
||||
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
||||
}
|
||||
let tempString = getRawLocaleString(stringName, getPlayerData(client).locale);
|
||||
if(tempString == "") {
|
||||
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
||||
}
|
||||
|
||||
for(let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||
}
|
||||
for(let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||
}
|
||||
|
||||
return tempString;
|
||||
return tempString;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getGroupedLocaleString(client, stringName, index, ...args) {
|
||||
let tempString = getRawGroupedLocaleString(stringName, getPlayerData(client).locale, index);
|
||||
let tempString = getRawGroupedLocaleString(stringName, getPlayerData(client).locale, index);
|
||||
|
||||
for(let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||
}
|
||||
for(let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||
}
|
||||
|
||||
return tempString;
|
||||
return tempString;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getRawLocaleString(stringName, localeName) {
|
||||
return getLocaleStrings()[localeName][stringName];
|
||||
return getLocaleStrings()[localeName][stringName];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getRawGroupedLocaleString(stringName, localeName, index) {
|
||||
return getLocaleStrings()[localeName][stringName][index];
|
||||
return getLocaleStrings()[localeName][stringName][index];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerLocaleName(client) {
|
||||
let localeId = getPlayerData(client).locale;
|
||||
return getLocales()[localeId][0];
|
||||
let localeId = getPlayerData(client).locale;
|
||||
return getLocales()[localeId][0];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadAllLocaleStrings() {
|
||||
let tempLocaleStrings = {};
|
||||
let tempLocaleStrings = {};
|
||||
|
||||
let locales = getGlobalConfig().locale.locales;
|
||||
for(let i in locales) {
|
||||
let localeData = locales[i];
|
||||
let localeFile = JSON.parse(loadTextFile(`locale/${localeData[1]}.json`));
|
||||
tempLocaleStrings[i] = localeFile;
|
||||
}
|
||||
let locales = getGlobalConfig().locale.locales;
|
||||
for(let i in locales) {
|
||||
let localeData = locales[i];
|
||||
let localeFile = JSON.parse(loadTextFile(`locale/${localeData[1]}.json`));
|
||||
tempLocaleStrings[i] = localeFile;
|
||||
}
|
||||
|
||||
return tempLocaleStrings;
|
||||
return tempLocaleStrings;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getLocaleStrings() {
|
||||
return getServerData().localeStrings;
|
||||
return getServerData().localeStrings;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -99,7 +99,7 @@ function getLocaleFromParams(params) {
|
||||
let locales = getLocales();
|
||||
if(isNaN(params)) {
|
||||
for(let i in locales) {
|
||||
if(toLowerCase(locales[i][2]).indexOf(toLowerCase(params)) != -1) {
|
||||
if(toLowerCase(locales[i][2]).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ function getLocaleFromParams(params) {
|
||||
// ===========================================================================
|
||||
|
||||
function getLocales() {
|
||||
return getGlobalConfig().locale.locales;
|
||||
return getGlobalConfig().locale.locales;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -138,41 +138,41 @@ function setLocaleCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let localeId = getLocaleFromParams(params);
|
||||
let localeId = getLocaleFromParams(params);
|
||||
|
||||
if(!getLocaleData(localeId)) {
|
||||
messagePlayerInfo(client, getLocaleString(client, "InvalidLocale"));
|
||||
return false;
|
||||
}
|
||||
if(!getLocaleData(localeId)) {
|
||||
messagePlayerInfo(client, getLocaleString(client, "InvalidLocale"));
|
||||
return false;
|
||||
}
|
||||
|
||||
getPlayerData(client).accountData.locale = localeId;
|
||||
getPlayerData(client).locale = localeId;
|
||||
messagePlayerSuccess(client, getLocaleString(client, "LocaleChanged1"), getLocaleString(client, "LocaleNativeName"));
|
||||
getPlayerData(client).accountData.locale = localeId;
|
||||
getPlayerData(client).locale = localeId;
|
||||
messagePlayerSuccess(client, getLocaleString(client, "LocaleChanged1"), getLocaleString(client, "LocaleNativeName"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getLocaleData(localeId) {
|
||||
if(typeof getLocales()[localeId] != "undefined") {
|
||||
return getLocales()[localeId];
|
||||
}
|
||||
if(typeof getLocales()[localeId] != "undefined") {
|
||||
return getLocales()[localeId];
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function reloadLocaleConfigurationCommand(command, params, client) {
|
||||
getGlobalConfig().locale = loadLocaleConfig();
|
||||
getServerData().localeStrings = loadAllLocaleStrings();
|
||||
getServerData().localeStrings = loadAllLocaleStrings();
|
||||
|
||||
// Translation Cache
|
||||
getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom.fill([]);
|
||||
getServerData().cachedTranslations.fill(getServerData().cachedTranslationFrom);
|
||||
// Translation Cache
|
||||
getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom.fill([]);
|
||||
getServerData().cachedTranslations.fill(getServerData().cachedTranslationFrom);
|
||||
|
||||
getGlobalConfig().locale.defaultLanguageId = getLocaleFromParams(getGlobalConfig().locale.defaultLanguage);
|
||||
getGlobalConfig().locale.defaultLanguageId = getLocaleFromParams(getGlobalConfig().locale.defaultLanguage);
|
||||
|
||||
messageAdmins(`${client.name}{MAINCOLOUR} has reloaded the locale settings and texts`);
|
||||
}
|
||||
@@ -181,9 +181,9 @@ function reloadLocaleConfigurationCommand(command, params, client) {
|
||||
|
||||
async function translateMessage(messageText, translateFrom = getGlobalConfig().locale.defaultLanguageId, translateTo = getGlobalConfig().locale.defaultLanguageId) {
|
||||
return new Promise(resolve => {
|
||||
if(translateFrom == translateTo) {
|
||||
resolve(messageText);
|
||||
}
|
||||
if(translateFrom == translateTo) {
|
||||
resolve(messageText);
|
||||
}
|
||||
|
||||
for(let i in cachedTranslations[translateFrom][translateTo]) {
|
||||
if(cachedTranslations[translateFrom][translateTo][i][0] == messageText) {
|
||||
|
||||
@@ -15,10 +15,10 @@ function initMessagingScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function messageAdminAction(messageText) {
|
||||
messagePlayerNormal(null, `⚠️ ${messageText}`, getColourByName("orange"));
|
||||
if(getServerConfig().discordEnabled) {
|
||||
messageDiscord(`:warning: ${messageText}`);
|
||||
}
|
||||
messagePlayerNormal(null, `⚠️ ${messageText}`, getColourByName("orange"));
|
||||
if(getServerConfig().discordEnabled) {
|
||||
messageDiscord(`:warning: ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -33,188 +33,188 @@ function messageAdminAction(messageText) {
|
||||
*
|
||||
*/
|
||||
function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) {
|
||||
//if(isConsole(client) || client == null) {
|
||||
// logToConsole(LOG_INFO, `${removeColoursInMessage(messageText)}`);
|
||||
//}
|
||||
//if(isConsole(client) || client == null) {
|
||||
// logToConsole(LOG_INFO, `${removeColoursInMessage(messageText)}`);
|
||||
//}
|
||||
|
||||
sendChatBoxMessageToPlayer(client, messageText, colour);
|
||||
return true;
|
||||
sendChatBoxMessageToPlayer(client, messageText, colour);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messageAdmins(messageText, colour = getColourByName("softRed")) {
|
||||
//let plainMessage = removeColoursInMessage(messageText);
|
||||
//console.warn(`🛡️ ${plainMessage}`);
|
||||
//let plainMessage = removeColoursInMessage(messageText);
|
||||
//console.warn(`🛡️ ${plainMessage}`);
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("BasicModeration"))) {
|
||||
messagePlayerNormal(clients[i], `🛡️ ${messageText}`, colour);
|
||||
}
|
||||
}
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("BasicModeration"))) {
|
||||
messagePlayerNormal(clients[i], `🛡️ ${messageText}`, colour);
|
||||
}
|
||||
}
|
||||
|
||||
//if(getServerConfig().discordConfig.sendAdminEvents) {
|
||||
// messageDiscordAdminChannel(plainMessage);
|
||||
//}
|
||||
//if(getServerConfig().discordConfig.sendAdminEvents) {
|
||||
// messageDiscordAdminChannel(plainMessage);
|
||||
//}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerError(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `❌ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `❌ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `❌ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `❌ ${messageText}`);
|
||||
}
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `❌ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `❌ ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerSyntax(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `⌨️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `⌨️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `⌨️ USAGE: {MAINCOLOUR} ${messageText}`, getColourByType("syntaxMessage"));
|
||||
} else {
|
||||
messageDiscordUser(client, `⌨️ ${messageText}`);
|
||||
}
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `⌨️ USAGE: {MAINCOLOUR} ${messageText}`, getColourByType("syntaxMessage"));
|
||||
} else {
|
||||
messageDiscordUser(client, `⌨️ ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerAlert(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `⚠️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `⚠️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `⚠️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `⚠️ ${messageText}`);
|
||||
}
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `⚠️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `⚠️ ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerSuccess(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `✔️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `✔️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `✔️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `✔️ ${messageText}`);
|
||||
}
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `✔️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `✔️ ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerInfo(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `:information_source: ${messageText}`);
|
||||
}
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `:information_source: ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerTip(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `:information_source: ${messageText}`);
|
||||
}
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `:information_source: ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerTalk(client, talkingClient, messageText) {
|
||||
messagePlayerNormal(client, `🗣️ ${getPlayerAccentInlineOutput(talkingClient)}${getClientSubAccountName(talkingClient)} says: ${messageText}`, getColourByType("talkMessage"));
|
||||
messagePlayerNormal(client, `🗣️ ${getPlayerAccentInlineOutput(talkingClient)}${getClientSubAccountName(talkingClient)} says: ${messageText}`, getColourByType("talkMessage"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerWhisper(client, whisperingClient, messageText) {
|
||||
messagePlayerNormal(client, `🤫 ${getPlayerAccentInlineOutput(whisperingClient)}${getClientSubAccountName(whisperingClient)} whispers: ${messageText}`, getColourByType("whisperMessage"));
|
||||
messagePlayerNormal(client, `🤫 ${getPlayerAccentInlineOutput(whisperingClient)}${getClientSubAccountName(whisperingClient)} whispers: ${messageText}`, getColourByType("whisperMessage"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerMegaPhone(client, shoutingClient, messageText) {
|
||||
messagePlayerNormal(client, `📢 ${getPlayerAccentInlineOutput(shoutingClient)}${getClientSubAccountName(shoutingClient)} (megaphone): ${messageText}!`, getColourByType("yellow"));
|
||||
messagePlayerNormal(client, `📢 ${getPlayerAccentInlineOutput(shoutingClient)}${getClientSubAccountName(shoutingClient)} (megaphone): ${messageText}!`, getColourByType("yellow"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerShout(client, shoutingClient, messageText) {
|
||||
messagePlayerNormal(client, `🗣️ ${getPlayerAccentInlineOutput(shoutingClient)}${getClientSubAccountName(shoutingClient)} shouts: ${messageText}!`, getColourByType("shoutMessage"));
|
||||
messagePlayerNormal(client, `🗣️ ${getPlayerAccentInlineOutput(shoutingClient)}${getClientSubAccountName(shoutingClient)} shouts: ${messageText}!`, getColourByType("shoutMessage"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerDoAction(client, doingActionClient, messageText) {
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `${messageText} * (${getClientSubAccountName(doingActionClient)})`, getColourByType("doActionMessage"));
|
||||
}
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `${messageText} * (${getClientSubAccountName(doingActionClient)})`, getColourByType("doActionMessage"));
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerMeAction(client, doingActionClient, messageText) {
|
||||
messagePlayerNormal(client, `${getClientSubAccountName(doingActionClient)} ${messageText}`, getColourByType("meActionMessage"));
|
||||
messagePlayerNormal(client, `${getClientSubAccountName(doingActionClient)} ${messageText}`, getColourByType("meActionMessage"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerClanChat(client, clanChattingClient, messageText) {
|
||||
messagePlayerNormal(client, `👥 ${getInlineChatColourByName("clanOrange")}${(getPlayerClanRankName(clanChattingClient) != false) ? getPlayerClanRankName(clanChattingClient) : "No Rank"} ${getCharacterFullName(clanChattingClient)} {MAINCOLOUR}says (clan): {ALTCOLOUR}${messageText}`, getColourByType("clanChatMessage"));
|
||||
messagePlayerNormal(client, `👥 ${getInlineChatColourByName("clanOrange")}${(getPlayerClanRankName(clanChattingClient) != false) ? getPlayerClanRankName(clanChattingClient) : "No Rank"} ${getCharacterFullName(clanChattingClient)} {MAINCOLOUR}says (clan): {ALTCOLOUR}${messageText}`, getColourByType("clanChatMessage"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerAdminChat(client, adminChattingClient, messageText) {
|
||||
messagePlayerNormal(client, `🛡️ [ADMIN CHAT] {ALTCOLOUR}${getPlayerData(adminChattingClient).accountData.staffTitle} [#CCCCCC]${getPlayerData(adminChattingClient).accountData.name}: {MAINCOLOUR}${messageText}`, getColourByType("orange"));
|
||||
messagePlayerNormal(client, `🛡️ [ADMIN CHAT] {ALTCOLOUR}${getPlayerData(adminChattingClient).accountData.staffTitle} [#CCCCCC]${getPlayerData(adminChattingClient).accountData.name}: {MAINCOLOUR}${messageText}`, getColourByType("orange"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerNewbieTip(client, message) {
|
||||
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoActionTips"))) {
|
||||
messagePlayerNormal(client, `💡 ${message}`);
|
||||
}
|
||||
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoActionTips"))) {
|
||||
messagePlayerNormal(client, `💡 ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerTimedRandomTip(client, message) {
|
||||
if(isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
|
||||
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoRandomTips"))) {
|
||||
messagePlayerNormal(client, `💡 ${message}`);
|
||||
}
|
||||
}
|
||||
if(isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
|
||||
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoRandomTips"))) {
|
||||
messagePlayerNormal(client, `💡 ${message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -237,7 +237,7 @@ function clearChatBox(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerHelpContent(client, messageString) {
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${messageString}`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${messageString}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
// ===========================================================================
|
||||
|
||||
function startTutorial(client) {
|
||||
getPlayerData(client).tutorialItem = createGroundItem(tutorialItem[0], tutorialItem[1], tutorialItem[3]);
|
||||
getPlayerData(client).tutorialVehicle = createGroundItem(tutorialItem[0], tutorialItem[1], tutorialItem[3]);
|
||||
getPlayerData(client).tutorialItem = createGroundItem(tutorialItem[0], tutorialItem[1], tutorialItem[3]);
|
||||
getPlayerData(client).tutorialVehicle = createGroundItem(tutorialItem[0], tutorialItem[1], tutorialItem[3]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -170,9 +170,9 @@ function spawnAllVehicles() {
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @param {Vehicle} vehicle - The vehicle element
|
||||
* @return {VehicleData} The vehicles's data (class instance)
|
||||
*/
|
||||
* @param {Vehicle} vehicle - The vehicle element
|
||||
* @return {VehicleData} The vehicles's data (class instance)
|
||||
*/
|
||||
function getVehicleData(vehicle) {
|
||||
if(isVehicleObject(vehicle)) {
|
||||
let dataIndex = getEntityData(vehicle, "vrr.dataSlot");
|
||||
@@ -558,7 +558,7 @@ function buyVehicleCommand(command, params, client) {
|
||||
getPlayerData(client).buyingVehicle = vehicle;
|
||||
getVehicleData(vehicle).engine = true;
|
||||
vehicle.engine = true;
|
||||
setEntityData(vehicle, "vrr.engine", getVehicleData(vehicle).engine, true);
|
||||
setEntityData(vehicle, "vrr.engine", getVehicleData(vehicle).engine, true);
|
||||
|
||||
getVehicleData(vehicle).needsSaved = true;
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_TESTDRIVE, vehicle.id, getVehiclePosition(vehicle));
|
||||
@@ -1079,10 +1079,10 @@ function reloadAllVehiclesCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function respawnVehicleCommand(command, params, client) {
|
||||
if(isPlayerInAnyVehicle(client)) {
|
||||
removeAllOccupantsFromVehicle(getPlayerVehicle(client));
|
||||
respawnVehicle(getPlayerVehicle(client));
|
||||
}
|
||||
if(isPlayerInAnyVehicle(client)) {
|
||||
removeAllOccupantsFromVehicle(getPlayerVehicle(client));
|
||||
respawnVehicle(getPlayerVehicle(client));
|
||||
}
|
||||
|
||||
setAllVehicleIndexes();
|
||||
|
||||
@@ -1133,7 +1133,7 @@ function respawnJobVehiclesCommand(command, params, client) {
|
||||
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_JOB) {
|
||||
respawnVehicle(getServerData().vehicles[i].vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
messageAdminAction(`All job vehicles have been respawned by an admin!`);
|
||||
}
|
||||
@@ -1145,7 +1145,7 @@ function respawnClanVehiclesCommand(command, params, client) {
|
||||
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_CLAN) {
|
||||
respawnVehicle(getServerData().vehicles[i].vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
messageAdminAction(`All clan vehicles have been respawned by an admin!`);
|
||||
}
|
||||
@@ -1157,7 +1157,7 @@ function respawnPlayerVehiclesCommand(command, params, client) {
|
||||
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_PLAYER) {
|
||||
respawnVehicle(getServerData().vehicles[i].vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
messageAdminAction(`All player-owned vehicles have been respawned by an admin!`);
|
||||
}
|
||||
@@ -1169,7 +1169,7 @@ function respawnPublicVehiclesCommand(command, params, client) {
|
||||
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_PUBLIC) {
|
||||
respawnVehicle(getServerData().vehicles[i].vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
messageAdminAction(`All public vehicles have been respawned by an admin!`);
|
||||
}
|
||||
@@ -1181,7 +1181,7 @@ function respawnBusinessVehiclesCommand(command, params, client) {
|
||||
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_BIZ) {
|
||||
respawnVehicle(getServerData().vehicles[i].vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
messageAdminAction(`All business-owned vehicles have been respawned by an admin!`);
|
||||
}
|
||||
@@ -1411,64 +1411,65 @@ function createPermanentVehicle(modelIndex, position, heading, interior = 0, dim
|
||||
// ===========================================================================
|
||||
|
||||
function processVehiclePurchasing() {
|
||||
if(!getGlobalConfig().useServerSideVehiclePurchaseCheck) {
|
||||
return false;
|
||||
}
|
||||
if(!getGlobalConfig().useServerSideVehiclePurchaseCheck) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getClients().forEach((client) => {
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
getClients().forEach((client) => {
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerSpawned(client)) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
if(!isPlayerSpawned(client)) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getPlayerData(client)) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
if(!getPlayerData(client)) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getPlayerData(client).buyingVehicle) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
if(!getPlayerData(client).buyingVehicle) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
if(getPlayerData(client).buyingVehicle != false) {
|
||||
messagePlayerError(client, getLocaleString(client, "DealershipPurchaseExitedVehicle"));
|
||||
respawnVehicle(getPlayerData(client).buyingVehicle);
|
||||
getPlayerData(client).buyingVehicle = false;
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
if(getPlayerData(client).buyingVehicle != false) {
|
||||
messagePlayerError(client, getLocaleString(client, "DealershipPurchaseExitedVehicle"));
|
||||
respawnVehicle(getPlayerData(client).buyingVehicle);
|
||||
getPlayerData(client).buyingVehicle = false;
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getDistance(getVehiclePosition(getPlayerData(client).buyingVehicle), getVehicleData(getPlayerData(client).buyingVehicle).spawnPosition) > getGlobalConfig().buyVehicleDriveAwayDistance) {
|
||||
if(getPlayerCurrentSubAccount(client).cash < getVehicleData(getPlayerData(client).buyingVehicle).buyPrice) {
|
||||
messagePlayerError(client, getLocaleString(client, "VehiclePurchaseNotEnoughMoney"));
|
||||
respawnVehicle(getPlayerData(client).buyingVehicle);
|
||||
getPlayerData(client).buyingVehicle = false;
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
if(getDistance(getVehiclePosition(getPlayerData(client).buyingVehicle), getVehicleData(getPlayerData(client).buyingVehicle).spawnPosition) > getGlobalConfig().buyVehicleDriveAwayDistance) {
|
||||
if(getPlayerCurrentSubAccount(client).cash < getVehicleData(getPlayerData(client).buyingVehicle).buyPrice) {
|
||||
messagePlayerError(client, getLocaleString(client, "VehiclePurchaseNotEnoughMoney"));
|
||||
respawnVehicle(getPlayerData(client).buyingVehicle);
|
||||
getPlayerData(client).buyingVehicle = false;
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
|
||||
createNewDealershipVehicle(getVehicleData(getPlayerData(client).buyingVehicle).model, getVehicleData(getPlayerData(client).buyingVehicle).spawnPosition, getVehicleData(getPlayerData(client).buyingVehicle).spawnRotation, getVehicleData(getPlayerData(client).buyingVehicle).buyPrice, getVehicleData(getPlayerData(client).buyingVehicle).ownerId);
|
||||
takePlayerCash(client, getVehicleData(getPlayerData(client).buyingVehicle).buyPrice);
|
||||
updatePlayerCash(client);
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).ownerId = getPlayerCurrentSubAccount(client).databaseId;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).ownerType = VRR_VEHOWNER_PLAYER;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).buyPrice = 0;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).rentPrice = 0;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).spawnLocked = false;
|
||||
getPlayerData(client).buyingVehicle = false;
|
||||
messagePlayerSuccess(client, getLocaleString(client, "VehiclePurchaseComplete"));
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
createNewDealershipVehicle(getVehicleData(getPlayerData(client).buyingVehicle).model, getVehicleData(getPlayerData(client).buyingVehicle).spawnPosition, getVehicleData(getPlayerData(client).buyingVehicle).spawnRotation, getVehicleData(getPlayerData(client).buyingVehicle).buyPrice, getVehicleData(getPlayerData(client).buyingVehicle).ownerId);
|
||||
takePlayerCash(client, getVehicleData(getPlayerData(client).buyingVehicle).buyPrice);
|
||||
updatePlayerCash(client);
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).ownerId = getPlayerCurrentSubAccount(client).databaseId;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).ownerType = VRR_VEHOWNER_PLAYER;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).buyPrice = 0;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).rentPrice = 0;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).spawnLocked = false;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).needsSaved = true;
|
||||
getPlayerData(client).buyingVehicle = false;
|
||||
messagePlayerSuccess(client, getLocaleString(client, "VehiclePurchaseComplete"));
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1478,9 +1479,9 @@ function processVehiclePurchasing() {
|
||||
function processVehicleBurning() {
|
||||
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
||||
for(let i in vehicles) {
|
||||
if(vehicles[i].health <= 250) {
|
||||
return false;
|
||||
}
|
||||
if(vehicles[i].health <= 250) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1518,19 +1519,19 @@ function setAllVehicleIndexes() {
|
||||
// ===========================================================================
|
||||
|
||||
function doesVehicleHaveMegaphone(vehicle) {
|
||||
if(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_JOB) {
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_POLICE) {
|
||||
return true;
|
||||
}
|
||||
if(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_JOB) {
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_POLICE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_FIRE) {
|
||||
return true;
|
||||
}
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_FIRE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_MEDICAL) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_MEDICAL) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1575,11 +1576,11 @@ function getVehicleTrunkPosition(vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function removeAllOccupantsFromVehicle(vehicle) {
|
||||
for(let i = 0 ; i <= 16 ; i++) {
|
||||
if(vehicle.getOccupant(i) != null) {
|
||||
removePlayerFromVehicle(vehicle.getOccupant(i));
|
||||
}
|
||||
}
|
||||
for(let i = 0 ; i <= 16 ; i++) {
|
||||
if(vehicle.getOccupant(i) != null) {
|
||||
removePlayerFromVehicle(vehicle.getOccupant(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user