Many improvements.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: account.js
|
||||
// DESC: Provides account functions and usage
|
||||
@@ -57,13 +57,7 @@ function loginCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isAccountPasswordCorrect(getClientData(client).accountData, hashAccountPassword(client.name, params))) {
|
||||
messageClientError(client, "Incorrect username or password!");
|
||||
return false;
|
||||
}
|
||||
|
||||
loginSuccess(client);
|
||||
//messageClientSuccess(client, "You have been logged in! Press left CTRL to spawn.");
|
||||
checkLogin(client, params);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -99,20 +93,10 @@ function registerCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!doesPasswordMeetRequirements(params)) {
|
||||
return false
|
||||
}
|
||||
|
||||
let accountData = createAccount(client.name, params);
|
||||
if(!accountData) {
|
||||
messageClientError(client, "Something went wrong, and your account could not be created!");
|
||||
messageClientAlert(client, "Asshat Gaming staff have been notified of the problem and will fix it shortly.");
|
||||
return false;
|
||||
}
|
||||
|
||||
getClientData(client).accountData = accountData;
|
||||
messageClientSuccess(client, "Your account has been created!");
|
||||
messageClientAlert(client, "To play on the server, you will need to make a character.");
|
||||
checkRegistration(client, params);
|
||||
//getClientData(client).accountData = accountData;
|
||||
//messageClientSuccess(client, "Your account has been created!");
|
||||
//messageClientAlert(client, "To play on the server, you will need to make a character.");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -129,7 +113,7 @@ function changePasswordCommand(command, params, client) {
|
||||
if(!isCommandAllowedOnDiscord(command)) {
|
||||
messageClientError(client, "That command isn't available on discord!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||
@@ -186,12 +170,77 @@ function switchCharacterCommand(command, params, client) {
|
||||
getClientCurrentSubAccount(client).spawnPosition = client.player.position;
|
||||
getClientCurrentSubAccount(client).spawnHeading = client.player.heading;
|
||||
|
||||
let tempSubAccount = getClientCurrentSubAccount(client);
|
||||
saveSubAccountToDatabase(tempSubAccount);
|
||||
saveSubAccountToDatabase(getClientCurrentSubAccount(client));
|
||||
|
||||
client.despawnPlayer();
|
||||
triggerNetworkEvent("ag.connectCamera", client, serverConfig.connectCameraPosition[getServerGame()], serverConfig.connectCameraLookAt[getServerGame()]);
|
||||
triggerNetworkEvent("ag.showCharacterSelect", client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.placeOfOrigin, tempSubAccount.dateOfBirth, tempSubAccount.skin);
|
||||
showConnectCameraToPlayer(client);
|
||||
showCharacterSelectToClient(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function newCharacterCommand(command, params, client) {
|
||||
if(doesCommandRequireLogin(command)) {
|
||||
if(!isClientLoggedIn(client)) {
|
||||
messageClientError(client, "You are not logged in!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(isClientFromDiscord(client)) {
|
||||
if(!isCommandAllowedOnDiscord(command)) {
|
||||
messageClientError(client, "That command isn't available on discord!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||
messageClientError(client, "You do not have permission to use this command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
messageClientSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let firstName = splitParams[0];
|
||||
let lastName = splitParams[1];
|
||||
|
||||
checkNewCharacter(client, firstName, lastName, "01/01/1901", "Liberty City", serverConfig.newCharacter.skin);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function useCharacterCommand(command, params, client) {
|
||||
if(doesCommandRequireLogin(command)) {
|
||||
if(!isClientLoggedIn(client)) {
|
||||
messageClientError(client, "You are not logged in!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(isClientFromDiscord(client)) {
|
||||
if(!isCommandAllowedOnDiscord(command)) {
|
||||
messageClientError(client, "That command isn't available on discord!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||
messageClientError(client, "You do not have permission to use this command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
messageClientSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let characterId = Number(params) || 1;
|
||||
|
||||
selectCharacter(client, characterId-1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -317,7 +366,7 @@ function loadSubAccountsFromAccount(accountId) {
|
||||
if(accountId > 0) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let dbQueryString = `SELECT * FROM sacct_main WHERE sacct_acct = ${accountId};`;
|
||||
let dbQueryString = `SELECT * FROM sacct_main WHERE sacct_acct = ${accountId} AND sacct_server = ${serverId}`;
|
||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||
if(dbQuery) {
|
||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||
@@ -394,7 +443,7 @@ function hashAccountPassword(name, password) {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function saltAccountInfo(name, password) {
|
||||
return "asshat.gaming." + String(accountSaltHash) + "." + String(name) + "." + String(password);
|
||||
return "ag.gaming." + String(accountSaltHash) + "." + String(name) + "." + String(password);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -406,7 +455,9 @@ function loginSuccess(client) {
|
||||
client.administrator = true;
|
||||
}
|
||||
|
||||
triggerNetworkEvent("ag.loginSuccess", client);
|
||||
if(serverConfig.useGUI) {
|
||||
triggerNetworkEvent("ag.loginSuccess", client);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -461,6 +512,7 @@ function createAccount(name, password, email = "") {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function createSubAccount(accountId, firstName, lastName, skinId, dateOfBirth, placeOfOrigin) {
|
||||
console.log(`[Asshat.Account] Attempting to create subaccount ${firstName} ${lastName} in database`);
|
||||
let dbConnection = connectToDatabase();
|
||||
|
||||
if(dbConnection) {
|
||||
@@ -468,7 +520,7 @@ function createSubAccount(accountId, firstName, lastName, skinId, dateOfBirth, p
|
||||
let safeLastName = escapeDatabaseString(dbConnection, lastName);
|
||||
let safePlaceOfOrigin = escapeDatabaseString(dbConnection, placeOfOrigin);
|
||||
|
||||
let dbQuery = queryDatabase(dbConnection, `INSERT INTO sacct_main (sacct_acct, sacct_name_first, sacct_name_last, sacct_skin, sacct_origin, sacct_when_born, sacct_pos_x, sacct_pos_y, sacct_pos_z, sacct_cash) VALUES (${accountId}, '${safeFirstName}', '${safeLastName}', ${skinId}, '${safePlaceOfOrigin}', '${dateOfBirth}', ${serverConfig.newCharacter.spawnPosition.x}, ${serverConfig.newCharacter.spawnPosition.y}, ${serverConfig.newCharacter.spawnPosition.z}, ${serverConfig.newCharacter.money})`);
|
||||
let dbQuery = queryDatabase(dbConnection, `INSERT INTO sacct_main (sacct_acct, sacct_name_first, sacct_name_last, sacct_skin, sacct_origin, sacct_when_born, sacct_pos_x, sacct_pos_y, sacct_pos_z, sacct_angle, sacct_cash, sacct_server) VALUES (${accountId}, '${safeFirstName}', '${safeLastName}', ${skinId}, '${safePlaceOfOrigin}', '${dateOfBirth}', ${serverConfig.newCharacter.spawnPosition.x}, ${serverConfig.newCharacter.spawnPosition.y}, ${serverConfig.newCharacter.spawnPosition.z}, ${serverConfig.newCharacter.spawnHeading}, ${serverConfig.newCharacter.money}, ${serverId})`);
|
||||
if(getDatabaseInsertId(dbConnection) > 0) {
|
||||
return loadSubAccountFromId(getDatabaseInsertId(dbConnection));
|
||||
}
|
||||
@@ -480,97 +532,138 @@ function createSubAccount(accountId, firstName, lastName, skinId, dateOfBirth, p
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
addNetworkHandler("ag.checkLogin", function(client, password) {
|
||||
function checkLogin(client, password) {
|
||||
let loginAttemptsRemaining = client.getData("ag.loginAttemptsRemaining")-1;
|
||||
|
||||
if(isClientLoggedIn(client)) {
|
||||
//messageClientError(client, "You are already logged in!");
|
||||
triggerNetworkEvent("ag.loginSuccess", client);
|
||||
if(serverConfig.useGUI) {
|
||||
triggerNetworkEvent("ag.loginSuccess", client);
|
||||
} else {
|
||||
messageClientError(client, "You are already logged in!");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isClientRegistered(client)) {
|
||||
//messageClientError(client, "Your name is not registered! Use /register to make an account.");
|
||||
triggerNetworkEvent("ag.showRegistration", client);
|
||||
if(serverConfig.useGUI) {
|
||||
triggerNetworkEvent("ag.showRegistration", client);
|
||||
} else {
|
||||
messageClientError(client, "Your name is not registered! Use /register to make an account.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(password)) {
|
||||
//messageClientError(client, "You must enter a password!");
|
||||
triggerNetworkEvent("ag.loginFailed", client, "Invalid password! " + String(loginAttemptsRemaining) + " tries remaining.");
|
||||
if(serverConfig.useGUI) {
|
||||
triggerNetworkEvent("ag.loginFailed", client, `Invalid password! ${loginAttemptsRemaining} tries remaining.`);
|
||||
} else {
|
||||
messageClientError(client, "You must enter a password!");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isAccountPasswordCorrect(getClientData(client).accountData, hashAccountPassword(client.name, password))) {
|
||||
//messageClientError(client, "Invalid password!");
|
||||
triggerNetworkEvent("ag.loginFailed", client, "Invalid password! " + String(loginAttemptsRemaining) + " tries remaining.");
|
||||
if(serverConfig.useGUI) {
|
||||
triggerNetworkEvent("ag.loginFailed", client, `Invalid password! ${loginAttemptsRemaining} tries remaining.`);
|
||||
} else {
|
||||
messageClientError(client, `Invalid password! ${loginAttemptsRemaining} tries remaining.`);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
loginSuccess(client);
|
||||
|
||||
if(getClientData(client).subAccounts.length == 0) {
|
||||
triggerNetworkEvent("ag.showPrompt", client, "You have no characters. Would you like to make one?", "No characters");
|
||||
client.setData("ag.prompt", AG_PROMPT_CREATEFIRSTCHAR, false);
|
||||
if(serverConfig.useGUI) {
|
||||
triggerNetworkEvent("ag.showPrompt", client, "You have no characters. Would you like to make one?", "No characters");
|
||||
client.setData("ag.prompt", AG_PROMPT_CREATEFIRSTCHAR, false);
|
||||
} else {
|
||||
messageClientAlert(client, `You have no characters. Use /newchar to make one.`);
|
||||
}
|
||||
} else {
|
||||
getClientData(client).currentSubAccount = 0;
|
||||
let tempSubAccount = getClientData(client).subAccounts[0];
|
||||
triggerNetworkEvent("ag.showCharacterSelect", client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.placeOfOrigin, tempSubAccount.dateOfBirth, tempSubAccount.skin);
|
||||
showCharacterSelectToClient(client);
|
||||
}
|
||||
});
|
||||
}
|
||||
addNetworkHandler("ag.checkLogin", checkLogin);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
addNetworkHandler("ag.checkRegistration", function(client, password, confirmPassword, emailAddress) {
|
||||
function checkRegistration(client, password, confirmPassword = "", emailAddress = "") {
|
||||
console.log("[Asshat.Account]: Checking registration for " + String(client.name));
|
||||
|
||||
if(isClientRegistered(client)) {
|
||||
//messageClientError(client, "Your name is already registered!");
|
||||
triggerNetworkEvent("ag.showLogin", client);
|
||||
if(serverConfig.useGUI) {
|
||||
triggerNetworkEvent("ag.showLogin", client);
|
||||
} else {
|
||||
messageClientError(client, "Your name is already registered!");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isClientLoggedIn(client)) {
|
||||
//messageClientError(client, "You are already logged in!");
|
||||
triggerNetworkEvent("ag.loginSuccess", client);
|
||||
if(serverConfig.useGUI) {
|
||||
triggerNetworkEvent("ag.loginSuccess", client);
|
||||
} else {
|
||||
messageClientError(client, "You are already logged in!");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(password)) {
|
||||
triggerNetworkEvent("ag.registrationFailed", client, "Password cannot be blank!");
|
||||
if(serverConfig.useGUI) {
|
||||
triggerNetworkEvent("ag.registrationFailed", client, "Password cannot be blank!");
|
||||
} else {
|
||||
messageClientError(client, "The password cannot be blank!");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(confirmPassword)) {
|
||||
triggerNetworkEvent("ag.registrationFailed", client, "Password confirm cannot be blank!");
|
||||
return false;
|
||||
if(serverConfig.useGUI) {
|
||||
if(areParamsEmpty(confirmPassword)) {
|
||||
triggerNetworkEvent("ag.registrationFailed", client, "Password confirm cannot be blank!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(areParamsEmpty(emailAddress)) {
|
||||
triggerNetworkEvent("ag.registrationFailed", client, "Email address cannot be blank!");
|
||||
return false;
|
||||
if(serverConfig.useGUI) {
|
||||
if(areParamsEmpty(emailAddress)) {
|
||||
triggerNetworkEvent("ag.registrationFailed", client, "Email address cannot be blank!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(password != confirmPassword) {
|
||||
triggerNetworkEvent("ag.registrationFailed", client, "The passwords must match!");
|
||||
return false;
|
||||
if(serverConfig.useGUI) {
|
||||
if(password != confirmPassword) {
|
||||
triggerNetworkEvent("ag.registrationFailed", client, "The passwords must match!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesPasswordMeetRequirements(password)) {
|
||||
// Work on this later. Function should return true by default anyway for now.
|
||||
triggerNetworkEvent("ag.registrationFailed", client, "Password doesn't meet requirements!");
|
||||
if(serverConfig.useGUI) {
|
||||
// Work on this later. Function should return true by default anyway for now.
|
||||
triggerNetworkEvent("ag.registrationFailed", client, "Password doesn't meet requirements!");
|
||||
} else {
|
||||
messageClientError(client, "Password doesn't meet requirements!");
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
if(!isValidEmailAddress(emailAddress)) {
|
||||
// Work on this later. Function should return true by default anyway for now.
|
||||
triggerNetworkEvent("ag.registrationFailed", client, "You must put a valid email!");
|
||||
return false
|
||||
if(serverConfig.useGUI) {
|
||||
if(!isValidEmailAddress(emailAddress)) {
|
||||
triggerNetworkEvent("ag.registrationFailed", client, "You must put a valid email!");
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
let accountData = createAccount(client.name, password, emailAddress);
|
||||
if(!accountData) {
|
||||
triggerNetworkEvent("ag.registrationFailed", client, "Something went wrong. Your account could not be created!");
|
||||
if(serverConfig.useGUI) {
|
||||
triggerNetworkEvent("ag.registrationFailed", client, "Something went wrong. Your account could not be created!");
|
||||
} else {
|
||||
messageClientAlert(client, "Something went wrong. Your account could not be created!");
|
||||
}
|
||||
|
||||
messageClientAlert(client, "Asshat Gaming staff have been notified of the problem and will fix it shortly.");
|
||||
return false;
|
||||
}
|
||||
@@ -580,15 +673,20 @@ addNetworkHandler("ag.checkRegistration", function(client, password, confirmPass
|
||||
|
||||
messageClientSuccess(client, "Your account has been created!");
|
||||
messageClientAlert(client, "To play on the server, you will need to make a character.");
|
||||
triggerNetworkEvent("ag.registrationSuccess", client);
|
||||
triggerNetworkEvent("ag.showPrompt", client, "You have no characters. Would you like to make one?", "No Characters");
|
||||
|
||||
client.setData("ag.prompt", AG_PROMPT_CREATEFIRSTCHAR, false);
|
||||
});
|
||||
|
||||
if(serverConfig.useGUI) {
|
||||
triggerNetworkEvent("ag.registrationSuccess", client);
|
||||
triggerNetworkEvent("ag.showPrompt", client, "You have no characters. Would you like to make one?", "No Characters");
|
||||
client.setData("ag.prompt", AG_PROMPT_CREATEFIRSTCHAR, false);
|
||||
} else {
|
||||
messageClientAlert(client, `You have no characters. Use /newchar to make one.`);
|
||||
}
|
||||
};
|
||||
addNetworkHandler("ag.checkRegistration", checkRegistration);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
addNetworkHandler("ag.checkNewCharacter", function(client, firstName, lastName, dateOfBirth, placeOfOrigin, skinId) {
|
||||
function checkNewCharacter(client, firstName, lastName, dateOfBirth, placeOfOrigin, skinId) {
|
||||
if(areParamsEmpty(firstName)) {
|
||||
triggerNetworkEvent("ag.newCharacterFailed", client, "First name cannot be blank!");
|
||||
return false;
|
||||
@@ -618,18 +716,21 @@ addNetworkHandler("ag.checkNewCharacter", function(client, firstName, lastName,
|
||||
|
||||
let subAccountData = createSubAccount(getClientData(client).accountData.databaseId, firstName, lastName, skinId, dateOfBirth, placeOfOrigin);
|
||||
if(!subAccountData) {
|
||||
triggerNetworkEvent("ag.newCharacterFailed", client, "Something went wrong. Your character could not be created!");
|
||||
if(serverConfig.useGUI) {
|
||||
triggerNetworkEvent("ag.newCharacterFailed", client, "Something went wrong. Your character could not be created!");
|
||||
} else {
|
||||
messageClientAlert(client, "Something went wrong. Your character could not be created!");
|
||||
}
|
||||
messageClientAlert(client, "Asshat Gaming staff have been notified of the problem and will fix it shortly.");
|
||||
return false;
|
||||
}
|
||||
|
||||
getClientData(client).subAccounts = loadSubAccountsFromAccount(getClientData(client).accountData.databaseId);
|
||||
triggerNetworkEvent("ag.newCharacterSuccess", client);
|
||||
|
||||
getClientData(client).currentSubAccount = 0;
|
||||
let tempSubAccount = getClientData(client).subAccounts[0];
|
||||
triggerNetworkEvent("ag.showCharacterSelect", client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.placeOfOrigin, tempSubAccount.dateOfBirth, tempSubAccount.skin);
|
||||
});
|
||||
showCharacterSelectToClient(client);
|
||||
}
|
||||
addNetworkHandler("ag.checkNewCharacter", checkNewCharacter);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -665,17 +766,26 @@ addNetworkHandler("ag.nextCharacter", function(client) {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
addNetworkHandler("ag.selectCharacter", function(client) {
|
||||
triggerNetworkEvent("ag.characterSelectSuccess", client);
|
||||
function selectCharacter(client, characterId = -1) {
|
||||
if(serverConfig.useGUI) {
|
||||
triggerNetworkEvent("ag.characterSelectSuccess", client);
|
||||
}
|
||||
|
||||
let subAccountId = getClientData(client).currentSubAccount;
|
||||
let tempSubAccount = getClientData(client).subAccounts[subAccountId];
|
||||
if(characterId != -1) {
|
||||
getClientData(client).currentSubAccount = characterId;
|
||||
}
|
||||
|
||||
console.log(getClientData(client).currentSubAccount);
|
||||
|
||||
let tempSubAccount = getClientCurrentSubAccount(client);
|
||||
spawnPlayer(client, tempSubAccount.spawnPosition, tempSubAccount.spawnHeading, tempSubAccount.skin);
|
||||
|
||||
messageClientNormal(client, "Welcome to Asshat Gaming Roleplay!", getColourByName("white"));
|
||||
messageClientNormal(client, `You are playing as ${tempSubAccount.firstName} ${tempSubAccount.lastName}`, getColourByName("white"));
|
||||
messageClientNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange"));
|
||||
messageClientNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
|
||||
});
|
||||
triggerNetworkEvent("ag.restoreCamera", client);
|
||||
}
|
||||
addNetworkHandler("ag.selectCharacter", selectCharacter);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -721,7 +831,10 @@ function saveClientToDatabase(client) {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function initClient(client) {
|
||||
triggerNetworkEvent("ag.connectCamera", client, serverConfig.connectCameraPosition[getServerGame()], serverConfig.connectCameraLookAt[getServerGame()]);
|
||||
serverData.clients[client.index] = null;
|
||||
triggerNetworkEvent("ag.logo", client, serverConfig.showLogo);
|
||||
showConnectCameraToPlayer(client);
|
||||
clearChatBox(client);
|
||||
|
||||
let tempAccountData = loadAccountFromName(client.name);
|
||||
let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId);
|
||||
@@ -729,14 +842,22 @@ function initClient(client) {
|
||||
serverData.clients[client.index] = new serverClasses.clientData(client, tempAccountData, tempSubAccounts);
|
||||
|
||||
if(tempAccountData != false) {
|
||||
triggerNetworkEvent("ag.showLogin", client);
|
||||
//messageClient("Welcome back to Asshat Gaming RP, " + String(client.name) + "! Please /login to continue.", client, serverConfig.colour.byName["white"]);
|
||||
if(serverConfig.useGUI) {
|
||||
triggerNetworkEvent("ag.showLogin", client);
|
||||
} else {
|
||||
messageClient(`Welcome back to Asshat Gaming RP, ${client.name}! Please /login to continue.`, client, serverConfig.colour.byName.softGreen);
|
||||
}
|
||||
} else {
|
||||
triggerNetworkEvent("ag.showRegistration", client);
|
||||
//messageClient("Welcome to Asshat Gaming RP, " + String(client.name) + "! Please /register to continue.", client, serverConfig.colour.byName["white"]);
|
||||
if(serverConfig.useGUI) {
|
||||
triggerNetworkEvent("ag.showRegistration", client);
|
||||
} else {
|
||||
messageClient(`Welcome to Asshat Gaming RP, ${client.name}! Please /register to continue.`, client, serverConfig.colour.byName.softGreen);
|
||||
}
|
||||
}
|
||||
|
||||
sendAllBlips(client);
|
||||
if(server.game < GAME_GTA_IV) {
|
||||
sendAllBlips(client);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -745,4 +866,22 @@ function getClientData(client) {
|
||||
return serverData.clients[client.index];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function showCharacterSelectToClient(client) {
|
||||
if(serverConfig.useGUI) {
|
||||
getClientData(client).currentSubAccount = 0;
|
||||
let tempSubAccount = getClientData(client).subAccounts[0];
|
||||
triggerNetworkEvent("ag.showCharacterSelect", client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.placeOfOrigin, tempSubAccount.dateOfBirth, tempSubAccount.skin);
|
||||
} else {
|
||||
//let emojiNumbers = ["➊", "➋", "➌", "➍", "➎", "➏", "➐", "➑", "➒"];
|
||||
//let emojiNumbers = ["①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨"];
|
||||
messageClientNormal(client, `You have the following characters. Use /usechar <id> to select one:`, serverConfig.colour.byName.teal);
|
||||
getClientData(client).subAccounts.forEach(function(subAccount, index) {
|
||||
messageClientNormal(client, `${index+1} • [#CCCCCC]${subAccount.firstName} ${subAccount.lastName}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: ammunation.js
|
||||
// DESC: Provides ammunation functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: bans.js
|
||||
// DESC: Provides ban functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: bitflags.js
|
||||
// DESC: Provides bitwise operations, functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: business.js
|
||||
// DESC: Provides business functions and usage
|
||||
@@ -53,12 +53,40 @@ function loadBusinessesFromDatabase() {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
console.log("[Asshat.Business]: " + String(tempBusinesses.length) + " businesses loaded from database successfully!");
|
||||
console.log(`[Asshat.Business]: ${tempBusinesses.length} businesses loaded from database successfully!`);
|
||||
return tempBusinesses;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function loadLocationsFromDatabase() {
|
||||
console.log("[Asshat.Business]: Loading locations from database ...");
|
||||
|
||||
let tempLocations = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
let dbQuery = null;
|
||||
|
||||
if(dbConnection) {
|
||||
dbQuery = queryDatabase(dbConnection, "SELECT * FROM `loc_main` WHERE `loc_server` = " + String(serverId));
|
||||
if(dbQuery) {
|
||||
if(dbQuery.numRows > 0) {
|
||||
while(dbFetchAssoc = fetchQueryAssoc(dbQuery)) {
|
||||
let tempLocationData = locationData(dbFetchAssoc);
|
||||
tempLocations.push(tempLocationData);
|
||||
console.log(`[Asshat.Business]: Location '${tempLocationData.name}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
freeDatabaseQuery(dbQuery);
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
console.log(`[Asshat.Business]: ${tempBusinesses.length} locations loaded from database successfully!`);
|
||||
return tempLocations;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function createBusinessCommand(command, params, client) {
|
||||
if(getCommand(command).requireLogin) {
|
||||
if(!isClientLoggedIn(client)) {
|
||||
@@ -95,6 +123,45 @@ function createBusinessCommand(command, params, client) {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function createBusinessLocationCommand(command, params, client) {
|
||||
if(getCommand(command).requireLogin) {
|
||||
if(!isClientLoggedIn(client)) {
|
||||
messageClientError(client, "You must be logged in to use this command!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(isClientFromDiscord(client)) {
|
||||
if(!isCommandAllowedOnDiscord(command)) {
|
||||
messageClientError(client, "That command isn't available on discord!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||
messageClientError(client, "You do not have permission to use this command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
messageClientSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isClientSpawned(client)) {
|
||||
messageClientError("You must be spawned to use this command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
let locationType = String(splitParams[0]);
|
||||
let businessId = Number(splitParams[1]) || (isPlayerInAnyBusiness(client.player)) ? getPlayerBusiness(client.player) : getClosestBusinessEntrance(client.player.position);
|
||||
|
||||
createBusinessLocation(locationType, businessId);
|
||||
messageClientSuccess(client, "Business created in " + getAreaName(client.player.position) + " (" + params + ")");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function createBusiness(name, entrancePosition, interiorId, virtualWorld) {
|
||||
let dbConnection = connectToDatabase();
|
||||
let escapedName = name;
|
||||
@@ -140,15 +207,48 @@ function deleteBusinessCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let businessId = Number(params);
|
||||
|
||||
let tempBusinessData = serverData.businesses.filter(b => b.databaseId == businessId)[0];
|
||||
let businessId = Number(splitParams[1]) || (isPlayerInAnyBusiness(client.player)) ? getPlayerBusiness(client.player) : getClosestBusinessEntrance(client.player.position);
|
||||
deleteBusiness(businessId);
|
||||
messageClientSuccess(client, `Business '${tempBusinessData.name} deleted!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function deleteBusinessLocationCommand(command, params, client) {
|
||||
messageClientError(client, "This command is under construction!");
|
||||
return false;
|
||||
|
||||
if(getCommand(command).requireLogin) {
|
||||
if(!isClientLoggedIn(client)) {
|
||||
messageClientError(client, "You must be logged in to use this command!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(isClientFromDiscord(client)) {
|
||||
if(!isCommandAllowedOnDiscord(command)) {
|
||||
messageClientError(client, "That command isn't available on discord!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||
messageClientError(client, "You do not have permission to use this command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
messageClientSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
//let businessId = Number(splitParams[1]);
|
||||
//deleteBusinessLocation(businessId);
|
||||
//messageClientSuccess(client, `Business '${tempBusinessData.name} deleted!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function setBusinessNameCommand(command, params, client) {
|
||||
if(getCommand(command).requireLogin) {
|
||||
if(!isClientLoggedIn(client)) {
|
||||
@@ -177,12 +277,10 @@ function setBusinessNameCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let newBusinessName = String(splitParams[0]);
|
||||
let businessId = Number(splitParams[1]) || (isPlayerInAnyBusiness(client.player)) ? getPlayerBusiness(client.player) : getClosestBusinessEntrance(client.player.position).databaseId;
|
||||
|
||||
let tempBusinessData = serverData.businesses.filter(b => b.databaseId == businessId)[0];
|
||||
let businessId = Number(splitParams[1]) || (isPlayerInAnyBusiness(client.player)) ? getPlayerBusiness(client.player) : getClosestBusinessEntrance(client.player.position);
|
||||
|
||||
serverData.businesses[businessId].name = newBusinessName;
|
||||
messageClientSuccess(client, `Business '${tempBusinessData.name}' renamed to '${newBusinessName}'!`);
|
||||
messageClientSuccess(client, `Business '${serverData.businesses[businessId].name}' renamed to '${newBusinessName}'!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -220,7 +318,7 @@ function setBusinessOwnerCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let newBusinessOwner = getClientFromParams(splitParams[0]);
|
||||
let businessId = Number(splitParams[1]) || (isPlayerInAnyBusiness(client.player)) ? getPlayerBusiness(client.player) : getClosestBusinessEntrance(client.player.position).databaseId;
|
||||
let businessId = Number(splitParams[1]) || (isPlayerInAnyBusiness(client.player)) ? getPlayerBusiness(client.player) : getClosestBusinessEntrance(client.player.position);
|
||||
|
||||
if(!newBusinessOwner) {
|
||||
messageClientError("Player not found!");
|
||||
@@ -270,7 +368,7 @@ function lockBusinessCommand(command, params, client) {
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let businessId = Number(splitParams[0]) || (isPlayerInAnyBusiness(client.player)) ? getPlayerBusiness(client.player) : getClosestBusinessEntrance(client.player.position).databaseId;
|
||||
let businessId = Number(splitParams[0]) || (isPlayerInAnyBusiness(client.player)) ? getPlayerBusiness(client.player) : getClosestBusinessEntrance(client.player.position);
|
||||
|
||||
serverData.businesses[businessId].locked = !serverData.businesses[businessId].locked;
|
||||
messageClientSuccess(client, "Business " + serverData.businesses[businessId].name + " " + (serverData.businesses[businessId].locked) ? "locked" : "unlocked" + "!");
|
||||
@@ -278,6 +376,164 @@ function lockBusinessCommand(command, params, client) {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function setBusinessEntranceFeeCommand(command, params, client) {
|
||||
if(getCommand(command).requireLogin) {
|
||||
if(!isClientLoggedIn(client)) {
|
||||
messageClientError(client, "You must be logged in to use this command!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(isClientFromDiscord(client)) {
|
||||
if(!isCommandAllowedOnDiscord(command)) {
|
||||
messageClientError(client, "That command isn't available on discord!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||
messageClientError(client, "You do not have permission to use this command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
messageClientSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let entranceFee = Number(splitParams[0]) || 0;
|
||||
let businessId = Number(splitParams[1]) || (isPlayerInAnyBusiness(client.player)) ? getPlayerBusiness(client.player) : getClosestBusinessEntrance(client.player.position);
|
||||
|
||||
serverData.businesses[businessId].entranceFee = entranceFee;
|
||||
messageClientSuccess(client, `Business '${serverData.businesses[businessId].name}' entrance fee to $'${entranceFee}'!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function withdrawFromBusinessCommand(command, params, client) {
|
||||
if(getCommand(command).requireLogin) {
|
||||
if(!isClientLoggedIn(client)) {
|
||||
messageClientError(client, "You must be logged in to use this command!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(isClientFromDiscord(client)) {
|
||||
if(!isCommandAllowedOnDiscord(command)) {
|
||||
messageClientError(client, "That command isn't available on discord!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||
messageClientError(client, "You do not have permission to use this command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
messageClientSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let amount = Number(splitParams[0]) || 0;
|
||||
let businessId = Number(splitParams[1]) || (isPlayerInAnyBusiness(client.player)) ? getPlayerBusiness(client.player) : getClosestBusinessEntrance(client.player.position);
|
||||
|
||||
let tempBusinessData = serverData.businesses.filter(b => b.databaseId == businessId)[0];
|
||||
|
||||
if(serverData.businesses[businessId].till < amount) {
|
||||
messageClientError(client, `Business '${tempBusinessData.name}' doesn't have that much money! Use /bizbalance.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
serverData.businesses[businessId].till -= amount;
|
||||
getClientCurrentSubAccount(client).cash += amount;
|
||||
updatePlayerCash(client);
|
||||
messageClientSuccess(client, `You withdrew $${amount} from business '${tempBusinessData.name}''s till'`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function depositIntoBusinessCommand(command, params, client) {
|
||||
if(getCommand(command).requireLogin) {
|
||||
if(!isClientLoggedIn(client)) {
|
||||
messageClientError(client, "You must be logged in to use this command!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(isClientFromDiscord(client)) {
|
||||
if(!isCommandAllowedOnDiscord(command)) {
|
||||
messageClientError(client, "That command isn't available on discord!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||
messageClientError(client, "You do not have permission to use this command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
messageClientSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let amount = Number(splitParams[0]) || 0;
|
||||
let businessId = Number(splitParams[1]) || (isPlayerInAnyBusiness(client.player)) ? getPlayerBusiness(client.player) : getClosestBusinessEntrance(client.player.position);
|
||||
|
||||
if(getClientCurrentSubAccount(client).cash < amount) {
|
||||
messageClientError(client, `You don't have that much money! You only have $${getClientCurrentSubAccount(client).cash}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
serverData.businesses[businessId].till += amount;
|
||||
getClientCurrentSubAccount(client).cash -= amount;
|
||||
updatePlayerCash(client);
|
||||
messageClientSuccess(client, `You deposited $${amount} into business '${tempBusinessData.name}''s till'`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function viewBusinessTillAmountCommand(command, params, client) {
|
||||
if(getCommand(command).requireLogin) {
|
||||
if(!isClientLoggedIn(client)) {
|
||||
messageClientError(client, "You must be logged in to use this command!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(isClientFromDiscord(client)) {
|
||||
if(!isCommandAllowedOnDiscord(command)) {
|
||||
messageClientError(client, "That command isn't available on discord!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||
messageClientError(client, "You do not have permission to use this command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
//if(areParamsEmpty(params)) {
|
||||
// messageClientSyntax(client, getCommandSyntaxText(command));
|
||||
// return false;
|
||||
//}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let businessId = Number(splitParams[0]) || (isPlayerInAnyBusiness(client.player)) ? getPlayerBusiness(client.player) : getClosestBusinessEntrance(client.player.position);
|
||||
|
||||
messageClientSuccess(client, `Business '${serverData.businesses[businessId].name}''s till has $'${serverData.businesses[businessId].till}'!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function getBusinessDataFromDatabaseId(databaseId) {
|
||||
let matchingBusinesses = serverData.businesses.filter(b => b.databaseId == businessId)
|
||||
if(matchingBusinesses.length == 1) {
|
||||
@@ -315,7 +571,32 @@ function getPlayerBusiness(player) {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function saveAllBusinessesToDatabase() {
|
||||
for(let i in serverData.businesses) {
|
||||
saveBusinessToDatabase(i);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function saveBusinessToDatabase(businessId) {
|
||||
let tempBusinessData = serverData.businesses[businessId]
|
||||
console.log(`[Asshat.Business]: Saving business '${tempBusinessData.name}' to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
if(tempBusinessData.databaseId == 0) {
|
||||
let dbQueryString = `INSERT INTO biz_main (biz_name, biz_owner_type, biz_owner_id, biz_locked, biz_entrance_fee, biz_till, biz_entrance_pos_x, biz_entrance_pos_y, biz_entrance_pos_z, biz_entrance_rot_z, biz_entrance_int, biz_entrance_vw, biz_exit_pos_x, biz_exit_pos_y, biz_exit_pos_z, biz_exit_rot_z, biz_exit_int, biz_exit_vw) VALUES ('${tempBusinessData.name}', ${tempBusinessData.ownerType}, ${tempBusinessData.ownerId}, ${boolToInt(tempBusinessData.locked)}, ${tempBusinessData.entranceFee}, ${tempBusinessData.till}, ${tempBusinessData.entrancePos.x}, ${tempBusinessData.entrancePos.y}, ${tempBusinessData.entrancePos.z}, ${tempBusinessData.entranceHeading}, ${tempBusinessData.entranceInterior}, ${tempBusinessData.entranceDimension}, ${tempBusinessData.exitPos.x}, ${tempBusinessData.exitPos.y}, ${tempBusinessData.exitPos.z}, ${tempBusinessData.exitHeading}, ${tempBusinessData.exitInterior}, ${tempBusinessData.exitDimension})`;
|
||||
queryDatabase(dbConnection, dbQueryString);
|
||||
serverData.businesses[businessId].databaseId = getDatabaseInsertId(dbConnection);
|
||||
} else {
|
||||
let dbQueryString = `UPDATE biz_main SET biz_name=${tempBusinessData.name}, biz_owner_type=${tempBusinessData.ownerType}, biz_owner_id=${tempBusinessData.ownerId}, biz_locked=${boolToInt(tempBusinessData.locked)}, biz_entrance_fee=${tempBusinessData.entranceFee}, biz_till=${tempBusinessData.till}, biz_entrance_pos_x=${tempBusinessData.entrancePos.x}, biz_entrance_pos_y=${tempBusinessData.entrancePos.y}, biz_entrance_pos_z=${tempBusinessData.entrancePos.z}, biz_entrance_rot_z=${tempBusinessData.entranceHeading}, biz_entrance_int=${tempBusinessData.entranceInterior}, biz_entrance_vw=${tempBusinessData.entranceDimension}, biz_exit_pos_x=${tempBusinessData.exitPos.x}, biz_exit_pos_y=${tempBusinessData.exitPos.y}, biz_exit_pos_z=${tempBusinessData.exitPos.z}, biz_exit_rot_z=${tempBusinessData.exitHeading}, biz_exit_int=${tempBusinessData.exitInterior}, biz_exit_vw=${tempBusinessData.exitDimension} WHERE biz_id=${tempBusinessData.databaseId}`;
|
||||
queryDatabase(dbConnection, dbQueryString);
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
console.log(`[Asshat.Business]: Saved business '${tempBusinessData.name}' to database!`);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -326,4 +607,71 @@ function createAllBusinessPickups() {
|
||||
serverData.businesses[i].pickup.setData("ag.ownerType", AG_PICKUP_BUSINESS, true);
|
||||
serverData.businesses[i].pickup.setData("ag.ownerId", i, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function deleteBusiness(businessId) {
|
||||
let tempBusinessData = serverData.businesses[businessId];
|
||||
|
||||
let dbConnection = connectToDatabase();
|
||||
let dbQuery = null;
|
||||
|
||||
if(dbConnection) {
|
||||
dbQuery = queryDatabase(dbConnection, `UPDATE biz_main SET biz_deleted = 1 AND biz_who_deleted = ${getClientData(client).accountData.databaseId} AND biz_when_deleted = UNIX_TIMESTAMP() WHERE biz_id = ${tempBusinessData.databaseId} LIMIT 1`);
|
||||
if(dbQuery) {
|
||||
freeDatabaseQuery(dbQuery);
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
destroyElement(tempBusinessData.pickup);
|
||||
removePlayersFromBusiness(businessId);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
function deleteBusiness(businessId) {
|
||||
let tempBusinessData = serverData.businesses[businessId];
|
||||
|
||||
let dbConnection = connectToDatabase();
|
||||
let dbQuery = null;
|
||||
|
||||
if(dbConnection) {
|
||||
dbQuery = queryDatabase(dbConnection, `UPDATE biz_main SET biz_deleted = 1 AND biz_who_deleted = ${getClientData(client).accountData.databaseId} AND biz_when_deleted = UNIX_TIMESTAMP() WHERE biz_id = ${tempBusinessData.databaseId} LIMIT 1`);
|
||||
if(dbQuery) {
|
||||
freeDatabaseQuery(dbQuery);
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
destroyElement(tempBusinessData.pickup);
|
||||
removePlayersFromBusiness(businessId);
|
||||
}
|
||||
*/
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function removePlayersFromBusiness(businessId) {
|
||||
getClients().forEach(function(client) {
|
||||
if(client.getData("ag.inBusiness")) {
|
||||
if(client.getData("ag.inBusiness") == businessId) {
|
||||
exitBusiness(client);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function exitBusiness(client) {
|
||||
let businessId = client.getData("ag.inBusiness");
|
||||
if(client.player) {
|
||||
triggerNetworkEvent("ag.interior", client, serverData.businesses[businessId].entranceInterior);
|
||||
triggerNetworkEvent("ag.dimension", client, serverData.businesses[businessId].entranceDimension);
|
||||
triggerNetworkEvent("ag.position", client, serverData.businesses[businessId].entrancePosition);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: bakery.js
|
||||
// DESC: Provides bakery business functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: bar.js
|
||||
// DESC: Provides bar/pub business functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: burger.js
|
||||
// DESC: Provides burger joint (McDonalds?) business functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: clothing.js
|
||||
// DESC: Provides clothing (skin) business functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: club.js
|
||||
// DESC: Provides club/nightclub business functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: fuel.js
|
||||
// DESC: Provides fuel/petrol business functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: mechanic.js
|
||||
// DESC: Provides mechanic/vehicle repair business functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: pizza.js
|
||||
// DESC: Provides pizza restaurant business functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: restaurant.js
|
||||
// DESC: Provides generic restaurant business functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: vehicle.js
|
||||
// DESC: Provides vehicle dealership business functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: weapon.js
|
||||
// DESC: Provides weapon (ammu) business functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: chat.js
|
||||
// DESC: Provides chat functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: clan.js
|
||||
// DESC: Provides clan functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: class.js
|
||||
// DESC: Provides classes
|
||||
@@ -92,12 +92,33 @@ function initClassTable() {
|
||||
this.locked = businessAssoc("biz_locked");
|
||||
|
||||
this.entrancePosition = new Vec3(businessAssoc("biz_entrance_pos_x"), businessAssoc("biz_entrance_pos_y"), businessAssoc("biz_entrance_pos_z"));
|
||||
this.entranceRotation = Number(businessAssoc["biz_entrance_rot_z"]);
|
||||
this.entranceInterior = Number(businessAssoc["biz_entrance_int"]);
|
||||
this.entranceDimension = Number(businessAssoc["biz_entrance_vw"]);
|
||||
|
||||
this.exitPosition = new Vec3(businessAssoc("biz_exit_pos_x"), businessAssoc("biz_exit_pos_y"), businessAssoc("biz_exit_pos_z"));
|
||||
this.exitRotation = Number(businessAssoc["biz_exit_rot_z"]);
|
||||
this.exitInterior = Number(businessAssoc["biz_exit_int"]);
|
||||
this.exitDimension = Number(businessAssoc["biz_exit_vw"]);
|
||||
|
||||
this.till = Number(businessAssoc["biz_till"]);
|
||||
}
|
||||
},
|
||||
locationData: class {
|
||||
constructor(locationAssoc) {
|
||||
if(!locationAssoc) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.databaseId = locationAssoc("biz_id");
|
||||
this.name = locationAssoc("loc_name");
|
||||
this.type = locationAssoc("loc_type");
|
||||
this.business = locationAssoc("loc_biz");
|
||||
this.enabled = locationAssoc("loc_enabled");
|
||||
|
||||
this.position = new Vec3(businessAssoc("loc_pos_x"), businessAssoc("loc__pos_y"), businessAssoc("loc_pos_z"));
|
||||
this.interior = Number(businessAssoc["loc_int"]);
|
||||
this.dimension = Number(businessAssoc["loc_vw"]);
|
||||
}
|
||||
},
|
||||
houseData: class {
|
||||
@@ -117,6 +138,7 @@ function initClassTable() {
|
||||
this.model = vehicle.modelIndex;
|
||||
this.vehicle = vehicle;
|
||||
this.tempVehicle = false;
|
||||
this.streamedBy = false; // For IV only
|
||||
|
||||
// Ownership
|
||||
this.ownerType = AG_VEHOWNER_NONE;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: client.js
|
||||
// DESC: Provides client communication and cross-endpoint operations
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: colour.js
|
||||
// DESC: Provides colours, functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: command.js
|
||||
// DESC: Provides command data, functions and usage
|
||||
@@ -24,6 +24,8 @@ function loadCommandData() {
|
||||
commandData("changepass", changePasswordCommand, "<password>", getStaffFlagValue("none"), true, false),
|
||||
//commandData("setpass", changePasswordCommand, "<password>", getStaffFlagValue("none"), true, false),
|
||||
commandData("switchchar", switchCharacterCommand, "", getStaffFlagValue("none"), true, false),
|
||||
commandData("newchar", newCharacterCommand, "<first name> <last name>", getStaffFlagValue("none"), true, false),
|
||||
commandData("usechar", useCharacterCommand, "<character id>", getStaffFlagValue("none"), true, false),
|
||||
],
|
||||
ammunation: [],
|
||||
ban: [
|
||||
@@ -33,8 +35,17 @@ function loadCommandData() {
|
||||
],
|
||||
bitFlag: [],
|
||||
business: [
|
||||
commandData("addbiz", createBusinessCommand, "<name>", getStaffFlagValue("manageBusinesses"), true, false),
|
||||
commandData("addbiz", createBusinessCommand, "<name>", getStaffFlagValue("manageBusinesses"), true, false),
|
||||
commandData("delbiz", deleteBusinessCommand, "[id]", getStaffFlagValue("manageBusinesses"), true, true),
|
||||
commandData("addloc", createBusinessLocationCommand, "<type> <business id> <name>", getStaffFlagValue("manageBusinesses"), true, false),
|
||||
commandData("delloc", deleteBusinessLocationCommand, "[id]", getStaffFlagValue("manageBusinesses"), true, false),
|
||||
commandData("lockbiz", lockBusinessCommand, "", getStaffFlagValue("none"), true, true),
|
||||
commandData("enterfee", setBusinessEntranceFeeCommand, "<amount>", getStaffFlagValue("none"), true, true),
|
||||
commandData("till", viewBusinessTillAmountCommand, "", getStaffFlagValue("none"), true, true),
|
||||
commandData("bizwithdraw", withdrawFromBusinessCommand, "<amount>", getStaffFlagValue("none"), true, true),
|
||||
commandData("bizdeposit", depositIntoBusinessCommand, "<amount>", getStaffFlagValue("none"), true, true),
|
||||
commandData("bizname", setBusinessNameCommand, "<name>", getStaffFlagValue("none"), true, true),
|
||||
commandData("bizowner", setBusinessOwnerCommand, "<player name/id>", getStaffFlagValue("none"), true, true),
|
||||
],
|
||||
chat: [
|
||||
commandData("me", meActionCommand, "<message>", getStaffFlagValue("none"), true, false),
|
||||
@@ -104,7 +115,12 @@ function loadCommandData() {
|
||||
],
|
||||
locale: [],
|
||||
messaging: [],
|
||||
misc: [],
|
||||
misc: [
|
||||
commandData("settime", setTimeCommand, "<hour> [minute]", getStaffFlagValue("manageServer"), true, true),
|
||||
commandData("setweather", setWeatherCommand, "<weather id/name>", getStaffFlagValue("manageServer"), true, true),
|
||||
commandData("setsnow", setSnowingCommand, "<falling snow> <ground snow>", getStaffFlagValue("manageServer"), true, true),
|
||||
commandData("setlogo", toggleServerLogoCommand, "<0/1 state>", getStaffFlagValue("manageServer"), true, true),
|
||||
],
|
||||
moderation: [
|
||||
commandData("kick", kickClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
|
||||
commandData("mute", muteClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
|
||||
@@ -179,6 +195,12 @@ function getCommandRequiredPermissions(command) {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function getCommandSyntaxText(command) {
|
||||
return getCommand(command).syntaxString;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function isCommandAllowedOnDiscord(command) {
|
||||
return getCommand(command).allowOnDiscord;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: config.js
|
||||
// DESC: Provides server configuration
|
||||
@@ -9,6 +9,15 @@
|
||||
// ===========================================================================
|
||||
|
||||
let serverConfig = {
|
||||
useGUI: true,
|
||||
name: "Asshat Gaming Roleplay",
|
||||
password: "LockedForStartup*128",
|
||||
hour: 0,
|
||||
minute: 0,
|
||||
weather: 1,
|
||||
fallingSnow: 0,
|
||||
groundSnow: 0,
|
||||
showLogo: true,
|
||||
colour: {
|
||||
byType: {
|
||||
talkMessage: toColour(200, 200, 200),
|
||||
@@ -42,27 +51,16 @@ let serverConfig = {
|
||||
burntYellow: toColour(210, 210, 0, 255),
|
||||
burntOrange: toColour(210, 120, 0, 255),
|
||||
bankGreen: toColour(0, 150, 0, 255),
|
||||
softGreen: toColour(144, 255, 96, 255),
|
||||
}
|
||||
},
|
||||
accountPasswordHash: "SHA512",
|
||||
connectCameraPosition: [
|
||||
false,
|
||||
new Vec3(-1176.481, -17.694, 95.992),
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
],
|
||||
connectCameraLookAt: [
|
||||
false,
|
||||
new Vec3(-1175.726, -17.055, 95.847),
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
],
|
||||
connectCameraPosition: false,
|
||||
connectCameraLookAt: false,
|
||||
newCharacter: {
|
||||
spawnPosition: new Vec3(1038.40, -666.70, 14.97),
|
||||
spawnPosition: false,
|
||||
spawnHeading: 0.0,
|
||||
money: 1000,
|
||||
money: 0,
|
||||
},
|
||||
npcFarProximity: 100,
|
||||
npcMediumProximity: 40,
|
||||
@@ -145,6 +143,58 @@ let serverConfig = {
|
||||
vehicleLightsKey: SDLK_k,
|
||||
vehicleLocksKey: SDLK_l,
|
||||
},
|
||||
discordBotToken: "",
|
||||
discordEnabled: false,
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
function loadServerConfig() {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let dbQueryString = `SELECT * FROM svr_main WHERE svr_game = ${server.game} AND svr_port = ${server.port} LIMIT 1;`;
|
||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||
if(dbQuery) {
|
||||
if(dbQuery.numRows > 0) {
|
||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||
|
||||
serverId = dbAssoc["svr_id"];
|
||||
serverConfig.name = dbAssoc["svr_name"];
|
||||
serverConfig.password = dbAssoc["svr_password"];
|
||||
serverConfig.newCharacter.spawnPosition = new Vec3(dbAssoc["svr_newchar_pos_x"], dbAssoc["svr_newchar_pos_y"], dbAssoc["svr_newchar_pos_z"]);
|
||||
serverConfig.newCharacter.spawnHeading = dbAssoc["svr_newchar_rot_z"];
|
||||
serverConfig.newCharacter.money = dbAssoc["svr_newchar_money"];
|
||||
serverConfig.newCharacter.bank = dbAssoc["svr_newchar_bank"];
|
||||
serverConfig.newCharacter.skin = dbAssoc["svr_newchar_skin"];
|
||||
|
||||
serverConfig.connectCameraPosition = new Vec3(dbAssoc["svr_connectcam_pos_x"], dbAssoc["svr_connectcam_pos_y"], dbAssoc["svr_connectcam_pos_z"]);
|
||||
serverConfig.connectCameraLookAt = new Vec3(dbAssoc["svr_connectcam_lookat_x"], dbAssoc["svr_connectcam_lookat_y"], dbAssoc["svr_connectcam_lookat_z"]);
|
||||
serverConfig.hour = dbAssoc["svr_start_time_hour"];
|
||||
serverConfig.minute = dbAssoc["svr_start_time_min"];
|
||||
serverConfig.weather = dbAssoc["svr_start_weather"];
|
||||
serverConfig.fallingSnow = intToBool(dbAssoc["svr_start_snow_falling"]);
|
||||
serverConfig.groundSnow = intToBool(dbAssoc["svr_start_snow_ground"]);
|
||||
serverConfig.useGUI = intToBool(dbAssoc["svr_gui"]);
|
||||
|
||||
applyConfigToServer();
|
||||
|
||||
freeDatabaseQuery(dbQuery);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
function applyConfigToServer() {
|
||||
server.name = serverConfig.name;
|
||||
server.password = serverConfig.password;
|
||||
gta.time.hour = serverConfig.hour;
|
||||
gta.time.minute = serverConfig.minute;
|
||||
gta.forceWeather(serverConfig.weather);
|
||||
|
||||
updateServerRules();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: const.js
|
||||
// DESC: Provides constants
|
||||
@@ -40,4 +40,26 @@ const AG_VEHOWNER_PLAYER = 1;
|
||||
const AG_VEHOWNER_JOB = 2;
|
||||
const AG_VEHOWNER_CLAN = 3;
|
||||
const AG_VEHOWNER_FACTION = 4;
|
||||
const AG_VEHOWNER_PUBLIC = 5;
|
||||
const AG_VEHOWNER_PUBLIC = 5;
|
||||
|
||||
// Business Owner Types
|
||||
const AG_BIZOWNER_NONE = 0;
|
||||
const AG_BIZOWNER_PLAYER = 1;
|
||||
const AG_BIZOWNER_JOB = 2;
|
||||
const AG_BIZOWNER_CLAN = 3;
|
||||
const AG_BIZOWNER_FACTION = 4;
|
||||
const AG_BIZOWNER_PUBLIC = 5;
|
||||
|
||||
// House Owner Types
|
||||
const AG_HOUSEOWNER_NONE = 0;
|
||||
const AG_HOUSEOWNER_PLAYER = 1;
|
||||
const AG_HOUSEOWNER_JOB = 2;
|
||||
const AG_HOUSEOWNER_CLAN = 3;
|
||||
const AG_HOUSEOWNER_FACTION = 4;
|
||||
const AG_HOUSEOWNER_PUBLIC = 5;
|
||||
|
||||
// Business Location Types
|
||||
const AG_BIZLOC_NONE = 0;
|
||||
const AG_BIZLOC_FUEL = 1;
|
||||
const AG_BIZLOC_DRIVETHRU = 2;
|
||||
const AG_BIZLOC_VENDMACHINE = 3;
|
||||
@@ -1,14 +1,14 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: core.js
|
||||
// DESC: Provides core data structures, function, and operations
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let serverId = server.game;
|
||||
let serverId = 0;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -260,16 +260,111 @@ let serverData = {
|
||||
},
|
||||
],
|
||||
[ // GTA VC
|
||||
|
||||
{
|
||||
position: new Vec3(399.77, -468.90, 11.73),
|
||||
heading: 0.0,
|
||||
blip: false,
|
||||
name: "Washington Beach",
|
||||
},
|
||||
{
|
||||
position: new Vec3(508.96, 512.07, 12.10),
|
||||
heading: 0.0,
|
||||
blip: false,
|
||||
name: "Vice Point",
|
||||
},
|
||||
{
|
||||
position: new Vec3(-657.43, 762.31, 11.59),
|
||||
heading: 0.0,
|
||||
blip: false,
|
||||
name: "Downtown",
|
||||
},
|
||||
{
|
||||
position: new Vec3(-885.08, -470.44, 13.11),
|
||||
heading: 0.0,
|
||||
blip: false,
|
||||
name: "Little Havana",
|
||||
},
|
||||
],
|
||||
[ // GTA SA
|
||||
|
||||
{
|
||||
position: new Vec3(1545.53, -1675.64, 13.561),
|
||||
heading: -1.575,
|
||||
blip: false,
|
||||
name: "Los Santos",
|
||||
},
|
||||
|
||||
],
|
||||
[ // GTA UG
|
||||
|
||||
],
|
||||
[ // GTA IV
|
||||
|
||||
{
|
||||
position: new Vec3(894.99, -357.39, 18.185),
|
||||
heading: 2.923,
|
||||
blip: false,
|
||||
name: "Broker",
|
||||
},
|
||||
{
|
||||
position: new Vec3(435.40, 1592.29, 17.353),
|
||||
heading: 3.087,
|
||||
blip: false,
|
||||
name: "South Bohan",
|
||||
},
|
||||
{
|
||||
position: new Vec3(974.93, 1870.45, 23.073),
|
||||
heading: -1.621,
|
||||
blip: false,
|
||||
name: "Northern Gardens",
|
||||
},
|
||||
{
|
||||
position: new Vec3(1233.25, -89.13, 28.034),
|
||||
heading: 1.568,
|
||||
blip: false,
|
||||
name: "South Slopes",
|
||||
},
|
||||
{
|
||||
position: new Vec3(50.12, 679.88, 15.316),
|
||||
heading: 1.569,
|
||||
blip: false,
|
||||
name: "Middle Park East",
|
||||
},
|
||||
{
|
||||
position: new Vec3(85.21, 1189.82, 14.755),
|
||||
heading: 3.127,
|
||||
blip: false,
|
||||
name: "East Holland",
|
||||
},
|
||||
{
|
||||
position: new Vec3(2170.87, 448.87, 6.085),
|
||||
heading: 1.501,
|
||||
blip: false,
|
||||
name: "Francis International Airport",
|
||||
},
|
||||
{
|
||||
position: new Vec3(213.12, -211.70, 10.752),
|
||||
heading: 0.200,
|
||||
blip: false,
|
||||
name: "Chinatown",
|
||||
},
|
||||
{
|
||||
position: new Vec3(-1714.95, 276.31, 22.134),
|
||||
heading: 1.127,
|
||||
blip: false,
|
||||
name: "Acter",
|
||||
},
|
||||
{
|
||||
position: new Vec3(-1220.73, -231.53, 3.024),
|
||||
heading: 2.210,
|
||||
blip: false,
|
||||
name: "Port Tudor",
|
||||
},
|
||||
{
|
||||
position: new Vec3(-927.66, 1263.63, 24.587),
|
||||
heading: -0.913,
|
||||
blip: false,
|
||||
name: "Leftwood",
|
||||
},
|
||||
]
|
||||
],
|
||||
fireStations: [
|
||||
@@ -304,8 +399,37 @@ let serverData = {
|
||||
|
||||
],
|
||||
[ // GTA IV
|
||||
|
||||
]
|
||||
{
|
||||
position: new Vec3(953.13, 95.90, 35.004),
|
||||
heading: 1.595,
|
||||
blip: false,
|
||||
name: "Broker",
|
||||
},
|
||||
{
|
||||
position: new Vec3(-271.02, 1542.15, 20.420),
|
||||
heading: -1.160,
|
||||
blip: false,
|
||||
name: "Northwood",
|
||||
},
|
||||
{
|
||||
position: new Vec3(1120.47, 1712.36, 10.534),
|
||||
heading: -0.682,
|
||||
blip: false,
|
||||
name: "Northern Gardens",
|
||||
},
|
||||
{
|
||||
position: new Vec3(2364.87, 166.83, 5.813),
|
||||
heading: 0.156,
|
||||
blip: false,
|
||||
name: "Francis International Airport",
|
||||
},
|
||||
{
|
||||
position: new Vec3(295.40, -336.88, 4.963),
|
||||
heading: 2.887,
|
||||
blip: false,
|
||||
name: "Chinatown",
|
||||
},
|
||||
]
|
||||
],
|
||||
hospitals: [
|
||||
false,
|
||||
@@ -339,7 +463,30 @@ let serverData = {
|
||||
|
||||
],
|
||||
[ // GTA IV
|
||||
|
||||
{
|
||||
position: new Vec3(1199.59, 196.78, 33.554),
|
||||
heading: 1.633,
|
||||
blip: false,
|
||||
name: "Schottler",
|
||||
},
|
||||
{
|
||||
position: new Vec3(980.71, 1831.61, 23.898),
|
||||
heading: -0.049,
|
||||
blip: false,
|
||||
name: "Northern Gardens",
|
||||
},
|
||||
{
|
||||
position: new Vec3(-1317.27, 1277.20, 22.370),
|
||||
heading: 2.246,
|
||||
blip: false,
|
||||
name: "Leftwood",
|
||||
},
|
||||
{
|
||||
position: new Vec3(-1538.43, 344.58, 20.943),
|
||||
heading: -0.156,
|
||||
blip: false,
|
||||
name: "Acter",
|
||||
},
|
||||
]
|
||||
],
|
||||
payAndSprays: [
|
||||
@@ -737,4 +884,11 @@ function getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
function getServerGame() {
|
||||
return server.game;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: database.js
|
||||
// DESC: Provides database handling, functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: developer.js
|
||||
// DESC: Provides developer operation, commands, functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: discord.js
|
||||
// DESC: Provides discord bridging and connection functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: event.js
|
||||
// DESC: Provides handlers for built in GTAC and Asshat-Gaming created events
|
||||
@@ -10,24 +10,25 @@
|
||||
|
||||
addEventHandler("OnPlayerJoined", function(event, client) {
|
||||
setTimeout(function() {
|
||||
triggerNetworkEvent("ag.connectCamera", client, serverConfig.connectCameraPosition[getServerGame()], serverConfig.connectCameraLookAt[getServerGame()]);
|
||||
initClient(client);
|
||||
//triggerNetworkEvent("ag.connectCamera", client, serverConfig.connectCameraPosition[getServerGame()], serverConfig.connectCameraLookAt[getServerGame()]);
|
||||
|
||||
client.setData("ag.loginAttemptsRemaining", 3, false);
|
||||
//client.setData("ag.loginAttemptsRemaining", 3, false);
|
||||
|
||||
let tempAccountData = loadAccountFromName(client.name);
|
||||
let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId);
|
||||
//let tempAccountData = loadAccountFromName(client.name);
|
||||
//let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId);
|
||||
|
||||
serverData.clients[client.index] = new serverClasses.clientData(client, tempAccountData, tempSubAccounts);
|
||||
//serverData.clients[client.index] = new serverClasses.clientData(client, tempAccountData, tempSubAccounts);
|
||||
|
||||
sendAllBlips(client);
|
||||
//sendAllBlips(client);
|
||||
|
||||
if(tempAccountData != false) {
|
||||
triggerNetworkEvent("ag.showLogin", client);
|
||||
//messageClient("Welcome back to Asshat Gaming RP, " + String(client.name) + "! Please /login to continue.", client, serverConfig.colour.byName["white"]);
|
||||
} else {
|
||||
triggerNetworkEvent("ag.showRegistration", client);
|
||||
//messageClient("Welcome to Asshat Gaming RP, " + String(client.name) + "! Please /register to continue.", client, serverConfig.colour.byName["white"]);
|
||||
}
|
||||
//if(tempAccountData != false) {
|
||||
// triggerNetworkEvent("ag.showLogin", client);
|
||||
// //messageClient("Welcome back to Asshat Gaming RP, " + String(client.name) + "! Please /login to continue.", client, serverConfig.colour.byName["white"]);
|
||||
//} else {
|
||||
// triggerNetworkEvent("ag.showRegistration", client);
|
||||
// //messageClient("Welcome to Asshat Gaming RP, " + String(client.name) + "! Please /register to continue.", client, serverConfig.colour.byName["white"]);
|
||||
//}
|
||||
}, 500);
|
||||
});
|
||||
|
||||
@@ -52,9 +53,17 @@ addEventHandler("OnPedSpawn", function(event, ped) {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
addEventHandler("OnPedWasted", function(event, wastedPed, killerPed, weaponId, pedPiece) {
|
||||
let closestHospital = getClosestHospital(wastedPed.position);
|
||||
let client = getClientFromPedElement(wastedPed);
|
||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getClientCurrentSubAccount(client).skin);
|
||||
if(ped.isType(ELEMENT_PLAYER)) {
|
||||
let closestHospital = getClosestHospital(wastedPed.position);
|
||||
let client = getClientFromPedElement(wastedPed);
|
||||
client.despawnPlayer();
|
||||
if(getClientCurrentSubAccount(client).inJail) {
|
||||
let closestJail = getClosestJail(wastedPed.position);
|
||||
spawnPlayer(client, closestJail.position, closestJail.heading, getClientCurrentSubAccount(client).skin);
|
||||
} else {
|
||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getClientCurrentSubAccount(client).skin);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -68,13 +77,7 @@ bindEventHandler("OnResourceStop", thisResource, function(event, resource) {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
bindEventHandler("OnResourceStart", thisResource, function(event, resource) {
|
||||
getClients().forEach(function(client) {
|
||||
initClient(client);
|
||||
});
|
||||
|
||||
//createAllLocationBlips();
|
||||
|
||||
|
||||
//initAllClients();
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: faction.js
|
||||
// DESC: Provides faction functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: help.js
|
||||
// DESC: Provides update info, help commands, and documentation
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: house.js
|
||||
// DESC: Provides house commands, functions, and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: item.js
|
||||
// DESC: Provides item functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: job.js
|
||||
// DESC: Provides job functions and usage
|
||||
@@ -75,7 +75,7 @@ function sendAllJobSpheres() {
|
||||
|
||||
function createAllJobPickups() {
|
||||
for(let i in serverData.jobs[getServerGame()]) {
|
||||
serverData.jobs[getServerGame()][i].pickup = createPickup(serverData.jobs[getServerGame()][i].pickupModel, serverData.jobs[getServerGame()][i].position);
|
||||
serverData.jobs[getServerGame()][i].pickup = gta.createPickup(serverData.jobs[getServerGame()][i].pickupModel, serverData.jobs[getServerGame()][i].position);
|
||||
|
||||
serverData.jobs[getServerGame()][i].pickup.setData("ag.ownerType", AG_PICKUP_JOB, true);
|
||||
serverData.jobs[getServerGame()][i].pickup.setData("ag.ownerId", i, true);
|
||||
@@ -323,7 +323,7 @@ function startWorking(client) {
|
||||
getClientCurrentSubAccount(client).isWorking = true;
|
||||
|
||||
let jobId = getClientCurrentSubAccount(client).job;
|
||||
switch(serverData.jobs[getServerGame()][jobId].jobType) {
|
||||
switch(getJobType(jobId)) {
|
||||
case AG_JOB_POLICE:
|
||||
messageClientInfo(client, "Use /uniform and /equip to get your equipment.");
|
||||
break;
|
||||
@@ -370,7 +370,7 @@ function stopWorking(client) {
|
||||
|
||||
getClientCurrentSubAccount(client).isWorking = false;
|
||||
|
||||
triggerNetworkEvent("ag.skin", null, client.player, getClientCurrentSubAccount(client).skin);
|
||||
triggerNetworkEvent("ag.skin", client, getClientCurrentSubAccount(client).skin);
|
||||
|
||||
let jobVehicle = getClientCurrentSubAccount(client).lastJobVehicle;
|
||||
if(jobVehicle) {
|
||||
@@ -394,7 +394,7 @@ function stopWorking(client) {
|
||||
triggerNetworkEvent("ag.clearWeapons", client);
|
||||
|
||||
let jobId = getClientCurrentSubAccount(client).job;
|
||||
switch(serverData.jobs[getServerGame()][jobId].jobType) {
|
||||
switch(getJobType(jobId)) {
|
||||
case AG_JOB_POLICE:
|
||||
messageClientInfo(client, "Your uniform, equipment, and police car have been returned to the police station");
|
||||
break;
|
||||
@@ -456,41 +456,41 @@ function jobUniformCommand(command, params, client) {
|
||||
|
||||
let jobId = getClientCurrentSubAccount(client).job;
|
||||
getClientCurrentSubAccount(client).jobUniform = uniformId-1;
|
||||
|
||||
switch(serverData.jobs[getServerGame()][jobId].jobType) {
|
||||
|
||||
switch(getJobType(jobId)) {
|
||||
case AG_JOB_POLICE:
|
||||
triggerNetworkEvent("ag.skin", null, client.player, serverData.policeJobSkins[getServerGame()][uniformId-1]);
|
||||
triggerNetworkEvent("ag.skin", client, serverData.policeJobSkins[getServerGame()][uniformId-1]);
|
||||
//client.player.modelIndex = serverData.policeJobSkins[getServerGame()][uniformId];
|
||||
triggerNetworkEvent("ag.giveWeapon", client, 2, 200, false);
|
||||
triggerNetworkEvent("ag.giveWeapon", client, 1, 1, false);
|
||||
break;
|
||||
|
||||
case AG_JOB_MEDICAL:
|
||||
triggerNetworkEvent("ag.skin", null, client.player, serverData.medicalJobSkins[getServerGame()][uniformId-1]);
|
||||
triggerNetworkEvent("ag.skin", client, serverData.medicalJobSkins[getServerGame()][uniformId-1]);
|
||||
//client.player.modelIndex = serverData.medicalJobSkins[getServerGame()][uniformId];
|
||||
messageClientInfo(client, "Your uniform and ambulance have been returned to the hospital");
|
||||
break;
|
||||
|
||||
case AG_JOB_FIRE:
|
||||
triggerNetworkEvent("ag.skin", null, client.player, serverData.fireJobSkins[getServerGame()][uniformId-1]);
|
||||
triggerNetworkEvent("ag.skin", client, serverData.fireJobSkins[getServerGame()][uniformId-1]);
|
||||
//client.player.modelIndex = serverData.fireJobSkins[getServerGame()][uniformId];
|
||||
messageClientInfo(client, "Your uniform and fire truck have been returned to the fire station");
|
||||
break;
|
||||
|
||||
case AG_JOB_BUS:
|
||||
triggerNetworkEvent("ag.skin", null, client.player, serverData.busJobSkins[getServerGame()][uniformId-1]);
|
||||
triggerNetworkEvent("ag.skin", client, serverData.busJobSkins[getServerGame()][uniformId-1]);
|
||||
//client.player.modelIndex = serverData.busJobSkins[getServerGame()][uniformId];
|
||||
messageClientInfo(client, "Your bus has been returned to the bus depot");
|
||||
break;
|
||||
|
||||
case AG_JOB_TAXI:
|
||||
triggerNetworkEvent("ag.skin", null, client.player, serverData.taxiJobSkins[getServerGame()][uniformId-1]);
|
||||
triggerNetworkEvent("ag.skin", client, serverData.taxiJobSkins[getServerGame()][uniformId-1]);
|
||||
//client.player.modelIndex = serverData.taxiJobSkins[getServerGame()][uniformId];
|
||||
messageClientInfo(client, "Your taxi has been returned to the taxi depot");
|
||||
break;
|
||||
|
||||
case AG_JOB_GARBAGE:
|
||||
triggerNetworkEvent("ag.skin", null, client.player, serverData.garbageJobSkins[getServerGame()][uniformId-1]);
|
||||
triggerNetworkEvent("ag.skin", client, serverData.garbageJobSkins[getServerGame()][uniformId-1]);
|
||||
//client.player.modelIndex = serverData.garbageJobSkins[getServerGame()][uniformId];
|
||||
messageClientInfo(client, "Your trash truck has been returned to the city landfill");
|
||||
break;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: bus.js
|
||||
// DESC: Provides bus driver job functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: drug.js
|
||||
// DESC: Provides drug runner/dealer job functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: fire.js
|
||||
// DESC: Provides firefighter job functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: garbage.js
|
||||
// DESC: Provides garbage collector job functions and usage
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: medic.js
|
||||
// DESC: Provides medic job functions and usage
|
||||
// DESC: Provides paramedic job functions and usage
|
||||
// TYPE: Job (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: police.js
|
||||
// DESC: Provides police officer job functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: taxi.js
|
||||
// DESC: Provides taxi driver job functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2019 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: weapon.js
|
||||
// DESC: Provides weapons dealer job functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: locale.js
|
||||
// DESC: Provides locale structures, functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: messaging.js
|
||||
// DESC: Provides messaging functions and usage
|
||||
@@ -10,11 +10,28 @@
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function messageAdminAction(messageText) {
|
||||
message(`⚠️ ${messageText}`, getColourByName("orange"));
|
||||
messageDiscord(`:warning: ${messageText}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function messageClientNormal(client, messageText, colour = COLOUR_WHITE) {
|
||||
if(client instanceof Client) {
|
||||
messageClient(`${messageText}`, client, colour);
|
||||
} else {
|
||||
messageDiscordUser(client, `:no_entry_sign: ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function messageClientError(client, messageText) {
|
||||
if(client instanceof Client) {
|
||||
messageClientNormal(client, `🚫 ${messageText}`, getColourByType("errorMessage"));
|
||||
} else {
|
||||
messageDiscordUser(client, `🚫 ${messageText}`);
|
||||
messageDiscordUser(client, `:no_entry_sign: ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +41,7 @@ function messageClientSyntax(client, messageText) {
|
||||
if(client instanceof Client) {
|
||||
messageClientNormal(client, `⌨️ [#FFFFFF] ${messageText}`, getColourByType("syntaxMessage"));
|
||||
} else {
|
||||
messageDiscordUser(client, `⌨️ ${messageText}`);
|
||||
messageDiscordUser(client, `:keyboard: ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +51,7 @@ function messageClientAlert(client, messageText) {
|
||||
if(client instanceof Client) {
|
||||
messageClientNormal(client, `⚠️ [#FFFFFF] ${messageText}`, getColourByType("alertMessage"));
|
||||
} else {
|
||||
messageDiscordUser(client, `⚠️ ${messageText}`);
|
||||
messageDiscordUser(client, `:warning: ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +61,7 @@ function messageClientSuccess(client, messageText) {
|
||||
if(client instanceof Client) {
|
||||
messageClientNormal(client, `👍 [#FFFFFF] ${messageText}`, getColourByType("successMessage"));
|
||||
} else {
|
||||
messageDiscordUser(client, `👍 ${messageText}`);
|
||||
messageDiscordUser(client, `:thumbsup: ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +71,7 @@ function messageClientInfo(client, messageText) {
|
||||
if(client instanceof Client) {
|
||||
messageClientNormal(client, `ℹ️ [#FFFFFF] ${messageText}`, getColourByType("successMessage"));
|
||||
} else {
|
||||
messageDiscordUser(client, `ℹ️ ${messageText}`);
|
||||
messageDiscordUser(client, `:information_source: ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,169 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: misc.js
|
||||
// DESC: Provides any uncategorized functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// FUCK
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function initBusinessScript() {
|
||||
console.log("[Asshat.Misc]: Initializing misc script ...");
|
||||
addMiscCommandHandlers();
|
||||
console.log("[Asshat.Misc]: Misc script initialized successfully!");
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function addMiscCommandHandlers() {
|
||||
console.log("[Asshat.Misc]: Adding misc commands!");
|
||||
let businessCommands = serverCommands.misc;
|
||||
for(let i in businessCommands) {
|
||||
addCommandHandler(businessCommands[i].command, businessCommands[i].handlerFunction);
|
||||
}
|
||||
console.log("[Asshat.Misc]: Misc commands added!");
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function setTimeCommand(command, params, client) {
|
||||
if(getCommand(command).requireLogin) {
|
||||
if(!isClientLoggedIn(client)) {
|
||||
messageClientError(client, "You must be logged in to use this command!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||
messageClientError(client, "You do not have permission to use this command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
messageClientSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split();
|
||||
let hour = Number(splitParams[0]) || 0;
|
||||
let minute = Number(splitParams[1]) || 0;
|
||||
|
||||
if(hour > 23 || hour < 0) {
|
||||
messageClientError(client, "The hour must be between 0 and 23!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(minute > 59 || minute < 0) {
|
||||
messageClientError(client, "The minute must be between 0 and 59!");
|
||||
return false;
|
||||
}
|
||||
|
||||
gta.time.hour = hour;
|
||||
gta.time.minute = minute;
|
||||
|
||||
messageAdminAction(`${client.name} set the time to ${makeReadableTime(hour, minute)}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function setWeatherCommand(command, params, client) {
|
||||
if(getCommand(command).requireLogin) {
|
||||
if(!isClientLoggedIn(client)) {
|
||||
messageClientError(client, "You must be logged in to use this command!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||
messageClientError(client, "You do not have permission to use this command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
messageClientSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split();
|
||||
let weatherId = getWeatherFromParams(splitParams[0]);
|
||||
|
||||
if(!weatherId) {
|
||||
messageClientError(client, `That weather ID or name is invalid!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
gta.forceWeather(weatherId);
|
||||
|
||||
messageAdminAction(`${client.name} set the weather to to ${weatherNames[server.game][weatherId]}`);
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function setSnowingCommand(command, params, client) {
|
||||
if(getCommand(command).requireLogin) {
|
||||
if(!isClientLoggedIn(client)) {
|
||||
messageClientError(client, "You must be logged in to use this command!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||
messageClientError(client, "You do not have permission to use this command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
messageClientSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split();
|
||||
let fallingSnow = Number(splitParams[0]) || 0;
|
||||
let groundSnow = Number(splitParams[1]) || 0;
|
||||
|
||||
serverConfig.fallingSnow = 0;
|
||||
|
||||
messageAdminAction(`${client.name} turned falling snow ${getOnOffFromBool(intToBool(fallingSnow))} and ground snow ${getOnOffFromBool(intToBool(groundSnow))}`);
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function toggleServerLogoCommand(command, params, client) {
|
||||
if(getCommand(command).requireLogin) {
|
||||
if(!isClientLoggedIn(client)) {
|
||||
messageClientError(client, "You must be logged in to use this command!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||
messageClientError(client, "You do not have permission to use this command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
messageClientSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split();
|
||||
let logoState = Number(splitParams[0]) || 1;
|
||||
|
||||
serverConfig.useLogo = !!logoState;
|
||||
|
||||
messageAdminAction(`${client.name} turned the server logo image ${getOnOffFromBool(intToBool(fallingSnow))}`);
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: moderation.js
|
||||
// DESC: Provides moderation commands, functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: native.js
|
||||
// DESC: Provides util function to wrap mod-specific stuff
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: npc.js
|
||||
// DESC: Provides NPC usage and functions
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// ===========================================================================
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: biker.js
|
||||
// DESC: Provides biker NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -0,0 +1,9 @@
|
||||
// ===========================================================================
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: drugdealer.js
|
||||
// DESC: Provides drug dealer NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -0,0 +1,9 @@
|
||||
// ===========================================================================
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: firefighter.js
|
||||
// DESC: Provides firefighter NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -0,0 +1,9 @@
|
||||
// ===========================================================================
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: gangsta.js
|
||||
// DESC: Provides street gang/hoodlum NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -0,0 +1,9 @@
|
||||
// ===========================================================================
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: mafia.js
|
||||
// DESC: Provides mafia/mafioso NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -0,0 +1,9 @@
|
||||
// ===========================================================================
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: normal.js
|
||||
// DESC: Provides normal/generic civilian NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -0,0 +1,9 @@
|
||||
// ===========================================================================
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: paramedic.js
|
||||
// DESC: Provides paramedic NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -0,0 +1,9 @@
|
||||
// ===========================================================================
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: police.js
|
||||
// DESC: Provides police officer NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: security.js
|
||||
// DESC: Provides security functions and usage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: startup.js
|
||||
// DESC: Provides startup/shutdown procedures
|
||||
@@ -9,6 +9,7 @@
|
||||
// ===========================================================================
|
||||
|
||||
function initServerScripts() {
|
||||
|
||||
checkForAllRequiredModules();
|
||||
|
||||
initClassScript();
|
||||
@@ -27,7 +28,13 @@ function initServerScripts() {
|
||||
initVehicleScript();
|
||||
initDeveloperScript();
|
||||
|
||||
serverData.saveDataIntervalTimer = setInterval(saveAllServerDataToDatabase, 600000);
|
||||
initTimers();
|
||||
|
||||
//gta.time.hour = serverConfig.startup.hour;
|
||||
//gta.time.minute = serverConfig.startup.minute;
|
||||
//gta.forceWeather(serverConfig.startup.weather);
|
||||
|
||||
initAllClients();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -52,26 +59,27 @@ function checkForMySQLModule() {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function checkForAllRequiredModules() {
|
||||
console.log("[AsshatRP.Startup]: Checking for required modules ...");
|
||||
console.log("[Asshat.Startup]: Checking for required modules ...");
|
||||
|
||||
if(!checkForHashingModule()) {
|
||||
console.warn("[AsshatRP.Startup]: Hashing module is not loaded!");
|
||||
console.warn("[AsshatRP.Startup]: This resource will now shutdown.");
|
||||
console.warn("[Asshat.Startup]: Hashing module is not loaded!");
|
||||
console.warn("[Asshat.Startup]: This resource will now shutdown.");
|
||||
thisResource.stop();
|
||||
}
|
||||
|
||||
if(!checkForMySQLModule()) {
|
||||
console.warn("[AsshatRP.Startup]: MySQL module is not loaded!");
|
||||
console.warn("[AsshatRP.Startup]: This resource will now shutdown.");
|
||||
console.warn("[Asshat.Startup]: MySQL module is not loaded!");
|
||||
console.warn("[Asshat.Startup]: This resource will now shutdown.");
|
||||
thisResource.stop();
|
||||
}
|
||||
|
||||
console.log("[AsshatRP.Startup]: All required modules loaded!");
|
||||
console.log("[Asshat.Startup]: All required modules loaded!");
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
loadServerConfig();
|
||||
initServerScripts();
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------
|
||||
36
scripts/server/timers.js
Normal file
36
scripts/server/timers.js
Normal file
@@ -0,0 +1,36 @@
|
||||
// ===========================================================================
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: timers.js
|
||||
// DESC: Provides timer functions and features
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let serverTimers = {};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function updateTimeRule() {
|
||||
server.setRule("Time", makeReadableTime(gta.time.hour, gta.time.minute));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function saveAllServerDataToDatabase() {
|
||||
console.log("[Asshat.Utilities]: Saving all server data to database ...");
|
||||
saveAllClientsToDatabase();
|
||||
saveAllVehiclesToDatabase();;
|
||||
saveAllHousesToDatabase();
|
||||
saveAllBusinessesToDatabase();
|
||||
saveAllClansToDatabase();
|
||||
console.log("[Asshat.Utilities]: Saved all server data to database!");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function initTimers() {
|
||||
serverTimers.saveDataIntervalTimer = setInterval(saveAllServerDataToDatabase, 600000);
|
||||
serverTimers.updateTimeRuleTimer = setInterval(updateTimeRule, 1000);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: translate.js
|
||||
// DESC: Provides translation functions
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: utilities.js
|
||||
// DESC: Provides util functions and arrays with data
|
||||
@@ -98,6 +98,18 @@ let gameData = {
|
||||
"Sandstorm",
|
||||
"Greenish/Foggy"
|
||||
],
|
||||
[ // GTA IV
|
||||
"Extra Sunny",
|
||||
"Sunny",
|
||||
"Sunny/Windy",
|
||||
"Cloudy",
|
||||
"Rain",
|
||||
"Light Rain",
|
||||
"Foggy",
|
||||
"Thunderstorm",
|
||||
"Extra Sunny",
|
||||
"Sunny/Windy",
|
||||
],
|
||||
],
|
||||
gameNames: [
|
||||
"Unknown",
|
||||
@@ -1972,6 +1984,354 @@ let gameData = {
|
||||
// More will be added soon!
|
||||
],
|
||||
],
|
||||
gtaivSkinModels: [
|
||||
//["Nico Bellic", 1862763509],
|
||||
["Male Multiplayer", -2020305438],
|
||||
["Female Multiplayer", -641875910],
|
||||
["MODEL_SUPERLOD", -1370810922],
|
||||
["Anna", 1853617247],
|
||||
["Anthony", -1646893330],
|
||||
["Badman", 1495769888],
|
||||
["Bernie Crane", 1500493064],
|
||||
["Bledar", 1731510984],
|
||||
["Brian", 422305098],
|
||||
["Brucie", -1729980128],
|
||||
["Bulgarin", 237511807],
|
||||
["Charise", 88667657],
|
||||
["Charlie Undercover", -1328445565],
|
||||
["Clarence", 1343144208],
|
||||
["Dardan", 1468450703],
|
||||
["Darko", 386513184],
|
||||
["Derric", 1169442297],
|
||||
["Dmitri", 237497537],
|
||||
["Dwayne", -617264103],
|
||||
["Eddie", -1600585231],
|
||||
["Faustin", 57218969],
|
||||
["Francis", 1710545037],
|
||||
["French Tom", 1424670436],
|
||||
["Gordon", 2129490787],
|
||||
["Gracie", -357652594],
|
||||
["Hossan", 980768434],
|
||||
["Ilyena", -835225126],
|
||||
["Issac", -479595866],
|
||||
["Ivan", 1166762483],
|
||||
["Jay", 364686627],
|
||||
["Jason", 170756246],
|
||||
["Jeff", 390357829],
|
||||
["Jimmy", -366421228],
|
||||
["Johnny Klebitz", -911507684],
|
||||
["Kate", -773750838],
|
||||
["Kenny", 995576506],
|
||||
["Lil Jacob", 1487004273],
|
||||
["Lil Jacob 2", -1275031987],
|
||||
["Luca", -681942840],
|
||||
["Luis", -492470690],
|
||||
["Mallorie", -1040287406],
|
||||
["Mam", -322700377],
|
||||
["Manny", 1445589009],
|
||||
["Marnie", 411185872],
|
||||
["Mel", -807339118],
|
||||
["Michael", 735211577],
|
||||
["Michelle", -1080659212],
|
||||
["Mickey", -636669566],
|
||||
["Packie", 1690783035],
|
||||
["Pathos", -165448092],
|
||||
["Petrovic", -1947682830],
|
||||
["Phil Bell", -1826458934],
|
||||
["Playboy X", 1794146792],
|
||||
["Ray Boccino", 954215094],
|
||||
["Ricky", -587324132],
|
||||
["Roman", -1992728631],
|
||||
["Roman 2", 558221221],
|
||||
["Sarah", -17823883],
|
||||
["Tuna", 1384833284],
|
||||
["Vinny Spaz", -1014976873],
|
||||
["Vlad", 896408642],
|
||||
["Black Street Thug 1", -301223260],
|
||||
["Black Street Thug 2", -1143910864],
|
||||
["Black Street OG 1", 869501081],
|
||||
["Black Street OG 1", 632613980],
|
||||
["Albanian Thug 1", -503930010],
|
||||
["Albanian Thug 2", -235584669],
|
||||
["Albanian Thug 3", 207714363],
|
||||
["Albanian Thug 4", 514268366],
|
||||
["Biker 1", 43005364],
|
||||
["Biker 2", 1346668127],
|
||||
["Biker 3", -1677255197],
|
||||
["Biker 4", -1461281345],
|
||||
["Biker 5", 1574850459],
|
||||
["Biker 6", -1953289472],
|
||||
["Irish Man 1", 280474699],
|
||||
["Irish Man 2", -19263344],
|
||||
["Irish Man 3", 1844702918],
|
||||
["Jamaican OG 1", 1609755055],
|
||||
["Jamaican OG 2", -330497431],
|
||||
["Jamaican OG 3", 1117105909],
|
||||
["Jamaican Thug 1", -1500397869],
|
||||
["Jamaican Thug 2", -881358690],
|
||||
["Asian Man 1", 1540383669],
|
||||
["Asian Man 2", 764249904],
|
||||
["Hispanic Man 1", 492147228],
|
||||
["Hispanic Man 2", -1926041127],
|
||||
["Hispanic Man 3", 1168388225],
|
||||
["Hispanic Man 4", -1746774780],
|
||||
["Fat Italian Mafia Boss", -302362397],
|
||||
["Italian Mafia Boss", -1616890832],
|
||||
["Italian Mafia Associate", 64730935],
|
||||
["Fat Italian Mafia Associate", 510389335],
|
||||
["Russian Thug 1", -1836006237],
|
||||
["Russian Thug 2", -2088164056],
|
||||
["Russian Thug 3", 1976502708],
|
||||
["Russian Thug 4", 1543404628],
|
||||
["Russian Thug 5", 1865532596],
|
||||
["Russian Thug 6", 431692232],
|
||||
["Russian Thug 7", 1724587620],
|
||||
["Russian Thug 8", -1180674815],
|
||||
["Triad Boss 1", 871281791],
|
||||
["Triad Boss 2", 683712035],
|
||||
["Triad Member 3", -1084007777],
|
||||
["Triad Member 4", -164935626],
|
||||
["Female Maid", -751071255],
|
||||
["Female Binco Worker", -109247258],
|
||||
["Female Bank Teller", 1366257926],
|
||||
["Female Doctor", 346338575],
|
||||
["Female Gym Worker", 1350216795],
|
||||
["Female Burger Shot Worker", 924926104],
|
||||
["Female Cluckin Bell Worker", -346378101],
|
||||
["Female Rockstar Cafe Worker", -2104311883],
|
||||
["Female TW@ Cafe Worker", 212900845],
|
||||
["Female Well Stacked Pizza Worker", -290070895],
|
||||
["Hooker", 552542187],
|
||||
["Hooker 2", 996267216],
|
||||
["Nurse", -1193778389],
|
||||
["Stripper 1", 1113677074],
|
||||
["Stripper 2", 1353709999],
|
||||
["Waitress", 24233425],
|
||||
["Alcoholic Man", -1761003415],
|
||||
["Armoured Truck Driver", 1075583233],
|
||||
["Bus Driver", 134077503],
|
||||
["Generic Asian Man", 757349871],
|
||||
["Black Crackhead", -1827421800],
|
||||
["Doctor (Scrubs)", 219393781],
|
||||
["Doctor", -1186940778],
|
||||
["Doctor (Blood Covered Coat)", 375732086],
|
||||
["Cook", 2105015949],
|
||||
["Italian Mob Enforcer", -200234085],
|
||||
["Factory Worker", 800131009],
|
||||
["FIB Agent", -999506922],
|
||||
["Fat Delivery Driver", -1993909080],
|
||||
["Fire Chief", 610888851],
|
||||
["Mercenary Soldier", 486302863],
|
||||
["Helicopter Pilot", -778316080],
|
||||
["Hotel Doorman", 624314380],
|
||||
["Korean Cook", -1784833142],
|
||||
["Lawyer 1", -1852976689],
|
||||
["Lawyer 2", -1134712978],
|
||||
["Loony Black Man", 379171768],
|
||||
["Pilot", -1945168882],
|
||||
["Generic Man", 807236245],
|
||||
["Postal Worker", -284362863],
|
||||
["Saxophone Player", -1188246269],
|
||||
["Security Guard", -1870989171],
|
||||
["Stadium Food Vendor", 420915580],
|
||||
["Stadium Food Cook", 1878085135],
|
||||
["Street Food Vendor", 142730876],
|
||||
["Street Sweeper Driver", -690681764],
|
||||
["Taxi Driver", 8772846],
|
||||
["Telephone Company Worker", 1186270890],
|
||||
["Tennis Player", -379234846],
|
||||
["Train Conductor", 1159759556],
|
||||
["Homeless Black Man", -142386662],
|
||||
["Trucker", -46564867],
|
||||
["Janitor", -1284047560],
|
||||
["Hotel Doorman 2", 22944263],
|
||||
["Mob Boss", 1178487645],
|
||||
["Airport Worker", -1464712858],
|
||||
["Bartender", -2139064254],
|
||||
["Biker Bouncer", -1780698891],
|
||||
["High End Club Bouncer", -409283472],
|
||||
["Bowling Alley Worker", -799229885],
|
||||
["Bowling Alley Worker 2", -434183225],
|
||||
["Chinese Food Vendor", 768442188],
|
||||
["Club Security", 676448572],
|
||||
["Construction Worker", -722019798],
|
||||
["Construction Worker 2", -1015957728],
|
||||
["Construction Worker 3", -714220780],
|
||||
["Police Officer", -183203150],
|
||||
["Traffic Officer", -1518937979],
|
||||
["Fat Police Officer", -370395528],
|
||||
["Courier", -1371133859],
|
||||
["Cowboy 1", -573788283],
|
||||
["Drug Dealer 1", -1283406538],
|
||||
["Drug Dealer 2", 1448755353],
|
||||
["Male Burger Shot Worker", 989485],
|
||||
["Male Cluckin Bell Worker", -1011530423],
|
||||
["Male Rockstar Cafe Worker", 1979561477],
|
||||
["Male TW@ Cafe Worker", -786449781],
|
||||
["Male Well Stacked Pizza Worker", 206941425],
|
||||
["Firefighter", -610224615],
|
||||
["Garbage Collector", 1136499716],
|
||||
["Goon", 897868981],
|
||||
["Male Gym Worker", -1902758612],
|
||||
["Mechanic 2", -356904519],
|
||||
["Male Modo Worker", -1056268969],
|
||||
["Helicopter Pilot", 1201610759],
|
||||
["Perseus", -151000142],
|
||||
["Generic Male 1", 501136335],
|
||||
["Generic Male 2", 186619473],
|
||||
["Generic Male 3", -111611196],
|
||||
["Paramedic", -1175077216],
|
||||
["Prisoner", -1676937780],
|
||||
["Prisoner 2", 215190023],
|
||||
["Roman's Taxi Service Driver", 1552970117],
|
||||
["Male Runner", -1481923910],
|
||||
["Male Shop Assistant 1", 357919731],
|
||||
["State Trooper", -89302119],
|
||||
["SWAT", -1004762946],
|
||||
["Sword Swallower", -64233032],
|
||||
["Thief", -1292254815],
|
||||
["Valet", 271284208],
|
||||
["Vendor", -186113957],
|
||||
["French Tom", -2015686009],
|
||||
["Jim Fitz", 1977784957],
|
||||
["East European Woman", -203833294],
|
||||
["East European Woman 2", 189853472],
|
||||
["Woman", -349043578],
|
||||
["Jersey Woman", -114937692],
|
||||
["Oriental Woman", -1697333660],
|
||||
["Rich Woman", 100706569],
|
||||
["Business Woman 1", 155063868],
|
||||
["Business Woman 2", 394310337],
|
||||
["Chinatown Woman", 1375728805],
|
||||
["Business Woman 3", -284229525],
|
||||
["East European Woman 3", 677687516],
|
||||
["Fat Black Woman", -1188238883],
|
||||
["Jersey Woman 1", -2075220936],
|
||||
["Jersey Woman 2", -1356924456],
|
||||
["Fat Hispanic Woman 1", 812112483],
|
||||
["Fat Hispanic Woman 2", -129242580],
|
||||
["White Manhattan Woman", 852423121],
|
||||
["Black Manhattan Woman", 76551508],
|
||||
["Old Asian Woman", -2118501976],
|
||||
["Old Rich Woman", 1616769823],
|
||||
["Business Woman 4", 453889158],
|
||||
["Asian Woman in Dress", 824245375],
|
||||
["Fat Black Bronx Woman", -1362442041],
|
||||
["Random White Woman", -1788328884],
|
||||
["Random Hispanic Woman", -1523915823],
|
||||
["Random Eastern European Woman", -949987237],
|
||||
["Random Black Woman", -1926577323],
|
||||
["Black Harlem Woman 1", 168065679],
|
||||
["Fat Jersey Woman 1", 441464],
|
||||
["Fat Hispanic Woman 3", 54114008],
|
||||
["Hispanic Woman 1", -292713088],
|
||||
["Hispanic Woman 2", 1743814728],
|
||||
["Manhattan Woman 1", 1670568326],
|
||||
["Manhattan Woman 2", 1354281938],
|
||||
["Manhattan Woman 1", 1056837725],
|
||||
["Asian Woman 1", -1193633577],
|
||||
["Black Woman 2", 713691120],
|
||||
["Rich White Woman 1", -1780385799],
|
||||
["Asian Woman", -952185135],
|
||||
["Female Shopper 1", 1586287288],
|
||||
["Female Shopper 2", 1848013291],
|
||||
["Female Shopper 3", -1702036227],
|
||||
["Female Socialite 1", 1182843182],
|
||||
["Street Woman 1", -900623157],
|
||||
["Street Woman 2", 286007875],
|
||||
["Street Woman 3", 1473654742],
|
||||
["Street Woman 4", -1850743775],
|
||||
["Street Woman 5", 1290755317],
|
||||
["Street Woman 6", 1872110126],
|
||||
["Tourist Woman 1", 1754440500],
|
||||
["MODEL_F_Y_VILLBO_01", 761763258],
|
||||
["Business Man 1", -636579119],
|
||||
["Business Man 2", -1754526315],
|
||||
["Street Criminal 1", -1516474414],
|
||||
["Street Criminal 2", -1821258883],
|
||||
["Obese Mafia Thug", 1952671026],
|
||||
["Gay Man 1", -1991603022],
|
||||
["Homeless Bum 1", -1080673049],
|
||||
["Loony White Man 1", 495499562],
|
||||
["MODEL_M_M_MIDTOWN_01", -1984134881],
|
||||
["Business Man 2", 1063816580],
|
||||
["Eastern European Man 1", 208763854],
|
||||
["Fat Black Man 2", -1020237172],
|
||||
["MODEL_M_M_PINDUS_02", 1782277836],
|
||||
["Fat Italian Man 1", -1402442039],
|
||||
["Italian Man 2", -1628417063],
|
||||
["Hispanic Man 1", 1158569407],
|
||||
["Hispanic Man 2", 1969438324],
|
||||
["Hispanic Man 3", 1621955848],
|
||||
["Tourist Man 1", -657489059],
|
||||
["Black Business Man 1", -1307068958],
|
||||
["Asian Man 3", 734334931],
|
||||
["MODEL_M_M_PRICH_01", 1865082075],
|
||||
["MODEL_M_O_EASTEURO_01", -432593815],
|
||||
["Hasidic Jewish Man 1", -1639359785],
|
||||
["Old Man 1", 1656087115],
|
||||
["MODEL_M_O_PEASTEURO_02", 2034185905],
|
||||
["MODEL_M_O_PHARBRON_01", 1316404726],
|
||||
["MODEL_M_O_PJERSEY_01", 980990533],
|
||||
["MODEL_M_O_STREET_01", -1298691925],
|
||||
["Old Business Man", 243672348],
|
||||
["MODEL_M_Y_BOHO_01", 2085884255],
|
||||
["MODEL_M_Y_BOHOGUY_01", 221246143],
|
||||
["MODEL_M_Y_BRONX_01", 52357603],
|
||||
["Black Business Man 2", 1530937394],
|
||||
["Black Business Man 3", 690281432],
|
||||
["Asian Man 4", -1149743642],
|
||||
["Chopshop Mechanic 1", -314369597],
|
||||
["Chopshop Mechanic 2", -552829610],
|
||||
["MODEL_M_Y_DODGY_01", -1097188138],
|
||||
["MODEL_M_Y_DORK_02", -1775659292],
|
||||
["MODEL_M_Y_DOWNTOWN_01", 1207402441],
|
||||
["MODEL_M_Y_DOWNTOWN_02", 1500619449],
|
||||
["MODEL_M_Y_DOWNTOWN_03", 594261682],
|
||||
["MODEL_M_Y_GAYYOUNG", -747824291],
|
||||
["MODEL_M_Y_GENSTREET_11", -677160979],
|
||||
["MODEL_M_Y_GENSTREET_16", -1678614360],
|
||||
["MODEL_M_Y_GENSTREET_20", 989044076],
|
||||
["MODEL_M_Y_GENSTREET_34", 1180218190],
|
||||
["MODEL_M_Y_HARDMAN_01", -1420592428],
|
||||
["MODEL_M_Y_HARLEM_01", -1222963415],
|
||||
["MODEL_M_Y_HARLEM_02", -1746153269],
|
||||
["MODEL_M_Y_HARLEM_04", 2104499156],
|
||||
["Hasidic Jewish Man 2", -1874580889],
|
||||
["MODEL_M_Y_LEASTSIDE_01", -1055386282],
|
||||
["MODEL_M_Y_PBRONX_01", 575808580],
|
||||
["MODEL_M_Y_PCOOL_01", -71980543],
|
||||
["MODEL_M_Y_PCOOL_02", -195159218],
|
||||
["MODEL_M_Y_PEASTEURO_01", 697247370],
|
||||
["MODEL_M_Y_PHARBRON_01", 670406267],
|
||||
["MODEL_M_Y_PHARLEM_01", 26615298],
|
||||
["MODEL_M_Y_PJERSEY_01", 1542927558],
|
||||
["MODEL_M_Y_PLATIN_01", -1806886352],
|
||||
["MODEL_M_Y_PLATIN_02", -1022920796],
|
||||
["MODEL_M_Y_PLATIN_03", -1326394505],
|
||||
["MODEL_M_Y_PMANHAT_01", 607901190],
|
||||
["MODEL_M_Y_PMANHAT_02", 1968470106],
|
||||
["MODEL_M_Y_PORIENT_01", -344136289],
|
||||
["MODEL_M_Y_PQUEENS_01", 560413584],
|
||||
["MODEL_M_Y_PRICH_01", 1352017873],
|
||||
["MODEL_M_Y_PVILLBO_01", 223726252],
|
||||
["MODEL_M_Y_PVILLBO_02", -1252681043],
|
||||
["MODEL_M_Y_PVILLBO_03", -1562020391],
|
||||
["MODEL_M_Y_QUEENSBRIDGE", 1223224881],
|
||||
["MODEL_M_Y_SHADY_02", -1220737489],
|
||||
["MODEL_M_Y_SKATEBIKE_01", 1755322862],
|
||||
["MODEL_M_Y_SOHO_01", 386690478],
|
||||
["MODEL_M_Y_STREET_01", 62496225],
|
||||
["MODEL_M_Y_STREET_03", 523785438],
|
||||
["MODEL_M_Y_STREET_04", 813889395],
|
||||
["MODEL_M_Y_STREETBLK_02", -1552214124],
|
||||
["MODEL_M_Y_STREETBLK_03", -650575089],
|
||||
["Street Punk 1", -740078918],
|
||||
["Street Punk 2", -1927496394],
|
||||
["Street Punk 3", 1374242512],
|
||||
["Tough Guy", -1139941790],
|
||||
["Male Tourist", 809067472],
|
||||
],
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -3281,6 +3641,7 @@ function sendAllPayAndSprayBlips(client) {
|
||||
|
||||
function sendAllFuelStationBlips(client) {
|
||||
if(serverConfig.blipSprites[getServerGame()].fuelStation != -1) {
|
||||
let tempBlips = [];
|
||||
for(let i in serverData.fuelStations[getServerGame()]) {
|
||||
tempBlips.push([
|
||||
serverConfig.blipSprites[getServerGame()].fuelStation,
|
||||
@@ -3359,15 +3720,7 @@ function canClientUseGuns(client) {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function saveAllServerDataToDatabase() {
|
||||
console.log("[Asshat.Utilities]: Saving all server data to database ...");
|
||||
saveAllClientsToDatabase();
|
||||
saveAllVehiclesToDatabase();;
|
||||
saveAllHousesToDatabase();
|
||||
saveAllBusinessesToDatabase();
|
||||
saveAllClansToDatabase();
|
||||
console.log("[Asshat.Utilities]: Saved all server data to database!");
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -3458,7 +3811,7 @@ function processHoldVehicleEngineKey(client) {
|
||||
|
||||
function getClientChatColour(client) {
|
||||
let tempJob = getClientCurrentSubAccount(client).job;
|
||||
if(job != -1) {
|
||||
if(tempJob != -1) {
|
||||
if(getClientData(client).isWorking) {
|
||||
return getJobData(tempJob).jobColour;
|
||||
}
|
||||
@@ -3466,4 +3819,67 @@ function getClientChatColour(client) {
|
||||
return getColourByName("white");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function showConnectCameraToPlayer(client) {
|
||||
triggerNetworkEvent("ag.connectCamera", client, serverConfig.connectCameraPosition, serverConfig.connectCameraLookAt);
|
||||
//triggerNetworkEvent("ag.showCharacterSelect", client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.placeOfOrigin, tempSubAccount.dateOfBirth, tempSubAccount.skin);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function initAllClients() {
|
||||
getClients().forEach(function(client) {
|
||||
initClient(client);
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function getYesNoFromBool(boolVal) {
|
||||
return (boolVal) ? "Yes" : "No";
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function updateServerRules() {
|
||||
server.setRule("Time", makeReadableTime(serverConfig.hour, serverConfig.minute));
|
||||
server.setRule("Weather", gameData.weatherNames[server.game][serverConfig.weather]);
|
||||
server.setRule("Snowing", getYesNoFromBool(serverConfig.fallingSnow));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function getWeatherFromParams(params) {
|
||||
if(isNaN(params)) {
|
||||
for(let i in weatherNames[server.game]) {
|
||||
if(weatherNames[server.game][i].toLowerCase().indexOf(params.toLowerCase()) != -1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
if(typeof weatherNames[server.game][i] != "undefined") {
|
||||
return i;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function updatePlayerCash(client) {
|
||||
triggerNetworkEvent("ag.money", getClientCurrentSubAccount(client).cash);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function clearChatBox(client) {
|
||||
//gta.messages.clear();
|
||||
for(let i = 0; i <= 20; i++) {
|
||||
messageClient(" ", client, COLOUR_WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -1,7 +1,7 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming RP
|
||||
// http://asshatgaming.com
|
||||
// © 2020 Asshat Gaming
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// FILE: vehicle.js
|
||||
// DESC: Provides vehicle functions and usage
|
||||
@@ -38,7 +38,7 @@ function loadVehiclesFromDatabase() {
|
||||
let tempVehicles = [];
|
||||
let dbAssoc;
|
||||
if(dbConnection) {
|
||||
let dbQueryString = `SELECT * FROM veh_main WHERE veh_server = ${serverId}`;
|
||||
let dbQueryString = `SELECT * FROM veh_main WHERE veh_server = ${serverId} AND veh_deleted = 0`;
|
||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||
if(dbQuery) {
|
||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||
@@ -75,25 +75,12 @@ function saveVehicleToDatabase(vehicleData) {
|
||||
if(dbConnection) {
|
||||
// If vehicle hasn't been added to database, ID will be 0
|
||||
if(vehicleData.databaseId == 0) {
|
||||
//let dbQueryColourFields = "`veh_col1_id`, `veh_col2_id`, `veh_col3_id1, `veh_col4_id`";
|
||||
//if(vehicleData.colourType == AH_VEH_COLOURTYPE_RGBA) {
|
||||
// dbQueryColourFields = "`veh_col1_rgba`, `veh_col2_rgba`, `veh_col3_rgba`, `veh_col4_rgba`";
|
||||
// dbQueryColourValues = vehicleData.colour1Red, `veh_col1_g`, `veh_col1_b`, `veh_col1_a`, `veh_col2_r`, `veh_col2_g`, `veh_col2_b`, `veh_col2_a`, `veh_col3_r`, `veh_col3_g`, `veh_col3_b`, `veh_col3_a`, `veh_col4_r`, `veh_col4_g`, `veh_col4_b`, `veh_col4_a`,";
|
||||
//}
|
||||
let dbQueryString = `INSERT INTO veh_main (veh_model, veh_pos_x, veh_pos_y, veh_pos_z, veh_rot_z, veh_owner_type, veh_owner_id) VALUES (${vehicleData.model}, ${vehicleData.spawnPosition.x}, ${vehicleData.spawnPosition.y}, ${vehicleData.spawnPosition.z}, ${vehicleData.spawnRotation}, ${vehicleData.ownerType}, ${vehicleData.ownerId})`;
|
||||
let dbQueryString = `INSERT INTO veh_main (veh_model, veh_pos_x, veh_pos_y, veh_pos_z, veh_rot_z, veh_owner_type, veh_owner_id, veh_col1, veh_col2, veh_col3, veh_col4, veh_server) VALUES (${vehicleData.model}, ${vehicleData.spawnPosition.x}, ${vehicleData.spawnPosition.y}, ${vehicleData.spawnPosition.z}, ${vehicleData.spawnRotation}, ${vehicleData.ownerType}, ${vehicleData.ownerId}, ${vehicleData.colour1}, ${vehicleData.colour2}, ${vehicleData.colour3}, ${vehicleData.colour4}, ${serverId})`;
|
||||
queryDatabase(dbConnection, dbQueryString);
|
||||
//if(getDatabaseError(dbConnection)) {
|
||||
// console.warn(`[Asshat.Vehicle]: There was a problem saving vehicle ${vehicleData.vehicle.id} to the database (INSERT). Error: ${getDatabaseError(dbConnection)}`);
|
||||
// return false;
|
||||
//}
|
||||
getVehicleData(vehicleData.vehicle).databaseId = getDatabaseInsertId(dbConnection);
|
||||
} else {
|
||||
let dbQueryString = `UPDATE veh_main SET veh_model=${vehicleData.model}, veh_pos_x=${vehicleData.spawnPosition.x}, veh_pos_y=${vehicleData.spawnPosition.y}, veh_pos_z=${vehicleData.spawnPosition.z}, veh_rot_z=${vehicleData.spawnRotation}, veh_owner_type=${vehicleData.ownerType}, veh_owner_id=${vehicleData.ownerId} WHERE veh_id=${vehicleData.databaseId}`;
|
||||
let dbQueryString = `UPDATE veh_main SET veh_model=${vehicleData.model}, veh_pos_x=${vehicleData.spawnPosition.x}, veh_pos_y=${vehicleData.spawnPosition.y}, veh_pos_z=${vehicleData.spawnPosition.z}, veh_rot_z=${vehicleData.spawnRotation}, veh_owner_type=${vehicleData.ownerType}, veh_owner_id=${vehicleData.ownerId}, veh_col1=${vehicleData.colour1}, veh_col2=${vehicleData.colour2}, veh_col3=${vehicleData.colour3}, veh_col4=${vehicleData.colour4} WHERE veh_id=${vehicleData.databaseId}`;
|
||||
queryDatabase(dbConnection, dbQueryString);
|
||||
//if(getDatabaseError(dbConnection)) {
|
||||
// console.warn(`[Asshat.Vehicle]: There was a problem saving vehicle ${vehicleData.vehicle.id} to the database (UPDATE). Error: ${getDatabaseError(dbConnection)}`);
|
||||
// return false;
|
||||
//}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
@@ -106,6 +93,10 @@ function saveVehicleToDatabase(vehicleData) {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function spawnAllVehicles() {
|
||||
//if(gta.game == GAME_GTA_IV) {
|
||||
// return false;
|
||||
//}
|
||||
|
||||
for(let i in serverData.vehicles) {
|
||||
let vehicle = gta.createVehicle(serverData.vehicles[i].model, serverData.vehicles[i].spawnPosition, serverData.vehicles[i].spawnRotation);
|
||||
addToWorld(vehicle);
|
||||
@@ -174,7 +165,7 @@ function createVehicleCommand(command, params, client) {
|
||||
|
||||
let frontPos = getPosInFrontOfPos(client.player.position, client.player.heading, serverConfig.spawnCarDistance);
|
||||
|
||||
let vehicle = createVehicle(modelId, frontPos, client.player.heading);
|
||||
let vehicle = gta.createVehicle(modelId, frontPos, client.player.heading);
|
||||
vehicle.heading = client.player.heading;
|
||||
|
||||
let tempVehicleData = new serverClasses.vehicleData(false, vehicle);
|
||||
@@ -493,8 +484,8 @@ function setVehicleClanCommand(command, params, client) {
|
||||
if(!isCommandAllowedOnDiscord(command)) {
|
||||
messageClientError(client, "That command isn't available on discord!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||
messageClientError(client, "You do not have permission to use this command!");
|
||||
@@ -534,8 +525,8 @@ function setVehicleOwnerCommand(command, params, client) {
|
||||
if(!isCommandAllowedOnDiscord(command)) {
|
||||
messageClientError(client, "That command isn't available on discord!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||
messageClientError(client, "You do not have permission to use this command!");
|
||||
@@ -732,4 +723,23 @@ function toggleVehicleSpawnLockCommand(command, params, client) {
|
||||
messageClientInfo(client, `This vehicle will now spawn ${(getVehicleData(vehicle).spawnLocked) ? "here" : "wherever a player leaves it."}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function sendAllVehiclesToClient(client) {
|
||||
/*
|
||||
let tempVehicles = [];
|
||||
for(let i in serverData.vehicles) {
|
||||
let thisVehicle = serverData.vehicles[i];
|
||||
|
||||
tempVehicles.push({
|
||||
model: thisVehicle.model,
|
||||
spawnPosition: thisVehicle.spawnPosition,
|
||||
spawnHeading: thisVehicle.spawnHeading,
|
||||
colours: [thisVehicle.colour1, thisVehicle.colour2, thisVehicle.colour3, thisVehicle.colour4],
|
||||
locked: thisVehicle.locked,
|
||||
});
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user