Overhaul of "client" to "player"

This commit is contained in:
Vortrex
2020-12-29 04:26:15 -06:00
parent eeff21929c
commit 1c7532523c
34 changed files with 920 additions and 911 deletions

View File

@@ -42,7 +42,6 @@
<script src="scripts/server/translate.js" type="server" language="javascript" /> <script src="scripts/server/translate.js" type="server" language="javascript" />
<script src="scripts/server/utilities.js" type="server" language="javascript" /> <script src="scripts/server/utilities.js" type="server" language="javascript" />
<script src="scripts/server/vehicle.js" type="server" language="javascript" /> <script src="scripts/server/vehicle.js" type="server" language="javascript" />
<script src="scripts/server/walk.js" type="server" language="javascript" />
<script src="scripts/server/config.js" type="server" language="javascript" /> <script src="scripts/server/config.js" type="server" language="javascript" />
<script src="scripts/server/core.js" type="server" language="javascript" /> <script src="scripts/server/core.js" type="server" language="javascript" />

View File

@@ -79,7 +79,7 @@ function renderPropertyLabel(name, position, locked, isBusiness, price) {
text = name; text = name;
size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true); size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, COLOUR_WHITE, false, true, false, true); propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, (isBusiness) ? toColour(0, 153, 255, 255) : toColour(17, 204, 17, 255), false, true, false, true);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -36,7 +36,7 @@ let accents = [
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function getPlayerAccentText(client) { function getPlayerAccentText(client) {
return getClientCurrentSubAccount(client).accent; return getPlayerCurrentSubAccount(client).accent;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -16,13 +16,13 @@ function initAccountScript() {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function loginCommand(command, params, client) { function loginCommand(command, params, client) {
if(!isClientRegistered(client)) { if(!isPlayerRegistered(client)) {
messageClientError(client, "Your name is not registered! Use /register to make an account."); messagePlayerError(client, "Your name is not registered! Use /register to make an account.");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -37,10 +37,10 @@ function autoLoginByIPCommand(command, params, client) {
if(isAccountAutoIPLoginEnabled(getPlayerData(client).accountData)) { if(isAccountAutoIPLoginEnabled(getPlayerData(client).accountData)) {
getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue; getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue;
messageClientSuccess(client, `You will not be automatically logged in via your current IP (${client.ip})`); messagePlayerSuccess(client, `You will not be automatically logged in via your current IP (${client.ip})`);
} else { } else {
getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings | flagValue; getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings | flagValue;
messageClientSuccess(client, `You will now be automatically logged in from your current IP (${client.ip})`); messagePlayerSuccess(client, `You will now be automatically logged in from your current IP (${client.ip})`);
} }
return true; return true;
} }
@@ -52,10 +52,10 @@ function autoSelectLastCharacterCommand(command, params, client) {
if(doesPlayerHaveAutoSelectLastCharacterEnabled(client)) { if(doesPlayerHaveAutoSelectLastCharacterEnabled(client)) {
getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue; getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue;
messageClientSuccess(client, `You will not be automatically spawned as your last used character`); messagePlayerSuccess(client, `You will not be automatically spawned as your last used character`);
} else { } else {
getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings | flagValue; getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings | flagValue;
messageClientSuccess(client, `You will now be automatically spawned as your last used character`); messagePlayerSuccess(client, `You will now be automatically spawned as your last used character`);
} }
return true; return true;
} }
@@ -67,30 +67,30 @@ function toggleAccountGUICommand(command, params, client) {
if(!doesPlayerHaveGUIEnabled(client)) { if(!doesPlayerHaveGUIEnabled(client)) {
getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue; getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue;
messageClientNormal(client, `⚙️ You will now be shown GUI (if enabled on current server)`); messagePlayerNormal(client, `⚙️ You will now be shown GUI (if enabled on current server)`);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} has toggled GUI for their account ON.`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account ON.`);
} else { } else {
getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings | flagValue; getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings | flagValue;
messageClientNormal(client, `⚙️ You will not be shown GUI anymore. Any GUI stuff will be shown as messages in the chatbox instead.`); messagePlayerNormal(client, `⚙️ You will not be shown GUI anymore. Any GUI stuff will be shown as messages in the chatbox instead.`);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} has toggled GUI for their account OFF.`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account OFF.`);
} }
if(!isClientLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
if(getPlayerData().accountData.databaseId != 0) { if(getPlayerData().accountData.databaseId != 0) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.showLogin", client); triggerNetworkEvent("ag.showLogin", client);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the login GUI`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI`);
} else { } else {
messageClient(`👋 Welcome back to Asshat Gaming RP, ${client.name}! Please /login to continue.`, client, getColourByName("softGreen")); messageClient(`👋 Welcome back to Asshat Gaming RP, ${client.name}! Please /login to continue.`, client, getColourByName("softGreen"));
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the login message (GUI disabled)`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled)`);
} }
} else { } else {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.showRegistration", client); triggerNetworkEvent("ag.showRegistration", client);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the register GUI`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
} else { } else {
messageClient(`👋 Welcome to Asshat Gaming RP, ${client.name}! Please /register to continue.`, client, getColourByName("softGreen")); messageClient(`👋 Welcome to Asshat Gaming RP, ${client.name}! Please /register to continue.`, client, getColourByName("softGreen"));
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the register message (GUI disabled)`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
} }
} }
} }
@@ -104,13 +104,13 @@ function toggleAccountServerLogoCommand(command, params, client) {
if(!doesPlayerHaveLogoEnabled(client)) { if(!doesPlayerHaveLogoEnabled(client)) {
getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue; getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue;
messageClientNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(true)}now [#FFFFFF]be shown the server logo (if enabled on current server)`); messagePlayerNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(true)}now [#FFFFFF]be shown the server logo (if enabled on current server)`);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} has toggled the server logo ON for their account`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo ON for their account`);
triggerNetworkEvent("ag.logo", client, true); triggerNetworkEvent("ag.logo", client, true);
} else { } else {
getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings | flagValue; getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings | flagValue;
messageClientNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(false)}not [#FFFFFF]be shown the server logo.`); messagePlayerNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(false)}not [#FFFFFF]be shown the server logo.`);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} has toggled the server logo OFF for their account`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo OFF for their account`);
triggerNetworkEvent("ag.logo", client, false); triggerNetworkEvent("ag.logo", client, false);
} }
@@ -125,25 +125,25 @@ function toggleAccountTwoFactorAuthCommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("twoStepAuth"); let flagValue = getAccountSettingsFlagValue("twoStepAuth");
if(getPlayerData(client).emailAddress != "") { if(getPlayerData(client).emailAddress != "") {
messageClientError(client, "You need to add your email to your account to use two-factor authentication."); messagePlayerError(client, "You need to add your email to your account to use two-factor authentication.");
messageClientTip(client, "[#FFFFFF]Use [#AAAAAA]/setemail [#FFFFFF]to add your email."); messagePlayerTip(client, "[#FFFFFF]Use [#AAAAAA]/setemail [#FFFFFF]to add your email.");
return false; return false;
} }
if(!isValidEmailAddress(getPlayerData(client).emailAddress)) { if(!isValidEmailAddress(getPlayerData(client).emailAddress)) {
messageClientError(client, "The email you previously added is not valid."); messagePlayerError(client, "The email you previously added is not valid.");
messageClientTip(client, "[#FFFFFF]Use [#AAAAAA]/setemail [#FFFFFF]to add a valid email."); messagePlayerTip(client, "[#FFFFFF]Use [#AAAAAA]/setemail [#FFFFFF]to add a valid email.");
return false; return false;
} }
if(!doesPlayerHaveTwoFactorAuthEnabled(client)) { if(!doesPlayerHaveTwoFactorAuthEnabled(client)) {
getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue; getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue;
messageClientSuccess(client, `[#FFFFFF]Use this code to add your account into your authenticator app: [#AAAAAA]${addtoAuthenticatorCode}`); messagePlayerSuccess(client, `[#FFFFFF]Use this code to add your account into your authenticator app: [#AAAAAA]${addtoAuthenticatorCode}`);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} has toggled two-factor authentication ON for their account`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication ON for their account`);
} else { } else {
getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings | flagValue; getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings | flagValue;
messageClientSuccess(client, `You have turned ${getBoolRedGreenInlineColour(false)}OFF [#FFFFFF]two-factor authentication for login.`); messagePlayerSuccess(client, `You have turned ${getBoolRedGreenInlineColour(false)}OFF [#FFFFFF]two-factor authentication for login.`);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} has toggled two-factor authentication OFF for their account`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication OFF for their account`);
} }
return true; return true;
} }
@@ -151,27 +151,27 @@ function toggleAccountTwoFactorAuthCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function registerCommand(command, params, client) { function registerCommand(command, params, client) {
if(isClientRegistered(client)) { if(isPlayerRegistered(client)) {
messageClientError(client, "Your name is already registered!"); messagePlayerError(client, "Your name is already registered!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
checkRegistration(client, params); checkRegistration(client, params);
//getPlayerData(client).accountData = accountData; //getPlayerData(client).accountData = accountData;
//messageClientSuccess(client, "Your account has been created!"); //messagePlayerSuccess(client, "Your account has been created!");
//messageClientAlert(client, "To play on the server, you will need to make a character."); //messagePlayerAlert(client, "To play on the server, you will need to make a character.");
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function changePasswordCommand(command, params, client) { function changePasswordCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -180,28 +180,28 @@ function changePasswordCommand(command, params, client) {
let newPassword = splitParams[1]; let newPassword = splitParams[1];
if(isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(client.name, oldPassword))) { if(isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(client.name, oldPassword))) {
messageClientError(client, "The old password is invalid!"); messagePlayerError(client, "The old password is invalid!");
return false; return false;
} }
if(!doesPasswordMeetRequirements(newPassword)) { if(!doesPasswordMeetRequirements(newPassword)) {
messageClientError(client, "The new password must meet the requirements!"); messagePlayerError(client, "The new password must meet the requirements!");
messageClientInfo(client, "Passwords must have at least one capital letter, one lowercase letter, and one number!"); messagePlayerInfo(client, "Passwords must have at least one capital letter, one lowercase letter, and one number!");
return false; return false;
} }
getPlayerData(client).accountData.password = hashAccountPassword(getPlayerData(client).accountData.name, params); getPlayerData(client).accountData.password = hashAccountPassword(getPlayerData(client).accountData.name, params);
messageClientSuccess(client, "Your password has been changed!"); messagePlayerSuccess(client, "Your password has been changed!");
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function setAccountEmailCommand(command, params, client) { function setAccountEmailCommand(command, params, client) {
messageClientError(client, `This command is not yet finished and will be available soon!`); messagePlayerError(client, `This command is not yet finished and will be available soon!`);
return false; return false;
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -209,23 +209,23 @@ function setAccountEmailCommand(command, params, client) {
let emailAddress = splitParams[0]; let emailAddress = splitParams[0];
if(!isValidEmailAddress(emailAddress)) { if(!isValidEmailAddress(emailAddress)) {
messageClientError(client, `The email '${emailAddress} is not valid!`); messagePlayerError(client, `The email '${emailAddress} is not valid!`);
return false; return false;
} }
// TO-DO: Command (like /verifyemail or use this one for second step too) to input verification code sent to email. // TO-DO: Command (like /verifyemail or use this one for second step too) to input verification code sent to email.
//getPlayerData(client).accountData.emailAddress = emailAddress; //getPlayerData(client).accountData.emailAddress = emailAddress;
messageClientSuccess(client, "Your password has been changed!"); messagePlayerSuccess(client, "Your password has been changed!");
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function setAccountDiscordCommand(command, params, client) { function setAccountDiscordCommand(command, params, client) {
messageClientError(client, `This command is not yet finished and will be available soon!`); messagePlayerError(client, `This command is not yet finished and will be available soon!`);
return false; return false;
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -233,19 +233,19 @@ function setAccountDiscordCommand(command, params, client) {
let discordName = splitParams[0]; let discordName = splitParams[0];
if(!isValidEmailAddress(emailAddress)) { if(!isValidEmailAddress(emailAddress)) {
messageClientError(client, `The discord '${discordName} is not valid!`); messagePlayerError(client, `The discord '${discordName} is not valid!`);
return false; return false;
} }
// TO-DO: Command (like /verifyemail or use this one for second step too) to input verification code sent to email. // TO-DO: Command (like /verifyemail or use this one for second step too) to input verification code sent to email.
//getPlayerData(client).accountData.emailAddress = emailAddress; //getPlayerData(client).accountData.emailAddress = emailAddress;
//messageClientSuccess(client, "Your discord account has been attached to your game account!"); //messagePlayerSuccess(client, "Your discord account has been attached to your game account!");
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function isClientLoggedIn(client) { function isPlayerLoggedIn(client) {
if(client.console) { if(isConsole(client)) {
return true; return true;
} }
@@ -258,8 +258,8 @@ function isClientLoggedIn(client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function isClientRegistered(client) { function isPlayerRegistered(client) {
if(client.console) { if(isConsole(client)) {
return true; return true;
} }
@@ -410,11 +410,11 @@ function saltAccountInfo(name, password) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function loginSuccess(client) { function loginSuccess(client) {
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} successfully logged in.`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} successfully logged in.`);
getPlayerData(client).loggedIn = true; getPlayerData(client).loggedIn = true;
if(doesClientHaveStaffPermission(client, "developer") || doesClientHaveStaffPermission(client, "manageServer")) { if(doesPlayerHaveStaffPermission(client, "developer") || doesPlayerHaveStaffPermission(client, "manageServer")) {
console.warn(`[Asshat.Account] ${getClientDisplayForConsole(client)} has needed permissions and is being given administrator access`); console.warn(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} has needed permissions and is being given administrator access`);
client.administrator = true; client.administrator = true;
} }
@@ -422,10 +422,10 @@ function loginSuccess(client) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.showPrompt", client, "You have no characters. Would you like to make one?", "No characters"); triggerNetworkEvent("ag.showPrompt", client, "You have no characters. Would you like to make one?", "No characters");
setEntityData(client, "ag.prompt", AG_PROMPT_CREATEFIRSTCHAR, false); setEntityData(client, "ag.prompt", AG_PROMPT_CREATEFIRSTCHAR, false);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the no characters prompt GUI`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters prompt GUI`);
} else { } else {
messageClientAlert(client, `You have no characters. Use /newchar to make one.`); messagePlayerAlert(client, `You have no characters. Use /newchar to make one.`);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the no characters message (GUI disabled)`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters message (GUI disabled)`);
} }
} else { } else {
showCharacterSelectToClient(client); showCharacterSelectToClient(client);
@@ -543,49 +543,49 @@ function createAccount(name, password, email = "") {
function checkLogin(client, password) { function checkLogin(client, password) {
let loginAttemptsRemaining = getEntityData(client, "ag.loginAttemptsRemaining")-1; let loginAttemptsRemaining = getEntityData(client, "ag.loginAttemptsRemaining")-1;
if(isClientLoggedIn(client)) { if(isPlayerLoggedIn(client)) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.loginSuccess", client); triggerNetworkEvent("ag.loginSuccess", client);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} has successfully logged in`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} has successfully logged in`);
} else { } else {
messageClientError(client, "You are already logged in!"); messagePlayerError(client, "You are already logged in!");
console.warn(`[Asshat.Account] ${getClientDisplayForConsole(client)} attempted to login but is already logged in`); console.warn(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
} }
return false; return false;
} }
if(!isClientRegistered(client)) { if(!isPlayerRegistered(client)) {
console.warn(`[Asshat.Account] ${getClientDisplayForConsole(client)} attempted to login but is not registered`); console.warn(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is not registered`);
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.showRegistration", client); triggerNetworkEvent("ag.showRegistration", client);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the register GUI`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
} else { } else {
messageClientError(client, "Your name is not registered! Use /register to make an account."); messagePlayerError(client, "Your name is not registered! Use /register to make an account.");
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the register message (GUI disabled)`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
} }
return false; return false;
} }
if(areParamsEmpty(password)) { if(areParamsEmpty(password)) {
console.warn(`[Asshat.Account] ${getClientDisplayForConsole(client)} attempted to login but failed (empty password). ${loginAttemptsRemaining} login attempts remaining`); console.warn(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (empty password). ${loginAttemptsRemaining} login attempts remaining`);
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.loginFailed", client, `Invalid password! ${loginAttemptsRemaining} tries remaining.`); triggerNetworkEvent("ag.loginFailed", client, `Invalid password! ${loginAttemptsRemaining} tries remaining.`);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the login GUI with ${loginAttemptsRemaining} login attempts remaining alert.`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${loginAttemptsRemaining} login attempts remaining alert.`);
} else { } else {
messageClientError(client, `You must enter a password! ${loginAttemptsRemaining} tries remaining.`); messagePlayerError(client, `You must enter a password! ${loginAttemptsRemaining} tries remaining.`);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${loginAttemptsRemaining} login attempts remaining alert.`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${loginAttemptsRemaining} login attempts remaining alert.`);
} }
return false; return false;
} }
if(!isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(client.name, password))) { if(!isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(client.name, password))) {
console.warn(`[Asshat.Account] ${getClientDisplayForConsole(client)} attempted to login but failed (wrong password). ${loginAttemptsRemaining} login attempts remaining`); console.warn(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (wrong password). ${loginAttemptsRemaining} login attempts remaining`);
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.loginFailed", client, `Invalid password! ${loginAttemptsRemaining} tries remaining.`); triggerNetworkEvent("ag.loginFailed", client, `Invalid password! ${loginAttemptsRemaining} tries remaining.`);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the login GUI with ${loginAttemptsRemaining} login attempts remaining alert.`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${loginAttemptsRemaining} login attempts remaining alert.`);
} else { } else {
messageClientError(client, `Invalid password! ${loginAttemptsRemaining} tries remaining.`); messagePlayerError(client, `Invalid password! ${loginAttemptsRemaining} tries remaining.`);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${loginAttemptsRemaining} login attempts remaining alert.`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${loginAttemptsRemaining} login attempts remaining alert.`);
} }
return false; return false;
} }
@@ -603,20 +603,20 @@ addNetworkHandler("ag.checkLogin", checkLogin);
function checkRegistration(client, password, confirmPassword = "", emailAddress = "") { function checkRegistration(client, password, confirmPassword = "", emailAddress = "") {
console.log("[Asshat.Account]: Checking registration for " + toString(client.name)); console.log("[Asshat.Account]: Checking registration for " + toString(client.name));
if(isClientRegistered(client)) { if(isPlayerRegistered(client)) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.showLogin", client); triggerNetworkEvent("ag.showLogin", client);
} else { } else {
messageClientError(client, "Your name is already registered!"); messagePlayerError(client, "Your name is already registered!");
} }
return false; return false;
} }
if(isClientLoggedIn(client)) { if(isPlayerLoggedIn(client)) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.loginSuccess", client); triggerNetworkEvent("ag.loginSuccess", client);
} else { } else {
messageClientError(client, "You are already logged in!"); messagePlayerError(client, "You are already logged in!");
} }
return false; return false;
} }
@@ -625,7 +625,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.registrationFailed", client, "Password cannot be blank!"); triggerNetworkEvent("ag.registrationFailed", client, "Password cannot be blank!");
} else { } else {
messageClientError(client, "The password cannot be blank!"); messagePlayerError(client, "The password cannot be blank!");
} }
return false; return false;
} }
@@ -656,7 +656,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
// Work on this later. Function should return true by default anyway for now. // Work on this later. Function should return true by default anyway for now.
triggerNetworkEvent("ag.registrationFailed", client, "Password doesn't meet requirements!"); triggerNetworkEvent("ag.registrationFailed", client, "Password doesn't meet requirements!");
} else { } else {
messageClientError(client, "Password doesn't meet requirements!"); messagePlayerError(client, "Password doesn't meet requirements!");
} }
return false return false
} }
@@ -673,25 +673,25 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.registrationFailed", client, "Something went wrong. Your account could not be created!"); triggerNetworkEvent("ag.registrationFailed", client, "Something went wrong. Your account could not be created!");
} else { } else {
messageClientAlert(client, "Something went wrong. Your account could not be created!"); messagePlayerAlert(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."); messagePlayerAlert(client, "Asshat Gaming staff have been notified of the problem and will fix it shortly.");
return false; return false;
} }
getPlayerData(client).accountData = accountData; getPlayerData(client).accountData = accountData;
getPlayerData(client).loggedIn = true; getPlayerData(client).loggedIn = true;
messageClientSuccess(client, "Your account has been created!"); messagePlayerSuccess(client, "Your account has been created!");
messageClientAlert(client, "To play on the server, you will need to make a character."); messagePlayerAlert(client, "To play on the server, you will need to make a character.");
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.registrationSuccess", client); triggerNetworkEvent("ag.registrationSuccess", client);
triggerNetworkEvent("ag.showPrompt", client, "You have no characters. Would you like to make one?", "No Characters"); triggerNetworkEvent("ag.showPrompt", client, "You have no characters. Would you like to make one?", "No Characters");
setEntityData(client, "ag.prompt", AG_PROMPT_CREATEFIRSTCHAR, false); setEntityData(client, "ag.prompt", AG_PROMPT_CREATEFIRSTCHAR, false);
} else { } else {
messageClientAlert(client, `You have no characters. Use /newchar to make one.`); messagePlayerAlert(client, `You have no characters. Use /newchar to make one.`);
} }
}; };
addNetworkHandler("ag.checkRegistration", checkRegistration); addNetworkHandler("ag.checkRegistration", checkRegistration);
@@ -727,7 +727,7 @@ function savePlayerToDatabase(client) {
saveAccountToDatabase(getPlayerData(client).accountData); saveAccountToDatabase(getPlayerData(client).accountData);
if(getPlayerData(client).currentSubAccount != -1) { if(getPlayerData(client).currentSubAccount != -1) {
let subAccountData = getClientCurrentSubAccount(client); let subAccountData = getPlayerCurrentSubAccount(client);
if(client.player != null) { if(client.player != null) {
subAccountData.spawnPosition = getPlayerPosition(client); subAccountData.spawnPosition = getPlayerPosition(client);
@@ -738,14 +738,14 @@ function savePlayerToDatabase(client) {
saveSubAccountToDatabase(subAccountData); saveSubAccountToDatabase(subAccountData);
} }
console.log(`[Asshat.Account]: Saved client ${getClientDisplayForConsole(client)} to database successfully!`); console.log(`[Asshat.Account]: Saved client ${getPlayerDisplayForConsole(client)} to database successfully!`);
return true; return true;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function initClient(client) { function initClient(client) {
if(client.console) { if(isConsole(client)) {
return false; return false;
} }
@@ -768,23 +768,23 @@ function initClient(client) {
if(tempAccountData != false) { if(tempAccountData != false) {
if(isAccountAutoIPLoginEnabled(tempAccountData) && getPlayerData(client).accountData.ipAddress == client.ip) { if(isAccountAutoIPLoginEnabled(tempAccountData) && getPlayerData(client).accountData.ipAddress == client.ip) {
messageClientAlert(client, "You have been automatically logged in via IP!"); messagePlayerAlert(client, "You have been automatically logged in via IP!");
loginSuccess(client); loginSuccess(client);
} else { } else {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the login GUI.`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI.`);
triggerNetworkEvent("ag.showLogin", client); triggerNetworkEvent("ag.showLogin", client);
} else { } else {
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the login message (GUI disabled).`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled).`);
messageClient(`Welcome back to Asshat Gaming RP, ${client.name}! Please /login to continue.`, client, getColourByName("softGreen")); messageClient(`Welcome back to Asshat Gaming RP, ${client.name}! Please /login to continue.`, client, getColourByName("softGreen"));
} }
} }
} else { } else {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the register GUI.`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI.`);
triggerNetworkEvent("ag.showRegistration", client); triggerNetworkEvent("ag.showRegistration", client);
} else { } else {
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the register message (GUI disabled).`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled).`);
messageClient(`Welcome to Asshat Gaming RP, ${client.name}! Please /register to continue.`, client, getColourByName("softGreen")); messageClient(`Welcome to Asshat Gaming RP, ${client.name}! Please /register to continue.`, client, getColourByName("softGreen"));
} }
} }

View File

@@ -27,13 +27,13 @@ function initBanScript() {
function accountBanCommand(command, params, client, fromDiscord) { function accountBanCommand(command, params, client, fromDiscord) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
// Prevent banning admins with really high permissions // Prevent banning admins with really high permissions
if(doesClientHaveStaffPermission(targetClient, "ManageServer") || doesClientHaveStaffPermission(targetClient, "Developer")) { if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
messageClientError(client, "You cannot ban this person!"); messagePlayerError(client, "You cannot ban this person!");
return false; return false;
} }
@@ -46,13 +46,13 @@ function accountBanCommand(command, params, client, fromDiscord) {
function subAccountBanCommand(command, params, client, fromDiscord) { function subAccountBanCommand(command, params, client, fromDiscord) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
// Prevent banning admins with really high permissions // Prevent banning admins with really high permissions
if(doesClientHaveStaffPermission(targetClient, "ManageServer") || doesClientHaveStaffPermission(targetClient, "Developer")) { if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
messageClientError(client, "You cannot ban this person!"); messagePlayerError(client, "You cannot ban this person!");
return false; return false;
} }
@@ -69,13 +69,13 @@ function subAccountBanCommand(command, params, client, fromDiscord) {
function ipBanCommand(command, params, client, fromDiscord) { function ipBanCommand(command, params, client, fromDiscord) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
// Prevent banning admins with really high permissions // Prevent banning admins with really high permissions
if(doesClientHaveStaffPermission(targetClient, "ManageServer") || doesClientHaveStaffPermission(targetClient, "Developer")) { if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
messageClientError(client, "You cannot ban this person!"); messagePlayerError(client, "You cannot ban this person!");
return false; return false;
} }
@@ -93,13 +93,13 @@ function ipBanCommand(command, params, client, fromDiscord) {
function subNetBanCommand(command, params, client, fromDiscord) { function subNetBanCommand(command, params, client, fromDiscord) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
// Prevent banning admins with really high permissions // Prevent banning admins with really high permissions
if(doesClientHaveStaffPermission(targetClient, "ManageServer") || doesClientHaveStaffPermission(targetClient, "Developer")) { if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
messageClientError(client, "You cannot ban this person!"); messagePlayerError(client, "You cannot ban this person!");
return false; return false;
} }

View File

@@ -140,8 +140,8 @@ function hasBitFlag(allFlags, checkForFlag) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function doesClientHaveStaffPermission(client, requiredFlags) { function doesPlayerHaveStaffPermission(client, requiredFlags) {
if(client.console) { if(isConsole(client)) {
return true; return true;
} }
@@ -171,7 +171,7 @@ function doesClientHaveStaffPermission(client, requiredFlags) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function doesClientHaveClanPermission(client, requiredFlags) { function doesClientHaveClanPermission(client, requiredFlags) {
if(client.console) { if(isConsole(client)) {
return true; return true;
} }
@@ -179,12 +179,12 @@ function doesClientHaveClanPermission(client, requiredFlags) {
return true; return true;
} }
if(doesClientHaveStaffPermission(client, getStaffFlagValue("manageClans"))) { if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("manageClans"))) {
return true; return true;
} }
let clanFlags = 0; let clanFlags = 0;
clanFlags = getClientCurrentSubAccount(client).clanFlags | getClanRankFlags(getClientCurrentSubAccount(client).clanRank); clanFlags = getPlayerCurrentSubAccount(client).clanFlags | getClanRankFlags(getPlayerCurrentSubAccount(client).clanRank);
// -1 is automatic override (having -1 for staff flags is basically god mode admin level) // -1 is automatic override (having -1 for staff flags is basically god mode admin level)
if(clanFlags == getClanFlagValue("all")) { if(clanFlags == getClanFlagValue("all")) {
@@ -256,7 +256,7 @@ function getAccountFlagsFlagValue(flagName) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function giveClientStaffFlag(client, flagName) { function givePlayerStaffFlag(client, flagName) {
if(!getStaffFlagValue(flagName)) { if(!getStaffFlagValue(flagName)) {
return false; return false;
} }
@@ -267,7 +267,7 @@ function giveClientStaffFlag(client, flagName) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function takeClientStaffFlag(client, flagName) { function takePlayerStaffFlag(client, flagName) {
if(!getStaffFlagValue(flagName)) { if(!getStaffFlagValue(flagName)) {
return false; return false;
} }
@@ -290,7 +290,7 @@ function removeBitFlag(allFlags, flagValue) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function takeClientStaffFlag(client, flagName) { function takePlayerStaffFlag(client, flagName) {
if(!getStaffFlagValue(flagName)) { if(!getStaffFlagValue(flagName)) {
return false; return false;
} }
@@ -301,7 +301,7 @@ function takeClientStaffFlag(client, flagName) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function clearClientStaffFlags(client) { function clearPlayerStaffFlags(client) {
getPlayerData(client).accountData.flags.admin = getStaffFlagValue("none"); getPlayerData(client).accountData.flags.admin = getStaffFlagValue("none");
return true; return true;
} }

View File

@@ -114,7 +114,7 @@ function createBusinessCommand(command, params, client) {
function createBusinessLocationCommand(command, params, client) { function createBusinessLocationCommand(command, params, client) {
if(!isPlayerSpawned(client)) { if(!isPlayerSpawned(client)) {
messageClientError("You must be spawned to use this command!"); messagePlayerError("You must be spawned to use this command!");
return false; return false;
} }
@@ -122,7 +122,7 @@ function createBusinessLocationCommand(command, params, client) {
let businessId = toInteger(splitParams[1]) || (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)); let businessId = toInteger(splitParams[1]) || (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messageClientError("Business not found!"); messagePlayerError("Business not found!");
return false; return false;
} }
@@ -161,7 +161,7 @@ function deleteBusinessCommand(command, params, client) {
let businessId = toInteger(params) || (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)); let businessId = toInteger(params) || (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messageClientError("Business not found!"); messagePlayerError("Business not found!");
return false; return false;
} }
@@ -174,7 +174,7 @@ function deleteBusinessCommand(command, params, client) {
function deleteBusinessLocationCommand(command, params, client) { function deleteBusinessLocationCommand(command, params, client) {
//let businessId = toInteger(splitParams[1]); //let businessId = toInteger(splitParams[1]);
//deleteBusinessLocation(businessId); //deleteBusinessLocation(businessId);
//messageClientSuccess(client, `Business '${tempBusinessData.name} deleted!`); //messagePlayerSuccess(client, `Business '${tempBusinessData.name} deleted!`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -187,7 +187,7 @@ function setBusinessNameCommand(command, params, client) {
let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client))); let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)));
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messageClientError("Business not found!"); messagePlayerError("Business not found!");
return false; return false;
} }
@@ -206,12 +206,12 @@ function setBusinessOwnerCommand(command, params, client) {
let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client))); let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)));
if(!newBusinessOwner) { if(!newBusinessOwner) {
messageClientError("Player not found!"); messagePlayerError("Player not found!");
return false; return false;
} }
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messageClientError("Business not found!"); messagePlayerError("Business not found!");
return false; return false;
} }
@@ -227,12 +227,12 @@ function setBusinessClanCommand(command, params, client) {
let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client))); let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)));
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messageClientError("Business not found!"); messagePlayerError("Business not found!");
return false; return false;
} }
if(!getClanData(clanId)) { if(!getClanData(clanId)) {
messageClientError("Clan not found!"); messagePlayerError("Clan not found!");
return false; return false;
} }
@@ -254,12 +254,12 @@ function setBusinessJobCommand(command, params, client) {
} }
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messageClientError("Business not found!"); messagePlayerError("Business not found!");
return false; return false;
} }
if(!getJobData(jobId)) { if(!getJobData(jobId)) {
messageClientError("Job not found!"); messagePlayerError("Job not found!");
return false; return false;
} }
@@ -274,7 +274,7 @@ function setBusinessPublicCommand(command, params, client) {
let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client))); let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)));
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messageClientError("Business not found!"); messagePlayerError("Business not found!");
return false; return false;
} }
@@ -289,13 +289,13 @@ function lockBusinessCommand(command, params, client) {
let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client))); let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)));
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messageClientError("Business not found!"); messagePlayerError("Business not found!");
return false; return false;
} }
getBusinessData(businessId).locked = !getBusinessData(businessId).locked; getBusinessData(businessId).locked = !getBusinessData(businessId).locked;
getBusinessData(businessId).entrancePickup.setData("ag.label.locked", getBusinessData(businessId).locked, true); getBusinessData(businessId).entrancePickup.setData("ag.label.locked", getBusinessData(businessId).locked, true);
messageClientSuccess(client, `${getLockedUnlockedEmojiFromBool((getBusinessData(businessId).locked))} Business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]${getLockedUnlockedTextFromBool((getBusinessData(businessId).locked))}!`); messagePlayerSuccess(client, `${getLockedUnlockedEmojiFromBool((getBusinessData(businessId).locked))} Business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]${getLockedUnlockedTextFromBool((getBusinessData(businessId).locked))}!`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -305,7 +305,7 @@ function setBusinessEntranceFeeCommand(command, params, client) {
let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client))); let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)));
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messageClientError("Business not found!"); messagePlayerError("Business not found!");
return false; return false;
} }
@@ -323,7 +323,7 @@ function getBusinessInfoCommand(command, params, client) {
} }
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messageClientError(client, "Business not found!"); messagePlayerError(client, "Business not found!");
return false; return false;
} }
@@ -351,7 +351,7 @@ function getBusinessInfoCommand(command, params, client) {
break; break;
} }
messageClientInfo(client, `[#0099FF][Business Info] [#FFFFFF]Name: [#AAAAAA]${getBusinessData(businessId).name}, [#FFFFFF]Owner: [#AAAAAA]${ownerName} (${getBusinessOwnerTypeText(getBusinessData(businessId).ownerType)}), [#FFFFFF]Locked: [#AAAAAA]${getYesNoFromBool(intToBool(getBusinessData(businessId).locked))}, [#FFFFFF]ID: [#AAAAAA]${businessId}/${getBusinessData(businessId).databaseId}`); messagePlayerInfo(client, `[#0099FF][Business Info] [#FFFFFF]Name: [#AAAAAA]${getBusinessData(businessId).name}, [#FFFFFF]Owner: [#AAAAAA]${ownerName} (${getBusinessOwnerTypeText(getBusinessData(businessId).ownerType)}), [#FFFFFF]Locked: [#AAAAAA]${getYesNoFromBool(intToBool(getBusinessData(businessId).locked))}, [#FFFFFF]ID: [#AAAAAA]${businessId}/${getBusinessData(businessId).databaseId}`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -361,14 +361,14 @@ function setBusinessPickupCommand(command, params, client) {
let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client))); let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)));
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messageClientError(client, "Business not found!"); messagePlayerError(client, "Business not found!");
return false; return false;
} }
if(isNaN(typeParam)) { if(isNaN(typeParam)) {
if(isNull(getGameConfig().pickupModels[getServerGame()][typeParam])) { if(isNull(getGameConfig().pickupModels[getServerGame()][typeParam])) {
messageClientError(client, "Invalid business type! Use a business type name or a pickup model ID"); messagePlayerError(client, "Invalid business type! Use a business type name or a pickup model ID");
messageClientInfo(client, `Pickup Types: [#AAAAAA]${Object.keys(getGameConfig().pickupModels[getServerGame()]).join(", ")}`) messagePlayerInfo(client, `Pickup Types: [#AAAAAA]${Object.keys(getGameConfig().pickupModels[getServerGame()]).join(", ")}`)
return false; return false;
} }
@@ -394,14 +394,14 @@ function setBusinessBlipCommand(command, params, client) {
let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client))); let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)));
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messageClientError(client, "Business not found!"); messagePlayerError(client, "Business not found!");
return false; return false;
} }
if(isNaN(typeParam)) { if(isNaN(typeParam)) {
if(isNull(getGameConfig().blipSprites[getServerGame()][typeParam])) { if(isNull(getGameConfig().blipSprites[getServerGame()][typeParam])) {
messageClientError(client, "Invalid business type! Use a business type name or a blip image ID"); messagePlayerError(client, "Invalid business type! Use a business type name or a blip image ID");
messageClientInfo(client, `Blip Types: [#AAAAAA]${Object.keys(getGameConfig().blipSprites[getServerGame()]).join(", ")}`) messagePlayerInfo(client, `Blip Types: [#AAAAAA]${Object.keys(getGameConfig().blipSprites[getServerGame()]).join(", ")}`)
return false; return false;
} }
@@ -422,7 +422,7 @@ function setBusinessBlipCommand(command, params, client) {
function withdrawFromBusinessCommand(command, params, client) { function withdrawFromBusinessCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -432,28 +432,28 @@ function withdrawFromBusinessCommand(command, params, client) {
let businessId = toInteger(splitParams[1]) || (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)); let businessId = toInteger(splitParams[1]) || (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messageClientError("Business not found!"); messagePlayerError("Business not found!");
return false; return false;
} }
let tempBusinessData = getServerData().businesses.filter(b => b.databaseId == businessId)[0]; let tempBusinessData = getServerData().businesses.filter(b => b.databaseId == businessId)[0];
if(getServerData().businesses[businessId].till < amount) { if(getServerData().businesses[businessId].till < amount) {
messageClientError(client, `Business '${tempBusinessData.name}' doesn't have that much money! Use /bizbalance.`); messagePlayerError(client, `Business '${tempBusinessData.name}' doesn't have that much money! Use /bizbalance.`);
return false; return false;
} }
getServerData().businesses[businessId].till -= amount; getServerData().businesses[businessId].till -= amount;
getClientCurrentSubAccount(client).cash += amount; getPlayerCurrentSubAccount(client).cash += amount;
updatePlayerCash(client); updatePlayerCash(client);
messageClientSuccess(client, `You withdrew $${amount} from business '${tempBusinessData.name}''s till'`); messagePlayerSuccess(client, `You withdrew $${amount} from business '${tempBusinessData.name}''s till'`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function depositIntoBusinessCommand(command, params, client) { function depositIntoBusinessCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -462,15 +462,15 @@ function depositIntoBusinessCommand(command, params, client) {
let amount = toInteger(splitParams[0]) || 0; let amount = toInteger(splitParams[0]) || 0;
let businessId = toInteger(splitParams[1]) || (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)); let businessId = toInteger(splitParams[1]) || (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
if(getClientCurrentSubAccount(client).cash < amount) { if(getPlayerCurrentSubAccount(client).cash < amount) {
messageClientError(client, `You don't have that much money! You only have $${getClientCurrentSubAccount(client).cash}`); messagePlayerError(client, `You don't have that much money! You only have $${getPlayerCurrentSubAccount(client).cash}`);
return false; return false;
} }
getServerData().businesses[businessId].till += amount; getServerData().businesses[businessId].till += amount;
getClientCurrentSubAccount(client).cash -= amount; getPlayerCurrentSubAccount(client).cash -= amount;
updatePlayerCash(client); updatePlayerCash(client);
messageClientSuccess(client, `You deposited $${amount} into business '${tempBusinessData.name}''s till'`); messagePlayerSuccess(client, `You deposited $${amount} into business '${tempBusinessData.name}''s till'`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -478,7 +478,7 @@ function depositIntoBusinessCommand(command, params, client) {
function viewBusinessTillAmountCommand(command, params, client) { function viewBusinessTillAmountCommand(command, params, client) {
let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client))); let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)));
messageClientSuccess(client, `Business '${getServerData().businesses[businessId].name}' till has $'${getServerData().businesses[businessId].till}'!`); messagePlayerSuccess(client, `Business '${getServerData().businesses[businessId].name}' till has $'${getServerData().businesses[businessId].till}'!`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -662,7 +662,7 @@ function deleteBusiness(businessId, deletedBy = 0) {
let dbQuery = null; let dbQuery = null;
if(dbConnection) { if(dbConnection) {
dbQuery = queryDatabase(dbConnection, `UPDATE biz_main SET biz_deleted = 1 AND biz_who_deleted = ${deletedBy} AND biz_when_deleted = UNIX_TIMESTAMP() WHERE biz_id = ${tempBusinessData.databaseId} LIMIT 1`); dbQuery = queryDatabase(dbConnection, `DELETE FROM biz_main WHERE biz_id = ${tempBusinessData.databaseId}`);
if(dbQuery) { if(dbQuery) {
freeDatabaseQuery(dbQuery); freeDatabaseQuery(dbQuery);
} }
@@ -676,6 +676,8 @@ function deleteBusiness(businessId, deletedBy = 0) {
deleteBusinessExitBlip(businessId); deleteBusinessExitBlip(businessId);
removePlayersFromBusiness(businessId); removePlayersFromBusiness(businessId);
getServerData().businesses.splice(businessId, 1);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -705,9 +707,9 @@ function removePlayerFromBusinesses(client) {
function exitBusiness(client) { function exitBusiness(client) {
let businessId = getEntityData(client, "ag.inBusiness"); let businessId = getEntityData(client, "ag.inBusiness");
if(isPlayerSpawned(client)) { if(isPlayerSpawned(client)) {
triggerNetworkEvent("ag.interior", client, getServerData().businesses[businessId].entranceInterior); setPlayerInterior(client, getServerData().businesses[businessId].entranceInterior);
triggerNetworkEvent("ag.dimension", client, getServerData().businesses[businessId].entranceDimension); setPlayerVirtualWorld(client, client, getServerData().businesses[businessId].entranceDimension);
triggerNetworkEvent("ag.position", client, getServerData().businesses[businessId].entrancePosition); setPlayerPosition(client, client, getServerData().businesses[businessId].entrancePosition);
} }
removeEntityData(client, "ag.inBusiness"); removeEntityData(client, "ag.inBusiness");
} }
@@ -750,7 +752,6 @@ function doesBusinessHaveInterior(businessId) {
// return false; // return false;
//} //}
let businessData = getBusinessData(businessId);
//if(businessData.exitPosition == toVector3(0.0, 0.0, 0.0)) { //if(businessData.exitPosition == toVector3(0.0, 0.0, 0.0)) {
// return false; // return false;
//} //}
@@ -759,11 +760,11 @@ function doesBusinessHaveInterior(businessId) {
// return false; // return false;
//} //}
if(businessData.exitInterior == 0) { if(getBusinessData(businessId).exitInterior == 0) {
return false; return false;
} }
if(businessData.exitInterior == -1) { if(getBusinessData(businessId).exitInterior == -1) {
return false; return false;
} }

View File

@@ -18,7 +18,7 @@ function initChatScript() {
function meActionCommand(command, params, client) { function meActionCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -30,7 +30,7 @@ function meActionCommand(command, params, client) {
function doActionCommand(command, params, client) { function doActionCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -42,7 +42,7 @@ function doActionCommand(command, params, client) {
function shoutCommand(command, params, client) { function shoutCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -54,7 +54,7 @@ function shoutCommand(command, params, client) {
function talkCommand(command, params, client) { function talkCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -66,7 +66,7 @@ function talkCommand(command, params, client) {
function whisperCommand(command, params, client) { function whisperCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -78,7 +78,7 @@ function whisperCommand(command, params, client) {
function adminChatCommand(command, params, client) { function adminChatCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -89,7 +89,7 @@ function adminChatCommand(command, params, client) {
function clanChatCommand(command, params, client) { function clanChatCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -102,7 +102,7 @@ function talkToNearbyPlayers(client, messageText) {
let clients = getClientsInRange(client.player.position, getGlobalConfig().talkDistance); let clients = getClientsInRange(client.player.position, getGlobalConfig().talkDistance);
for(let i in clients) { for(let i in clients) {
//if(clients[i] != client) { //if(clients[i] != client) {
messageClientTalk(getClientFromPlayerElement(clients[i]), client, messageText); messagePlayerTalk(getClientFromPlayerElement(clients[i]), client, messageText);
//} //}
} }
} }
@@ -113,7 +113,7 @@ function whisperToNearbyPlayers(client, messageText) {
let clients = getClientsInRange(client.player.position, getGlobalConfig().talkDistance); let clients = getClientsInRange(client.player.position, getGlobalConfig().talkDistance);
for(let i in clients) { for(let i in clients) {
//if(clients[i] != client) { //if(clients[i] != client) {
messageClientWhisper(getClientFromPlayerElement(clients[i]), client, messageText); messagePlayerWhisper(getClientFromPlayerElement(clients[i]), client, messageText);
//} //}
} }
} }
@@ -124,7 +124,7 @@ function shoutToNearbyPlayers(client, messageText) {
let clients = getClientsInRange(client.player.position, getGlobalConfig().shoutDistance); let clients = getClientsInRange(client.player.position, getGlobalConfig().shoutDistance);
for(let i in clients) { for(let i in clients) {
//if(clients[i].index != client.index) { //if(clients[i].index != client.index) {
messageClientShout(getClientFromPlayerElement(clients[i]), client, messageText); messagePlayerShout(getClientFromPlayerElement(clients[i]), client, messageText);
//} //}
} }
} }
@@ -135,7 +135,7 @@ function doActionToNearbyPlayers(client, messageText) {
let clients = getClientsInRange(client.player.position, getGlobalConfig().doActionDistance); let clients = getClientsInRange(client.player.position, getGlobalConfig().doActionDistance);
for(let i in clients) { for(let i in clients) {
//if(clients[i].index != client.index) { //if(clients[i].index != client.index) {
messageClientDoAction(getClientFromPlayerElement(clients[i]), client, messageText); messagePlayerDoAction(getClientFromPlayerElement(clients[i]), client, messageText);
//} //}
} }
} }
@@ -146,7 +146,7 @@ function meActionToNearbyPlayers(client, messageText) {
let clients = getClientsInRange(client.player.position, getGlobalConfig().meActionDistance); let clients = getClientsInRange(client.player.position, getGlobalConfig().meActionDistance);
for(let i in clients) { for(let i in clients) {
//if(clients[i].index != client.index) { //if(clients[i].index != client.index) {
messageClientMeAction(getClientFromPlayerElement(clients[i]), client, messageText); messagePlayerMeAction(getClientFromPlayerElement(clients[i]), client, messageText);
//} //}
} }
} }
@@ -156,7 +156,7 @@ function meActionToNearbyPlayers(client, messageText) {
function clanChat(client, messageText) { function clanChat(client, messageText) {
let clients = getClients(); let clients = getClients();
for(let i in clients) { for(let i in clients) {
if(getClientCurrentSubAccount(client).clan != getClientCurrentSubAccount(clients[i]).clan) { if(getPlayerCurrentSubAccount(client).clan != getPlayerCurrentSubAccount(clients[i]).clan) {
messageClientClanChat(getClientFromPlayerElement(clients[i]), client, messageText); messageClientClanChat(getClientFromPlayerElement(clients[i]), client, messageText);
} }
} }

View File

@@ -49,36 +49,36 @@ function loadClansFromDatabase() {
function createClanCommand(command, params, client) { function createClanCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
if(doesClanNameExist(params)) { if(doesClanNameExist(params)) {
messageClientError(client, "A clan with that name already exists!"); messagePlayerError(client, "A clan with that name already exists!");
return false; return false;
} }
// Create clan without owner. Can set owner with /clanowner afterward // Create clan without owner. Can set owner with /clanowner afterward
createClan(params); createClan(params);
messageClientSuccess(client, `The [#FF9900]${params} [#FFFFFF]clan has been created!`); messagePlayerSuccess(client, `The [#FF9900]${params} [#FFFFFF]clan has been created!`);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function deleteClanCommand(command, params, client) { function deleteClanCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let clanId = getClanFromParams(params); let clanId = getClanFromParams(params);
if(!getClanData(clanId)) { if(!getClanData(clanId)) {
messageClientError(client, "That clan ID does not exist!"); messagePlayerError(client, "That clan ID does not exist!");
return false; return false;
} }
messageClientSuccess(client, `The [#FF9900]${getClanData(clanId).name} [#FFFFFF]clan has been deleted!`); messagePlayerSuccess(client, `The [#FF9900]${getClanData(clanId).name} [#FFFFFF]clan has been deleted!`);
deleteClan(clanId); deleteClan(clanId);
} }
@@ -86,12 +86,12 @@ function deleteClanCommand(command, params, client) {
function setClanOwnerCommand(command, params, client) { function setClanOwnerCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("owner"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("owner"))) {
messageClientError(client, "You must be the clan owner to use this command!"); messagePlayerError(client, "You must be the clan owner to use this command!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
} }
@@ -100,12 +100,12 @@ function setClanOwnerCommand(command, params, client) {
function setClanTagCommand(command, params, client) { function setClanTagCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("clanTag"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("clanTag"))) {
messageClientError(client, "You can not change the clan tag!"); messagePlayerError(client, "You can not change the clan tag!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
} }
@@ -114,12 +114,12 @@ function setClanTagCommand(command, params, client) {
function setClanNameCommand(command, params, client) { function setClanNameCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("clanName"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("clanName"))) {
messageClientError(client, "You can not change the clan name!"); messagePlayerError(client, "You can not change the clan name!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
} }
@@ -128,12 +128,12 @@ function setClanNameCommand(command, params, client) {
function setClanMemberTagCommand(command, params, client) { function setClanMemberTagCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("memberTag"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("memberTag"))) {
messageClientError(client, "You can not change a clan member's tag!"); messagePlayerError(client, "You can not change a clan member's tag!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
} }
@@ -142,12 +142,12 @@ function setClanMemberTagCommand(command, params, client) {
function setClanRankTagCommand(command, params, client) { function setClanRankTagCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("rankTag"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("rankTag"))) {
messageClientError(client, "You can not change a clan ranks's tag!"); messagePlayerError(client, "You can not change a clan ranks's tag!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -156,14 +156,14 @@ function setClanRankTagCommand(command, params, client) {
let clanId = getPlayerClan(client); let clanId = getPlayerClan(client);
if(!getClanData(clanId)) { if(!getClanData(clanId)) {
messageClientError(client, "Clan not found!"); messagePlayerError(client, "Clan not found!");
return false; return false;
} }
let rankId = getClanRankFromParams(clanId, splitParams[0]); let rankId = getClanRankFromParams(clanId, splitParams[0]);
if(!getClanRankData(clanId, rankId)) { if(!getClanRankData(clanId, rankId)) {
messageClientError(client, "Clan rank not found!"); messagePlayerError(client, "Clan rank not found!");
return false; return false;
} }
} }
@@ -172,214 +172,214 @@ function setClanRankTagCommand(command, params, client) {
function addClanMemberFlagCommand(command, params, client) { function addClanMemberFlagCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("memberFlags"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("memberFlags"))) {
messageClientError(client, "You can not change a clan member's permissions!"); messagePlayerError(client, "You can not change a clan member's permissions!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let clanId = getPlayerClan(client); let clanId = getPlayerClan(client);
if(!getClanData(clanId)) { if(!getClanData(clanId)) {
messageClientError(client, "Clan not found!"); messagePlayerError(client, "Clan not found!");
return false; return false;
} }
let targetClient = getPlayerFromParams(splitParams[0]); let targetClient = getPlayerFromParams(splitParams[0]);
if(!targetClient) { if(!targetClient) {
messageClientError(client, "Clan member not found!"); messagePlayerError(client, "Clan member not found!");
return false; return false;
} }
if(!getClanFlagValue(splitParams[1])) { if(!getClanFlagValue(splitParams[1])) {
messageClientError(client, "Clan flag not found!"); messagePlayerError(client, "Clan flag not found!");
return false; return false;
} }
let flagValue = getClanFlagValue(splitParams[1]); let flagValue = getClanFlagValue(splitParams[1]);
getClientCurrentSubAccount(client).clanFlags = getClientCurrentSubAccount(client).clanFlags | flagValue; getPlayerCurrentSubAccount(client).clanFlags = getPlayerCurrentSubAccount(client).clanFlags | flagValue;
messageClientSuccess(client, `You added the [#AAAAAA]${splitParams[1]} [#FFFFFF]clan flag to [#AAAAAA]${getCharacterFullName(client)}`); messagePlayerSuccess(client, `You added the [#AAAAAA]${splitParams[1]} [#FFFFFF]clan flag to [#AAAAAA]${getCharacterFullName(client)}`);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function removeClanMemberFlagCommand(command, params, client) { function removeClanMemberFlagCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("memberFlags"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("memberFlags"))) {
messageClientError(client, "You can not change a clan member's permissions!"); messagePlayerError(client, "You can not change a clan member's permissions!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let clanId = getPlayerClan(client); let clanId = getPlayerClan(client);
if(!getClanData(clanId)) { if(!getClanData(clanId)) {
messageClientError(client, "Clan not found!"); messagePlayerError(client, "Clan not found!");
return false; return false;
} }
let targetClient = getPlayerFromParams(splitParams[0]); let targetClient = getPlayerFromParams(splitParams[0]);
if(!targetClient) { if(!targetClient) {
messageClientError(client, "Clan member not found!"); messagePlayerError(client, "Clan member not found!");
return false; return false;
} }
if(!getClanFlagValue(splitParams[1])) { if(!getClanFlagValue(splitParams[1])) {
messageClientError(client, "Clan flag not found!"); messagePlayerError(client, "Clan flag not found!");
return false; return false;
} }
let flagValue = getClanFlagValue(splitParams[1]); let flagValue = getClanFlagValue(splitParams[1]);
getClientCurrentSubAccount(client).clanFlags = getClientCurrentSubAccount(client).clanFlags & ~flagValue; getPlayerCurrentSubAccount(client).clanFlags = getPlayerCurrentSubAccount(client).clanFlags & ~flagValue;
messageClientSuccess(client, `You removed the [#AAAAAA]${splitParams[1]} [#FFFFFF]clan flag from [#AAAAAA]${getCharacterFullName(client)}`); messagePlayerSuccess(client, `You removed the [#AAAAAA]${splitParams[1]} [#FFFFFF]clan flag from [#AAAAAA]${getCharacterFullName(client)}`);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function addClanRankFlagCommand(command, params, client) { function addClanRankFlagCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("rankFlags"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("rankFlags"))) {
messageClientError(client, "You can not change a clan rank's permissions!"); messagePlayerError(client, "You can not change a clan rank's permissions!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let clanId = getPlayerClan(client); let clanId = getPlayerClan(client);
if(!getClanData(clanId)) { if(!getClanData(clanId)) {
messageClientError(client, "Clan not found!"); messagePlayerError(client, "Clan not found!");
return false; return false;
} }
let rankId = getClanRankFromParams(clanId, splitParams[0]); let rankId = getClanRankFromParams(clanId, splitParams[0]);
if(!getClanRankData(clanId, rankId)) { if(!getClanRankData(clanId, rankId)) {
messageClientError(client, "Clan rank not found!"); messagePlayerError(client, "Clan rank not found!");
return false; return false;
} }
if(!getClanFlagValue(splitParams[1])) { if(!getClanFlagValue(splitParams[1])) {
messageClientError(client, "Clan flag not found!"); messagePlayerError(client, "Clan flag not found!");
return false; return false;
} }
let flagValue = getClanFlagValue(splitParams[1]); let flagValue = getClanFlagValue(splitParams[1]);
getClanRankData(clanId, rankId).flags = getClanRankData(clanId, rankId).flags | flagValue; getClanRankData(clanId, rankId).flags = getClanRankData(clanId, rankId).flags | flagValue;
messageClientSuccess(client, `You added the [#AAAAAA]${splitParams[1]} [#FFFFFF]clan flag to rank [#AAAAAA]${getClanRankData(clanId, rankId).name}`); messagePlayerSuccess(client, `You added the [#AAAAAA]${splitParams[1]} [#FFFFFF]clan flag to rank [#AAAAAA]${getClanRankData(clanId, rankId).name}`);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function removeClanRankFlagCommand(command, params, client) { function removeClanRankFlagCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("rankFlags"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("rankFlags"))) {
messageClientError(client, "You can not change a clan rank's permissions!"); messagePlayerError(client, "You can not change a clan rank's permissions!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let clanId = getPlayerClan(client); let clanId = getPlayerClan(client);
if(!getClanData(clanId)) { if(!getClanData(clanId)) {
messageClientError(client, "Clan not found!"); messagePlayerError(client, "Clan not found!");
return false; return false;
} }
let rankId = getClanRankFromParams(clanId, splitParams[0]); let rankId = getClanRankFromParams(clanId, splitParams[0]);
if(!getClanRankData(clanId, rankId)) { if(!getClanRankData(clanId, rankId)) {
messageClientError(client, "Clan rank not found!"); messagePlayerError(client, "Clan rank not found!");
return false; return false;
} }
if(!getClanFlagValue(splitParams[1])) { if(!getClanFlagValue(splitParams[1])) {
messageClientError(client, "Clan flag not found!"); messagePlayerError(client, "Clan flag not found!");
return false; return false;
} }
let flagValue = getClanFlagValue(splitParams[1]); let flagValue = getClanFlagValue(splitParams[1]);
getClanRankData(clanId, rankId).flags = getClanRankData(clanId, rankId).flags & ~flagValue; getClanRankData(clanId, rankId).flags = getClanRankData(clanId, rankId).flags & ~flagValue;
messageClientSuccess(client, `You removed the [#AAAAAA]${splitParams[1]} [#FFFFFF]clan flag from rank [#AAAAAA]${getClanRankData(clanId, rankId).name}`); messagePlayerSuccess(client, `You removed the [#AAAAAA]${splitParams[1]} [#FFFFFF]clan flag from rank [#AAAAAA]${getClanRankData(clanId, rankId).name}`);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function setClanMemberTitleCommand(command, params, client) { function setClanMemberTitleCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("memberTitle"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("memberTitle"))) {
messageClientError(client, "You can not change a clan member's title!"); messagePlayerError(client, "You can not change a clan member's title!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let clanId = getPlayerClan(client); let clanId = getPlayerClan(client);
if(!getClanData(clanId)) { if(!getClanData(clanId)) {
messageClientError(client, "Clan not found!"); messagePlayerError(client, "Clan not found!");
return false; return false;
} }
let rankId = getClanRankFromParams(clanId); let rankId = getClanRankFromParams(clanId);
if(!getClanRankData(clanId, rankId)) { if(!getClanRankData(clanId, rankId)) {
messageClientError(client, "Clan rank not found!"); messagePlayerError(client, "Clan rank not found!");
return false; return false;
} }
let oldMemberTitle = getClientCurrentSubAccount(client).clanTitle; let oldMemberTitle = getPlayerCurrentSubAccount(client).clanTitle;
getClientCurrentSubAccount(client).clanTitle = params; getPlayerCurrentSubAccount(client).clanTitle = params;
messageClientSuccess(client, `You changed the name of [#AAAAAA]${getCharacterFullName(client)} [#FFFFFF]from [#AAAAAA]${oldMemberTitle} [#FFFFFF]to [#AAAAAA]${params}`); messagePlayerSuccess(client, `You changed the name of [#AAAAAA]${getCharacterFullName(client)} [#FFFFFF]from [#AAAAAA]${oldMemberTitle} [#FFFFFF]to [#AAAAAA]${params}`);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function setClanRankTitleCommand(command, params, client) { function setClanRankTitleCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("rankTitle"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("rankTitle"))) {
messageClientError(client, "You can not change your clan's rank titles!"); messagePlayerError(client, "You can not change your clan's rank titles!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let clanId = getPlayerClan(client); let clanId = getPlayerClan(client);
if(!getClanData(clanId)) { if(!getClanData(clanId)) {
messageClientError(client, "Clan not found!"); messagePlayerError(client, "Clan not found!");
return false; return false;
} }
let rankId = getClanRankFromParams(clanId); let rankId = getClanRankFromParams(clanId);
if(!getClanRankData(clanId, rankId)) { if(!getClanRankData(clanId, rankId)) {
messageClientError(client, "Clan rank not found!"); messagePlayerError(client, "Clan rank not found!");
return false; return false;
} }
let oldRankName = getClanRankData(clanId, rankId).name; let oldRankName = getClanRankData(clanId, rankId).name;
getClanRankData(clanId, rankId).name = params; getClanRankData(clanId, rankId).name = params;
messageClientSuccess(client, `You changed the name of rank ${rankId} from [#AAAAAA]${oldRankName} [#FFFFFF]to [#AAAAAA]${params}`); messagePlayerSuccess(client, `You changed the name of rank ${rankId} from [#AAAAAA]${oldRankName} [#FFFFFF]to [#AAAAAA]${params}`);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -135,7 +135,7 @@ addNetworkHandler("ag.arrivedAtBusStop", function(client) {
addNetworkHandler("ag.clientReady", function(client) { addNetworkHandler("ag.clientReady", function(client) {
client.setData("ag.isReady", true, false); client.setData("ag.isReady", true, false);
console.log(`${getClientDisplayForConsole(client)}'s client resources are downloaded and ready!`); console.log(`${getPlayerDisplayForConsole(client)}'s client resources are downloaded and ready!`);
if(client.getData("ag.isStarted") == true) { if(client.getData("ag.isStarted") == true) {
initClient(client); initClient(client);
} }
@@ -145,7 +145,7 @@ addNetworkHandler("ag.clientReady", function(client) {
addNetworkHandler("ag.clientStarted", function(client) { addNetworkHandler("ag.clientStarted", function(client) {
client.setData("ag.isStarted", true, false); client.setData("ag.isStarted", true, false);
console.log(`${getClientDisplayForConsole(client)}'s client resources are started and running!`); console.log(`${getPlayerDisplayForConsole(client)}'s client resources are started and running!`);
if(client.getData("ag.isReady") == true) { if(client.getData("ag.isReady") == true) {
initClient(client); initClient(client);
} }

View File

@@ -46,6 +46,9 @@ let serverColours = {
burntOrange: toColour(210, 120, 0, 255), burntOrange: toColour(210, 120, 0, 255),
bankGreen: toColour(0, 150, 0, 255), bankGreen: toColour(0, 150, 0, 255),
softYellow: toColour(234, 198, 126, 255), softYellow: toColour(234, 198, 126, 255),
businessBlue: toColour(0, 153, 255, 255),
houseGreen: toColour(17, 204, 17, 255),
clanOrange: toColour(255, 153, 0, 255),
} }
}; };
@@ -71,11 +74,11 @@ function getColourByName(colourName) {
function getPlayerColour(client) { function getPlayerColour(client) {
if(getPlayerData(client) != false) { if(getPlayerData(client) != false) {
if(!isClientLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
return getColourByName("darkGrey"); return getColourByName("darkGrey");
} else { } else {
if(isPlayerWorking(client)) { if(isPlayerWorking(client)) {
return getJobData(getClientCurrentSubAccount(client).job).colour; return getJobData(getPlayerCurrentSubAccount(client).job).colour;
} }
} }
} }

View File

@@ -329,19 +329,19 @@ function isCommandAllowedOnDiscord(command) {
function disableCommand(command, params, client) { function disableCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
params = toLowerCase(params); params = toLowerCase(params);
if(!getCommand(params)) { if(!getCommand(params)) {
messageClientError(client, `The command [#AAAAAA]/${params} [#FFFFFF] does not exist!`); messagePlayerError(client, `The command [#AAAAAA]/${params} [#FFFFFF] does not exist!`);
return false; return false;
} }
getCommand(params).enabled = false; getCommand(params).enabled = false;
messageClientSuccess(client, `Command [#AAAAAA]/${params} [#FFFFFF]has been disabled!`); messagePlayerSuccess(client, `Command [#AAAAAA]/${params} [#FFFFFF]has been disabled!`);
return true; return true;
} }
@@ -349,19 +349,19 @@ function disableCommand(command, params, client) {
function enableCommand(command, params, client) { function enableCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
params = toLowerCase(params); params = toLowerCase(params);
if(!getCommand(params)) { if(!getCommand(params)) {
messageClientError(client, `The command [#AAAAAA]/${params} [#FFFFFF] does not exist!`); messagePlayerError(client, `The command [#AAAAAA]/${params} [#FFFFFF] does not exist!`);
return false; return false;
} }
getCommand(params).enabled = true; getCommand(params).enabled = true;
messageClientSuccess(client, `Command [#AAAAAA]/${params} [#FFFFFF]has been enabled!`); messagePlayerSuccess(client, `Command [#AAAAAA]/${params} [#FFFFFF]has been enabled!`);
return true; return true;
} }
@@ -369,14 +369,14 @@ function enableCommand(command, params, client) {
function disableAllCommandsByType(command, params, client) { function disableAllCommandsByType(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
params = toLowerCase(params); params = toLowerCase(params);
if(isNull(getServerData().commands[params])) { if(isNull(getServerData().commands[params])) {
messageClientError(client, `Command type [#AAAAAA]${params} [#FFFFFF]does not exist!`); messagePlayerError(client, `Command type [#AAAAAA]${params} [#FFFFFF]does not exist!`);
return false; return false;
} }
@@ -384,7 +384,7 @@ function disableAllCommandsByType(command, params, client) {
getServerData().commands[params][i].enabled = false; getServerData().commands[params][i].enabled = false;
} }
messageClientSuccess(client, `[#FF9900]All [#AAAAAA]${params} [#FFFFFF]commands have been disabled!`); messagePlayerSuccess(client, `[#FF9900]All [#AAAAAA]${params} [#FFFFFF]commands have been disabled!`);
return true; return true;
} }
@@ -392,14 +392,14 @@ function disableAllCommandsByType(command, params, client) {
function enableAllCommandsByType(command, params, client) { function enableAllCommandsByType(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
params = toLowerCase(params); params = toLowerCase(params);
if(isNull(getServerData().commands[params])) { if(isNull(getServerData().commands[params])) {
messageClientError(client, `Command type [#AAAAAA]${params} [#FFFFFF]does not exist!`); messagePlayerError(client, `Command type [#AAAAAA]${params} [#FFFFFF]does not exist!`);
return false; return false;
} }
@@ -407,7 +407,7 @@ function enableAllCommandsByType(command, params, client) {
getServerData().commands[params][i].enabled = true; getServerData().commands[params][i].enabled = true;
} }
messageClientSuccess(client, `[#FF9900]All [#AAAAAA]${params} [#FFFFFF]commands have been enabled!`); messagePlayerSuccess(client, `[#FF9900]All [#AAAAAA]${params} [#FFFFFF]commands have been enabled!`);
return true; return true;
} }
@@ -422,40 +422,40 @@ function onPlayerCommand(event, client, command, params) {
} }
if(!commandData) { if(!commandData) {
console.warn(`[Asshat.Command] ${getClientDisplayForConsole(client)} attempted to use command, but failed (invalid command): /${command} ${paramsDisplay}`); console.warn(`[Asshat.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (invalid command): /${command} ${paramsDisplay}`);
messageClientError(client, `The command [#AAAAAA]/${command} [#FFFFFF]does not exist! Use /help for commands and information.`); messagePlayerError(client, `The command [#AAAAAA]/${command} [#FFFFFF]does not exist! Use /help for commands and information.`);
return false; return false;
} }
if(!commandData.enabled) { if(!commandData.enabled) {
console.warn(`[Asshat.Command] ${getClientDisplayForConsole(client)} attempted to use command, but failed (command is disabled): /${command} ${paramsDisplay}`); console.warn(`[Asshat.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (command is disabled): /${command} ${paramsDisplay}`);
messageClientError(client, `The command [#AAAAAA]/${command} [#FFFFFF]is disabled!`); messagePlayerError(client, `The command [#AAAAAA]/${command} [#FFFFFF]is disabled!`);
return false; return false;
} }
if(doesCommandRequireLogin(command)) { if(doesCommandRequireLogin(command)) {
if(!isClientLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
console.warn(`[Asshat.Command] ${getClientDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`); console.warn(`[Asshat.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`);
messageClientError(client, `You must be logged in to use the [#AAAAAA]/${command} [#FFFFFF]command!`); messagePlayerError(client, `You must be logged in to use the [#AAAAAA]/${command} [#FFFFFF]command!`);
return false; return false;
} }
} }
//if(isClientFromDiscord(client)) { //if(isClientFromDiscord(client)) {
// if(!isCommandAllowedOnDiscord(command)) { // if(!isCommandAllowedOnDiscord(command)) {
// console.warn(`[Asshat.Command] ${getClientDisplayForConsole(client)} attempted to use command from discord, but failed (not available on discord): /${command} ${paramsDisplay}`); // console.warn(`[Asshat.Command] ${getPlayerDisplayForConsole(client)} attempted to use command from discord, but failed (not available on discord): /${command} ${paramsDisplay}`);
// messageClientError(client, `The [#AAAAAA]/${command} [#FFFFFF] command isn't available on discord!`); // messagePlayerError(client, `The [#AAAAAA]/${command} [#FFFFFF] command isn't available on discord!`);
// return false; // return false;
// } // }
//} //}
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) { if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
console.warn(`[Asshat.Command] ${getClientDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`); console.warn(`[Asshat.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`);
messageClientError(client, `You do not have permission to use the [#AAAAAA]/${command} [#FFFFFF]command!`); messagePlayerError(client, `You do not have permission to use the [#AAAAAA]/${command} [#FFFFFF]command!`);
return false; return false;
} }
console.log(`[Asshat.Command] ${getClientDisplayForConsole(client)} used command: /${command} ${paramsDisplay}`); console.log(`[Asshat.Command] ${getPlayerDisplayForConsole(client)} used command: /${command} ${paramsDisplay}`);
commandData.handlerFunction(command, params, client); commandData.handlerFunction(command, params, client);
} }
addEventHandler("OnPlayerCommand", onPlayerCommand); addEventHandler("OnPlayerCommand", onPlayerCommand);
@@ -463,7 +463,7 @@ addEventHandler("OnPlayerCommand", onPlayerCommand);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
addCommandHandler("cmd", function(command, params, client) { addCommandHandler("cmd", function(command, params, client) {
if(!client.console) { if(!isConsole(client)) {
return false; return false;
} }

View File

@@ -332,19 +332,19 @@ function getServerId() {
function setTimeCommand(command, params, client) { function setTimeCommand(command, params, client) {
if(getCommand(command).requireLogin) { if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
messageClientError(client, "You must be logged in to use this command!"); messagePlayerError(client, "You must be logged in to use this command!");
return false; return false;
} }
} }
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) { if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
messageClientError(client, "You do not have permission to use this command!"); messagePlayerError(client, "You do not have permission to use this command!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -353,12 +353,12 @@ function setTimeCommand(command, params, client) {
let minute = toInteger(splitParams[1]) || 0; let minute = toInteger(splitParams[1]) || 0;
if(hour > 23 || hour < 0) { if(hour > 23 || hour < 0) {
messageClientError(client, "The hour must be between 0 and 23!"); messagePlayerError(client, "The hour must be between 0 and 23!");
return false; return false;
} }
if(minute > 59 || minute < 0) { if(minute > 59 || minute < 0) {
messageClientError(client, "The minute must be between 0 and 59!"); messagePlayerError(client, "The minute must be between 0 and 59!");
return false; return false;
} }
@@ -373,19 +373,19 @@ function setTimeCommand(command, params, client) {
function setWeatherCommand(command, params, client) { function setWeatherCommand(command, params, client) {
if(getCommand(command).requireLogin) { if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
messageClientError(client, "You must be logged in to use this command!"); messagePlayerError(client, "You must be logged in to use this command!");
return false; return false;
} }
} }
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) { if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
messageClientError(client, "You do not have permission to use this command!"); messagePlayerError(client, "You do not have permission to use this command!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -393,7 +393,7 @@ function setWeatherCommand(command, params, client) {
let weatherId = getWeatherFromParams(splitParams[0]); let weatherId = getWeatherFromParams(splitParams[0]);
if(!weatherId) { if(!weatherId) {
messageClientError(client, `That weather ID or name is invalid!`); messagePlayerError(client, `That weather ID or name is invalid!`);
return false; return false;
} }
@@ -408,19 +408,19 @@ function setWeatherCommand(command, params, client) {
function setSnowingCommand(command, params, client) { function setSnowingCommand(command, params, client) {
if(getCommand(command).requireLogin) { if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
messageClientError(client, "You must be logged in to use this command!"); messagePlayerError(client, "You must be logged in to use this command!");
return false; return false;
} }
} }
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) { if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
messageClientError(client, "You do not have permission to use this command!"); messagePlayerError(client, "You do not have permission to use this command!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -445,14 +445,14 @@ function setSnowingCommand(command, params, client) {
function toggleServerLogoCommand(command, params, client) { function toggleServerLogoCommand(command, params, client) {
if(getCommand(command).requireLogin) { if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
messageClientError(client, "You must be logged in to use this command!"); messagePlayerError(client, "You must be logged in to use this command!");
return false; return false;
} }
} }
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) { if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
messageClientError(client, "You do not have permission to use this command!"); messagePlayerError(client, "You do not have permission to use this command!");
return false; return false;
} }
@@ -469,14 +469,14 @@ function toggleServerLogoCommand(command, params, client) {
function toggleServerGUICommand(command, params, client) { function toggleServerGUICommand(command, params, client) {
if(getCommand(command).requireLogin) { if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
messageClientError(client, "You must be logged in to use this command!"); messagePlayerError(client, "You must be logged in to use this command!");
return false; return false;
} }
} }
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) { if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
messageClientError(client, "You do not have permission to use this command!"); messagePlayerError(client, "You do not have permission to use this command!");
return false; return false;
} }

View File

@@ -18,19 +18,19 @@ function initDeveloperScript() {
function simulateCommandForPlayer(command, params, client) { function simulateCommandForPlayer(command, params, client) {
if(getCommand(command).requireLogin) { if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
messageClientError(client, "You must be logged in to use this command!"); messagePlayerError(client, "You must be logged in to use this command!");
return false; return false;
} }
} }
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) { if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
messageClientError(client, "You do not have permission to use this command!"); messagePlayerError(client, "You do not have permission to use this command!");
return false; return false;
} }
if(areParamsEmpty(params) || !areThereEnoughParams(params, 2)) { if(areParamsEmpty(params) || !areThereEnoughParams(params, 2)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -41,17 +41,17 @@ function simulateCommandForPlayer(command, params, client) {
let tempParams = splitParams.slice(2).join(" "); let tempParams = splitParams.slice(2).join(" ");
if(!targetClient) { if(!targetClient) {
messageClientError(client, "Invalid player name or ID"); messagePlayerError(client, "Invalid player name or ID");
return false; return false;
} }
if(!getCommand(tempCommand)) { if(!getCommand(tempCommand)) {
messageClientError(client, `The command [#AAAAAA]/${command} [#FFFFFF]does not exist! Use /help for commands and information.`); messagePlayerError(client, `The command [#AAAAAA]/${command} [#FFFFFF]does not exist! Use /help for commands and information.`);
return false; return false;
} }
getCommand(toLowerCase(tempCommand)).handlerFunction(tempCommand, tempParams, targetClient); getCommand(toLowerCase(tempCommand)).handlerFunction(tempCommand, tempParams, targetClient);
messageClientSuccess(client, `The command string [#AAAAAA]/${tempCommand} ${tempParams}[#FFFFFF] has been simulated for [#AAAAAA]${targetClient.name}`); messagePlayerSuccess(client, `The command string [#AAAAAA]/${tempCommand} ${tempParams}[#FFFFFF] has been simulated for [#AAAAAA]${targetClient.name}`);
return true; return true;
} }
@@ -59,19 +59,19 @@ function simulateCommandForPlayer(command, params, client) {
function simulateCommandForAllPlayers(command, params, client) { function simulateCommandForAllPlayers(command, params, client) {
if(getCommand(command).requireLogin) { if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
messageClientError(client, "You must be logged in to use this command!"); messagePlayerError(client, "You must be logged in to use this command!");
return false; return false;
} }
} }
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) { if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
messageClientError(client, "You do not have permission to use this command!"); messagePlayerError(client, "You do not have permission to use this command!");
return false; return false;
} }
if(areParamsEmpty(params) || !areThereEnoughParams(params, 2)) { if(areParamsEmpty(params) || !areThereEnoughParams(params, 2)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -81,7 +81,7 @@ function simulateCommandForAllPlayers(command, params, client) {
let tempParams = splitParams.slice(1).join(" "); let tempParams = splitParams.slice(1).join(" ");
if(!getCommand(tempCommand)) { if(!getCommand(tempCommand)) {
messageClientError(client, `The command [#AAAAAA]/${command} [#FFFFFF]does not exist! Use /help for commands and information.`); messagePlayerError(client, `The command [#AAAAAA]/${command} [#FFFFFF]does not exist! Use /help for commands and information.`);
return false; return false;
} }
@@ -91,7 +91,7 @@ function simulateCommandForAllPlayers(command, params, client) {
getCommand(toLowerCase(tempCommand)).handlerFunction(tempCommand, tempParams, clients[i]); getCommand(toLowerCase(tempCommand)).handlerFunction(tempCommand, tempParams, clients[i]);
} }
} }
messageClientSuccess(client, `The command string [#AAAAAA]/${tempCommand} ${tempParams}[#FFFFFF] has been simulated for all players!`); messagePlayerSuccess(client, `The command string [#AAAAAA]/${tempCommand} ${tempParams}[#FFFFFF] has been simulated for all players!`);
return true; return true;
} }
@@ -99,19 +99,19 @@ function simulateCommandForAllPlayers(command, params, client) {
function executeServerCodeCommand(command, params, client) { function executeServerCodeCommand(command, params, client) {
if(getCommand(command).requireLogin) { if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
messageClientError(client, "You must be logged in to use this command!"); messagePlayerError(client, "You must be logged in to use this command!");
return false; return false;
} }
} }
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) { if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
messageClientError(client, "You do not have permission to use this command!"); messagePlayerError(client, "You do not have permission to use this command!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -119,13 +119,13 @@ function executeServerCodeCommand(command, params, client) {
try { try {
returnVal = eval("(" + params + ")"); returnVal = eval("(" + params + ")");
} catch(error) { } catch(error) {
messageClientError(client, "The code could not be executed!"); messagePlayerError(client, "The code could not be executed!");
return false; return false;
} }
messageClientSuccess(client, "Server code executed!"); messagePlayerSuccess(client, "Server code executed!");
messageClientNormal(client, `Code: ${params}`); messagePlayerNormal(client, `Code: ${params}`);
messageClientNormal(client, `Returns: ${returnVal}`); messagePlayerNormal(client, `Returns: ${returnVal}`);
return true; return true;
} }
@@ -133,19 +133,19 @@ function executeServerCodeCommand(command, params, client) {
function executeClientCodeCommand(command, params, client) { function executeClientCodeCommand(command, params, client) {
if(getCommand(command).requireLogin) { if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
messageClientError(client, "You must be logged in to use this command!"); messagePlayerError(client, "You must be logged in to use this command!");
return false; return false;
} }
} }
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) { if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
messageClientError(client, "You do not have permission to use this command!"); messagePlayerError(client, "You do not have permission to use this command!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -154,19 +154,19 @@ function executeClientCodeCommand(command, params, client) {
let targetCode = splitParams.slice(1).join(" "); let targetCode = splitParams.slice(1).join(" ");
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player was not found!"); messagePlayerError(client, "That player was not found!");
return false; return false;
} }
if(targetCode == "") { if(targetCode == "") {
messageClientError(client, "You didn't enter any code!"); messagePlayerError(client, "You didn't enter any code!");
return false; return false;
} }
triggerNetworkEvent("ag.runCode", targetClient, targetCode, client.index); triggerNetworkEvent("ag.runCode", targetClient, targetCode, client.index);
messageClientSuccess(client, "Executing client code for " + toString(targetClient.name) + "!"); messagePlayerSuccess(client, "Executing client code for " + toString(targetClient.name) + "!");
messageClientNormal(client, "Code: " + targetCode); messagePlayerNormal(client, "Code: " + targetCode);
return true; return true;
} }
@@ -196,8 +196,8 @@ addNetworkHandler("ag.runCodeFail", function(client, returnTo, code) {
return false; return false;
} }
messageClientError(returnClient, `Client code failed to execute for ${client.name}!`); messagePlayerError(returnClient, `Client code failed to execute for ${client.name}!`);
messageClientNormal(returnClient, `Code: ${code}`, getColourByName("yellow")); messagePlayerNormal(returnClient, `Code: ${code}`, getColourByName("yellow"));
}); });
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -208,9 +208,9 @@ addNetworkHandler("ag.runCodeSuccess", function(client, returnTo, returnVal, cod
return false; return false;
} }
messageClientSuccess(returnClient, `Client code executed for ${client.name}!`); messagePlayerSuccess(returnClient, `Client code executed for ${client.name}!`);
messageClientNormal(returnClient, `Code: ${code}`, getColourByName("yellow")); messagePlayerNormal(returnClient, `Code: ${code}`, getColourByName("yellow"));
messageClientNormal(returnClient, `Returns: ${returnVal}`, getColourByName("yellow")); messagePlayerNormal(returnClient, `Returns: ${returnVal}`, getColourByName("yellow"));
}); });
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -221,7 +221,7 @@ function submitIdea(client, ideaText) {
let session = 0; let session = 0;
let databaseId = 0; let databaseId = 0;
if(client.console) { if(isConsole(client)) {
databaseId = -1; databaseId = -1;
} else { } else {
databaseId = getPlayerData(client).accountData.databaseId; databaseId = getPlayerData(client).accountData.databaseId;
@@ -237,25 +237,13 @@ function submitIdea(client, ideaText) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function submitBugReport(client, bugText) { function submitBugReport(client, bugText) {
let position = toVector3(0.0, 0.0, 0.0); let position = (getPlayerVehicle(client)) ? getVehiclePosition(getPlayerVehicle(client)) : getPlayerPosition(client);
let heading = 0.0; let heading = (getPlayerVehicle(client)) ? getVehicleHeading(getPlayerVehicle(client)) : getPlayerHeading(client);
let session = 0; let session = 0;
let databaseId = 0; let databaseId = 0;
if(getEntityData(client, "ag.position")) { if(isConsole(client)) {
position = getEntityData(client, "ag.position"); databaseId = -1;
}
if(getEntityData(client, "ag.heading")) {
heading = getEntityData(client, "ag.heading");
}
if(getEntityData(client, "ag.session")) {
session = getEntityData(client, "ag.session");
}
if(client.console) {
databaseId = -1
} else { } else {
databaseId = getPlayerData(client).accountData.databaseId; databaseId = getPlayerData(client).accountData.databaseId;
} }

View File

@@ -12,17 +12,17 @@ addEventHandler("OnDiscordCommand", function(command, params, discordUser) {
let commandData = getCommand(command); let commandData = getCommand(command);
if(!commandData) { if(!commandData) {
messageClientError(discordUser, "That command does not exist!"); messagePlayerError(discordUser, "That command does not exist!");
return false; return false;
} }
if(isCommandAllowedOnDiscord(command)) { if(isCommandAllowedOnDiscord(command)) {
messageClientError(discordUser, "That command can not be used on Discord!"); messagePlayerError(discordUser, "That command can not be used on Discord!");
return false; return false;
} }
if(doesClientHavePermission(discordUser, getCommandRequiredPermissions(command))) { if(doesClientHavePermission(discordUser, getCommandRequiredPermissions(command))) {
messageClientError(discordUser, "You do not have permission to use that command!"); messagePlayerError(discordUser, "You do not have permission to use that command!");
return false; return false;
} }

View File

@@ -22,7 +22,7 @@ function initEventScript() {
addEventHandler("OnPlayerConnect", function(event, ipAddress, port) { addEventHandler("OnPlayerConnect", function(event, ipAddress, port) {
console.log(`[Asshat.Event] Client connecting (IP: ${ipAddress})`); console.log(`[Asshat.Event] Client connecting (IP: ${ipAddress})`);
if(isIpAddressBanned(ipAddress)) { if(isIpAddressBanned(ipAddress)) {
messageClientError(client, "You are banned from this server!"); messagePlayerError(client, "You are banned from this server!");
return false; return false;
} }
}); });
@@ -36,7 +36,7 @@ addEventHandler("OnPlayerJoined", function(event, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
addEventHandler("OnPlayerQuit", function(event, client, quitReasonId) { addEventHandler("OnPlayerQuit", function(event, client, quitReasonId) {
console.log(`[Asshat.Event] ${getClientDisplayForConsole(client)} disconnected (${disconnectReasons[quitReasonId]}[${quitReasonId}])`); console.log(`[Asshat.Event] ${getPlayerDisplayForConsole(client)} disconnected (${disconnectReasons[quitReasonId]}[${quitReasonId}])`);
savePlayerToDatabase(client); savePlayerToDatabase(client);
resetClientStuff(client); resetClientStuff(client);
@@ -50,7 +50,7 @@ addEventHandler("OnPlayerQuit", function(event, client, quitReasonId) {
addEventHandler("onPlayerChat", function(event, client, messageText) { addEventHandler("onPlayerChat", function(event, client, messageText) {
event.preventDefault(); event.preventDefault();
if(!getPlayerData(client).loggedIn) { if(!getPlayerData(client).loggedIn) {
messageClientError(client, "You need to login before you can chat!"); messagePlayerError(client, "You need to login before you can chat!");
return false; return false;
} }
@@ -78,26 +78,26 @@ addEventHandler("OnProcess", function(event, deltaTime) {
if(getPlayerData(clients[i]).buyingVehicle) { if(getPlayerData(clients[i]).buyingVehicle) {
if(getPlayerVehicle(clients[i]) == getPlayerData(clients[i]).buyingVehicle) { if(getPlayerVehicle(clients[i]) == getPlayerData(clients[i]).buyingVehicle) {
if(getDistance(getVehiclePosition(getPlayerData(clients[i]).buyingVehicle), getVehicleData(getPlayerData(clients[i]).buyingVehicle).spawnPosition) > getGlobalConfig().buyVehicleDriveAwayDistance) { if(getDistance(getVehiclePosition(getPlayerData(clients[i]).buyingVehicle), getVehicleData(getPlayerData(clients[i]).buyingVehicle).spawnPosition) > getGlobalConfig().buyVehicleDriveAwayDistance) {
if(getClientCurrentSubAccount(clients[i]).cash < getVehicleData(getPlayerData(clients[i]).buyingVehicle).buyPrice) { if(getPlayerCurrentSubAccount(clients[i]).cash < getVehicleData(getPlayerData(clients[i]).buyingVehicle).buyPrice) {
messageClientError(client, "You don't have enough money to buy this vehicle!"); messagePlayerError(client, "You don't have enough money to buy this vehicle!");
respawnVehicle(getPlayerData(clients[i]).buyingVehicle); respawnVehicle(getPlayerData(clients[i]).buyingVehicle);
getPlayerData(clients[i]).buyingVehicle = false; getPlayerData(clients[i]).buyingVehicle = false;
return false; return false;
} }
createNewDealershipVehicle(getVehicleData(getPlayerData(clients[i]).buyingVehicle).model, getVehicleData(getPlayerData(clients[i]).buyingVehicle).spawnPosition, getVehicleData(getPlayerData(clients[i]).buyingVehicle).spawnRotation, getVehicleData(getPlayerData(clients[i]).buyingVehicle).buyPrice, getVehicleData(getPlayerData(clients[i]).buyingVehicle).ownerId); createNewDealershipVehicle(getVehicleData(getPlayerData(clients[i]).buyingVehicle).model, getVehicleData(getPlayerData(clients[i]).buyingVehicle).spawnPosition, getVehicleData(getPlayerData(clients[i]).buyingVehicle).spawnRotation, getVehicleData(getPlayerData(clients[i]).buyingVehicle).buyPrice, getVehicleData(getPlayerData(clients[i]).buyingVehicle).ownerId);
getClientCurrentSubAccount(clients[i]).cash -= getVehicleData(getPlayerData(clients[i]).buyingVehicle).buyPrice; getPlayerCurrentSubAccount(clients[i]).cash -= getVehicleData(getPlayerData(clients[i]).buyingVehicle).buyPrice;
updatePlayerCash(clients[i]); updatePlayerCash(clients[i]);
getVehicleData(getPlayerData(clients[i]).buyingVehicle).ownerId = getClientCurrentSubAccount(clients[i]).databaseId; getVehicleData(getPlayerData(clients[i]).buyingVehicle).ownerId = getPlayerCurrentSubAccount(clients[i]).databaseId;
getVehicleData(getPlayerData(clients[i]).buyingVehicle).ownerType = AG_VEHOWNER_PLAYER; getVehicleData(getPlayerData(clients[i]).buyingVehicle).ownerType = AG_VEHOWNER_PLAYER;
getVehicleData(getPlayerData(clients[i]).buyingVehicle).buyPrice = 0; getVehicleData(getPlayerData(clients[i]).buyingVehicle).buyPrice = 0;
getVehicleData(getPlayerData(clients[i]).buyingVehicle).rentPrice = 0; getVehicleData(getPlayerData(clients[i]).buyingVehicle).rentPrice = 0;
getVehicleData(getPlayerData(clients[i]).buyingVehicle).spawnLocked = false; getVehicleData(getPlayerData(clients[i]).buyingVehicle).spawnLocked = false;
getPlayerData(clients[i]).buyingVehicle = false; getPlayerData(clients[i]).buyingVehicle = false;
messageClientSuccess(clients[i], "This vehicle is now yours! It will save wherever you leave it."); messagePlayerSuccess(clients[i], "This vehicle is now yours! It will save wherever you leave it.");
} }
} else { } else {
messageClientError(client, "You canceled the vehicle purchase by exiting the vehicle!"); messagePlayerError(client, "You canceled the vehicle purchase by exiting the vehicle!");
respawnVehicle(getPlayerData(clients[i]).buyingVehicle); respawnVehicle(getPlayerData(clients[i]).buyingVehicle);
getPlayerData(clients[i]).buyingVehicle = false; getPlayerData(clients[i]).buyingVehicle = false;
} }
@@ -126,12 +126,12 @@ addEventHandler("OnPedEnterVehicle", function(event, ped, vehicle, seat) {
if(getVehicleData(vehicle).locked) { if(getVehicleData(vehicle).locked) {
if(doesClientHaveVehicleKeys(client, vehicle)) { if(doesClientHaveVehicleKeys(client, vehicle)) {
messageClientNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked. Use /lock to unlock it`); messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked. Use /lock to unlock it`);
if(doesPlayerHaveKeyBindForCommand(client, "lock")) { if(doesPlayerHaveKeyBindForCommand(client, "lock")) {
messageClientTip(client, `You can also press [#AAAAAA]${sdl.getKeyName(getPlayerKeyBindForCommand(client, "lock").key)} [#FFFFFF]to lock and unlock vehicles.`); messagePlayerTip(client, `You can also press [#AAAAAA]${sdl.getKeyName(getPlayerKeyBindForCommand(client, "lock").key)} [#FFFFFF]to lock and unlock vehicles.`);
} }
} else { } else {
messageClientNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked and you don't have the keys to unlock it`); messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked and you don't have the keys to unlock it`);
} }
} }
} }
@@ -151,7 +151,7 @@ async function playerEnteredVehicle(client) {
return false; return false;
} }
console.log(`[Asshat.Event] ${getClientDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("ag.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`); console.log(`[Asshat.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("ag.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
getPlayerData(client).lastVehicle = vehicle; getPlayerData(client).lastVehicle = vehicle;
@@ -159,33 +159,33 @@ async function playerEnteredVehicle(client) {
vehicle.engine = getVehicleData(vehicle).engine; vehicle.engine = getVehicleData(vehicle).engine;
if(getVehicleData(vehicle).buyPrice > 0) { if(getVehicleData(vehicle).buyPrice > 0) {
messageClientAlert(client, `This ${getVehicleName(vehicle)} is for sale! Cost: [#AAAAAA]$${getVehicleData(vehicle).buyPrice}`); messagePlayerAlert(client, `This ${getVehicleName(vehicle)} is for sale! Cost: [#AAAAAA]$${getVehicleData(vehicle).buyPrice}`);
messageClientTip(client, `Use /vehbuy if you want to buy it.`); messagePlayerTip(client, `Use /vehbuy if you want to buy it.`);
} else if(getVehicleData(vehicle).rentPrice > 0) { } else if(getVehicleData(vehicle).rentPrice > 0) {
messageClientAlert(client, `This ${getVehicleName(vehicle)} is for rent! Cost: [#AAAAAA]$${getVehicleData(vehicle).rentPrice} per minute`); messagePlayerAlert(client, `This ${getVehicleName(vehicle)} is for rent! Cost: [#AAAAAA]$${getVehicleData(vehicle).rentPrice} per minute`);
messageClientTip(client, `Use /vehrent if you want to rent it.`); messagePlayerTip(client, `Use /vehrent if you want to rent it.`);
} else { } else {
if(!getVehicleData(vehicle).engine) { if(!getVehicleData(vehicle).engine) {
if(doesClientHaveVehicleKeys(client, vehicle)) { if(doesClientHaveVehicleKeys(client, vehicle)) {
messageClientAlert(client, `This ${getVehicleName(vehicle)}'s engine is off. Use /engine to start it`); messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off. Use /engine to start it`);
if(doesPlayerHaveKeyBindForCommand(client, "engine")) { if(doesPlayerHaveKeyBindForCommand(client, "engine")) {
messageClientTip(client, `You can also press [#AAAAAA]${sdl.getKeyName(getPlayerKeyBindForCommand(client, "engine").key)} [#FFFFFF]to start and stop the engine.`); messagePlayerTip(client, `You can also press [#AAAAAA]${sdl.getKeyName(getPlayerKeyBindForCommand(client, "engine").key)} [#FFFFFF]to start and stop the engine.`);
} }
} else { } else {
messageClientAlert(client, `This ${getVehicleName(vehicle)}'s engine is off and you don't have the keys to start it`); messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off and you don't have the keys to start it`);
} }
triggerNetworkEvent("ag.control", client, false, false); triggerNetworkEvent("ag.control", client, false, false);
} }
} }
let currentSubAccount = getClientCurrentSubAccount(client); let currentSubAccount = getPlayerCurrentSubAccount(client);
if(isPlayerWorking(client)) { if(isPlayerWorking(client)) {
if(getVehicleData(vehicle).ownerType == AG_VEHOWNER_JOB) { if(getVehicleData(vehicle).ownerType == AG_VEHOWNER_JOB) {
if(getVehicleData(vehicle).ownerId == getClientCurrentSubAccount(client).job) { if(getVehicleData(vehicle).ownerId == getPlayerCurrentSubAccount(client).job) {
//if(seat == 0) { //if(seat == 0) {
getClientCurrentSubAccount(client).lastJobVehicle = vehicle; getPlayerCurrentSubAccount(client).lastJobVehicle = vehicle;
//} //}
} }
} }
@@ -210,7 +210,7 @@ function playerExitedVehicle(client) {
return false; return false;
} }
console.log(`[Asshat.Event] ${getClientDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("ag.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`); console.log(`[Asshat.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("ag.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
if(isPlayerWorking(client)) { if(isPlayerWorking(client)) {
if(isPlayerOnJobRoute(client)) { if(isPlayerOnJobRoute(client)) {
@@ -232,11 +232,11 @@ function processPlayerDeath(client) {
triggerNetworkEvent("ag.fadeCamera", client, false, 1.0); triggerNetworkEvent("ag.fadeCamera", client, false, 1.0);
setTimeout(function() { setTimeout(function() {
client.despawnPlayer(); client.despawnPlayer();
if(getClientCurrentSubAccount(client).inJail) { if(getPlayerCurrentSubAccount(client).inJail) {
let closestJail = getClosestJail(getPlayerPosition(client)); let closestJail = getClosestJail(getPlayerPosition(client));
spawnPlayer(client, closestJail.position, closestJail.heading, getClientCurrentSubAccount(client).skin); spawnPlayer(client, closestJail.position, closestJail.heading, getPlayerCurrentSubAccount(client).skin);
} else { } else {
spawnPlayer(client, closestHospital.position, closestHospital.heading, getClientCurrentSubAccount(client).skin); spawnPlayer(client, closestHospital.position, closestHospital.heading, getPlayerCurrentSubAccount(client).skin);
} }
setTimeout(function() { setTimeout(function() {
setEntityData(client.player, "ag.spawned", true, true); setEntityData(client.player, "ag.spawned", true, true);

View File

@@ -114,128 +114,128 @@ function helpCommand(command, params, client) {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function showMainHelpMessage(client) { function showMainHelpMessage(client) {
messageClientInfo(client, "[#FF9900]== [#FFFF00]Help [#FF9900]================================="); messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Help [#FF9900]=================================");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Use /help <category> for commands and info. Example: [#AAAAAA]/help vehicle"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Use /help <category> for commands and info. Example: [#AAAAAA]/help vehicle");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Help Categories: [#A9A9A9]account, command, vehicle, job, chat, rules, website, anim"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Help Categories: [#A9A9A9]account, command, vehicle, job, chat, rules, website, anim");
messageClientNormal(client, "[#FF9900]• [#A9A9A9]ammunation, skins, mechanic, dealership, discord, colours, keys"); messagePlayerNormal(client, "[#FF9900]• [#A9A9A9]ammunation, skins, mechanic, dealership, discord, colours, keys");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function showAccountHelpMessage(client) { function showAccountHelpMessage(client) {
messageClientInfo(client, "[#FF9900]== [#FFFF00]Account Help [#FF9900]============================="); messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Account Help [#FF9900]=============================");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Do not share your password with anybody else."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Do not share your password with anybody else.");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Use [#AAAAAA]/changepass[#FFFFFF] to change your password."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Use [#AAAAAA]/changepass[#FFFFFF] to change your password.");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Some settings you can use: [#AAAAAA]/gui, /logo, /iplogin, /autolastchar, /2fa, /loginalert"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Some settings you can use: [#AAAAAA]/gui, /logo, /iplogin, /autolastchar, /2fa, /loginalert");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function showVehicleHelpMessage(client) { function showVehicleHelpMessage(client) {
messageClientInfo(client, "[#FF9900]== [#FFFF00]Vehicle Help [#FF9900]============================="); messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Vehicle Help [#FF9900]=============================");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Visit dealerships to buy new vehicles (Use [#AAAAAA]/help dealership [#FFFFFF]for more info."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Visit dealerships to buy new vehicles (Use [#AAAAAA]/help dealership [#FFFFFF]for more info.");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Some commands: [#AAAAAA]/lock, /engine, /lights, /trunk, /rentveh, /buyveh, /rentprice, /buyprice"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Some commands: [#AAAAAA]/lock, /engine, /lights, /trunk, /rentveh, /buyveh, /rentprice, /buyprice");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Your personal vehicles will save wherever you or somebody else leaves them!"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Your personal vehicles will save wherever you or somebody else leaves them!");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Visit a mechanic garage to repair, colour, and tune up your car! [#AAAAAA]/help mechanic [#FFFFFF] for info"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Visit a mechanic garage to repair, colour, and tune up your car! [#AAAAAA]/help mechanic [#FFFFFF] for info");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Don't forget to register and insure your vehicle! Use [#AAAAAA]/gps [#FFFFFF]to find a DMV for this."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Don't forget to register and insure your vehicle! Use [#AAAAAA]/gps [#FFFFFF]to find a DMV for this.");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function showVehicleDealershipHelpMessage(client) { function showVehicleDealershipHelpMessage(client) {
messageClientInfo(client, "[#FF9900]== [#FFFF00]Vehicle Dealerships [#FF9900]======================"); messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Vehicle Dealerships [#FF9900]======================");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Visit a vehicle dealer to buy new vehicles. Use [#AAAAAA]/gps [#FFFFFF]to find one."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Visit a vehicle dealer to buy new vehicles. Use [#AAAAAA]/gps [#FFFFFF]to find one.");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]At the dealer, simply enter a car you want to buy, and the price will be shown to you"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]At the dealer, simply enter a car you want to buy, and the price will be shown to you");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]If you want to buy the vehicle and have enough money, use [#AAAAAA]/buyveh [#FFFFFF]and you will be given keys"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]If you want to buy the vehicle and have enough money, use [#AAAAAA]/buyveh [#FFFFFF]and you will be given keys");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]A new car for sale will appear when you drive away from the dealer."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]A new car for sale will appear when you drive away from the dealer.");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function showJobHelpMessage(client) { function showJobHelpMessage(client) {
messageClientInfo(client, "[#FF9900]== [#FFFF00]Job Help [#FF9900]================================="); messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Job Help [#FF9900]=================================");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Visit job locations get a job and earn money. Look for yellow spots on the map"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Visit job locations get a job and earn money. Look for yellow spots on the map");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]At a job location, use [#AAAAAA]/takejob [#FFFFFF]to get the job. Use [#AAAAAA]/quitjob [#FFFFFF]to quit your job"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]At a job location, use [#AAAAAA]/takejob [#FFFFFF]to get the job. Use [#AAAAAA]/quitjob [#FFFFFF]to quit your job");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Use [#AAAAAA]/startwork [#FFFFFF]to begin working. You can also get a job [#AAAAAA]/uniform and [#AAAAAA]/equipment"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Use [#AAAAAA]/startwork [#FFFFFF]to begin working. You can also get a job [#AAAAAA]/uniform and [#AAAAAA]/equipment");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Most job vehicles are locked. Use [#AAAAAA]/lock [#FFFFFF]near one to enter it."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Most job vehicles are locked. Use [#AAAAAA]/lock [#FFFFFF]near one to enter it.");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]When entering a job vehicle, information on how to do the job will be shown to you."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]When entering a job vehicle, information on how to do the job will be shown to you.");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function showChatHelpMessage(client) { function showChatHelpMessage(client) {
messageClientInfo(client, "[#FF9900]== [#FFFF00]Chat Help [#FF9900]================================"); messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Chat Help [#FF9900]================================");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]There are two main types of chat: out-of-character (OOC) and in-character (IC)"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]There are two main types of chat: out-of-character (OOC) and in-character (IC)");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Mixing these two types is not proper roleplay. See [#AAAAAA]/rules [#FFFFFF]for info."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Mixing these two types is not proper roleplay. See [#AAAAAA]/rules [#FFFFFF]for info.");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Some chat commands: [#AAAAAA]/dm /whisper /talk /shout /me."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Some chat commands: [#AAAAAA]/dm /whisper /talk /shout /me.");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Some have shorter names available ([#AAAAAA]/t [#FFFFFF]for talk, [#AAAAAA]/s [#FFFFFF]for shout, etc)"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Some have shorter names available ([#AAAAAA]/t [#FFFFFF]for talk, [#AAAAAA]/s [#FFFFFF]for shout, etc)");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function showRulesHelpMessage(client) { function showRulesHelpMessage(client) {
messageClientInfo(client, "[#FF9900]== [#FFFF00]Server Rules [#FF9900]============================="); messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Server Rules [#FF9900]=============================");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Unrealistic actions (powergaming) are not allowed. You aren't superman."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Unrealistic actions (powergaming) are not allowed. You aren't superman.");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]No terrorist or terrorism roleplay is allowed."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]No terrorist or terrorism roleplay is allowed.");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Always follow instructions given by moderators and admins."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Always follow instructions given by moderators and admins.");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Do not mix the chats (metagaming). You can't use info in IC that was received OOC"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Do not mix the chats (metagaming). You can't use info in IC that was received OOC");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Keep English in main chats. If you aren't good at English, use [#AAAAAA]/help [#FFFFFF]language"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Keep English in main chats. If you aren't good at English, use [#AAAAAA]/help [#FFFFFF]language");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function showWebsiteHelpMessage(client) { function showWebsiteHelpMessage(client) {
messageClientInfo(client, "[#FF9900]== [#FFFF00]Website [#FF9900]============================="); messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Website [#FF9900]=============================");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]The website is [#AAAAAA]https://asshatgaming.com"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]The website is [#AAAAAA]https://asshatgaming.com");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function showDiscordHelpMessage(client) { function showDiscordHelpMessage(client) {
messageClientInfo(client, "[#FF9900]== [#FFFF00]Discord [#FF9900]============================="); messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Discord [#FF9900]=============================");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Join our discord! [#AAAAAA]https://discord.gg/4TQ3TGB529"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Join our discord! [#AAAAAA]https://discord.gg/4TQ3TGB529");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function showAnimationHelpMessage(client) { function showAnimationHelpMessage(client) {
messageClientInfo(client, "[#FF9900]== [#FFFF00]Animations [#FF9900]==============================="); messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Animations [#FF9900]===============================");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Animations are not yet available."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Animations are not yet available.");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function showAmmunationHelpMessage(client) { function showAmmunationHelpMessage(client) {
messageClientInfo(client, "[#FF9900]== [#FFFF00]Ammunation [#FF9900]==============================="); messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Ammunation [#FF9900]===============================");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Visit an ammunation to buy weapons. Use [#AAAAAA]/gps [#FFFFFF]to find one."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Visit an ammunation to buy weapons. Use [#AAAAAA]/gps [#FFFFFF]to find one.");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Buying a weapon requires a weapon license."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Buying a weapon requires a weapon license.");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Weapon licenses are managed by the police department. Apply there to get one."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Weapon licenses are managed by the police department. Apply there to get one.");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Weapons can also be purchased illegally from weapon dealers and clans."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Weapons can also be purchased illegally from weapon dealers and clans.");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function showClothesHelpMessage(client) { function showClothesHelpMessage(client) {
messageClientInfo(client, "[#FF9900]== [#FFFF00]Clothes [#FF9900]=================================="); messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Clothes [#FF9900]==================================");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]To change your skin, use [#AAAAAA]/gps [#FFFFFF]to find a clothing store"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]To change your skin, use [#AAAAAA]/gps [#FFFFFF]to find a clothing store");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]At a clothing store, use [#AAAAAA]/buyclothes [#FFFFFF]to choose a skin"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]At a clothing store, use [#AAAAAA]/buyclothes [#FFFFFF]to choose a skin");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Some skins are restricted to jobs, clans, or for other reasons."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Some skins are restricted to jobs, clans, or for other reasons.");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function showBindKeysHelpMessage(client) { function showBindKeysHelpMessage(client) {
messageClientInfo(client, "[#FF9900]== [#FFFF00]Bindable Keys [#FF9900]============================"); messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Bindable Keys [#FF9900]============================");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]You can set your own keys binds. Use [#AAAAAA]/keybinds [#FFFFFF]to add, remove, or change your keys."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]You can set your own keys binds. Use [#AAAAAA]/keybinds [#FFFFFF]to add, remove, or change your keys.");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Default keys are: [#0066FF]K [#FFFFFF]for engine, [#0066FF]I [#FFFFFF]for lights, and [#0066FF]L [#FFFFFF]for lock/unlock"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Default keys are: [#0066FF]K [#FFFFFF]for engine, [#0066FF]I [#FFFFFF]for lights, and [#0066FF]L [#FFFFFF]for lock/unlock");
messageClientNormal(client, "[#FF9900]• [#FFFFFF]Your keybinds will automatically be usable on all servers"); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Your keybinds will automatically be usable on all servers");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function showEnteredDriverSeatHasKeysHelpTip(client) { function showEnteredDriverSeatHasKeysHelpTip(client) {
if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.enteredDriverSeat) { if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.enteredDriverSeat) {
messageClientInfo(client, `You can press K for engine, I for lights, and L to lock/unlock the car.`); messagePlayerInfo(client, `You can press K for engine, I for lights, and L to lock/unlock the car.`);
getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.enteredDriverSeat; getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.enteredDriverSeat;
} }
} }
@@ -244,7 +244,7 @@ function showEnteredDriverSeatHasKeysHelpTip(client) {
function showApproachJobWhileUnemployedTip(client) { function showApproachJobWhileUnemployedTip(client) {
if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachJobWhileUnemployed) { if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachJobWhileUnemployed) {
messageClientTip(client, `Approach the icon and use /jobinfo to see details about this job.`); messagePlayerTip(client, `Approach the icon and use /jobinfo to see details about this job.`);
getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.approachJobWhileUnemployed; getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.approachJobWhileUnemployed;
} }
} }
@@ -253,7 +253,7 @@ function showApproachJobWhileUnemployedTip(client) {
function showTakeNearbyJobTip(client) { function showTakeNearbyJobTip(client) {
if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.takeJobWhileUnemployed) { if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.takeJobWhileUnemployed) {
messageClientTip(client, `You are nearby a job location. Look for the spinning icon.`); messagePlayerTip(client, `You are nearby a job location. Look for the spinning icon.`);
getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.takeJobWhileUnemployed; getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.takeJobWhileUnemployed;
} }
} }
@@ -262,8 +262,8 @@ function showTakeNearbyJobTip(client) {
function showApproachCurrentJobTip(client) { function showApproachCurrentJobTip(client) {
if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachCurrentJob) { if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachCurrentJob) {
//messageClientTip(client, `Press ${getServerConfig().keybindText.actionKey} to start working, or hold ${getServerConfig().keybindText.actionKey} to quit your job.`); //messagePlayerTip(client, `Press ${getServerConfig().keybindText.actionKey} to start working, or hold ${getServerConfig().keybindText.actionKey} to quit your job.`);
messageClientTip(client, `This job location is for your job. You can use /startwork to start working.`); messagePlayerTip(client, `This job location is for your job. You can use /startwork to start working.`);
getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.approachCurrentJob; getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.approachCurrentJob;
} }
} }
@@ -272,8 +272,8 @@ function showApproachCurrentJobTip(client) {
function showApproachOtherJobTip(client) { function showApproachOtherJobTip(client) {
if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachCurrentJob) { if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachCurrentJob) {
//messageClientTip(client, `Press ${getServerConfig().keybindText.actionKey} to start working, or hold ${getServerConfig().keybindText.actionKey} to quit your job.`); //messagePlayerTip(client, `Press ${getServerConfig().keybindText.actionKey} to start working, or hold ${getServerConfig().keybindText.actionKey} to quit your job.`);
messageClientTip(client, `This job location belongs to another job. If you want this job, use /quitjob first.`); messagePlayerTip(client, `This job location belongs to another job. If you want this job, use /quitjob first.`);
getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.approachCurrentJob; getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.approachCurrentJob;
} }
} }
@@ -282,8 +282,8 @@ function showApproachOtherJobTip(client) {
function showStartedWorkingTip(client) { function showStartedWorkingTip(client) {
if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.startedWorking) { if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.startedWorking) {
//messageClientTip(client, `Press ${getServerConfig().keybindText.actionKey} to change uniform, or hold ${getServerConfig().keybindText.actionKey} to stop working.`); //messagePlayerTip(client, `Press ${getServerConfig().keybindText.actionKey} to change uniform, or hold ${getServerConfig().keybindText.actionKey} to stop working.`);
messageClientTip(client, `Use /uniform to see job skins and /equip to see available jobs tools and weapons.`); messagePlayerTip(client, `Use /uniform to see job skins and /equip to see available jobs tools and weapons.`);
getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.startedWorking; getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.startedWorking;
} }
} }
@@ -292,7 +292,7 @@ function showStartedWorkingTip(client) {
function showApproachOwnedVehicleTip(client) { function showApproachOwnedVehicleTip(client) {
if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachOwnedVehicle) { if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachOwnedVehicle) {
messageClientTip(client, `This vehicle is owned by you.`); messagePlayerTip(client, `This vehicle is owned by you.`);
getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.approachOwnedVehicle; getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.approachOwnedVehicle;
} }
} }
@@ -301,7 +301,7 @@ function showApproachOwnedVehicleTip(client) {
function showApproachClanVehicleTip(client) { function showApproachClanVehicleTip(client) {
if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachAnyVehicle) { if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachAnyVehicle) {
messageClientTip(client, `Your clan owns this vehicle.`); messagePlayerTip(client, `Your clan owns this vehicle.`);
getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.approachAnyVehicle; getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.approachAnyVehicle;
} }
} }

View File

@@ -48,8 +48,11 @@ function loadHousesFromDatabase() {
function createHouseCommand(command, params, client) { function createHouseCommand(command, params, client) {
let tempHouseData = createHouse(params, getPlayerPosition(client), toVector3(0.0, 0.0, 0.0), getGameConfig().pickupModels[getServerGame()].house, getGameConfig().blipSprites[getServerGame()].house, getPlayerInterior(client), getPlayerVirtualWorld(client)); let tempHouseData = createHouse(params, getPlayerPosition(client), toVector3(0.0, 0.0, 0.0), getGameConfig().pickupModels[getServerGame()].house, getGameConfig().blipSprites[getServerGame()].house, getPlayerInterior(client), getPlayerVirtualWorld(client));
getServerData().houses.push(tempHouseData); getServerData().houses.push(tempHouseData);
sendHouseLabelToPlayers(getServerData().houses.length-1); createHouseEntrancePickup(getServerData().houses.length-1);
createHouseExitPickup(getServerData().houses.length-1);
createHouseEntranceBlip(getServerData().houses.length-1);
createHouseExitBlip(getServerData().houses.length-1);
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]created house [#11CC11]${tempHouseData.description}`); messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]created house [#11CC11]${tempHouseData.description}`);
} }
@@ -60,13 +63,13 @@ function lockUnlockHouseCommand(command, params, client) {
let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client))); let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)));
if(!getHouseData(houseId)) { if(!getHouseData(houseId)) {
messageClientError("House not found!"); messagePlayerError("House not found!");
return false; return false;
} }
getHouseData(houseId).locked = !getHouseData(houseId).locked; getHouseData(houseId).locked = !getHouseData(houseId).locked;
getHouseData(houseId).entrancePickup.setData("ag.label.locked", getHouseData(houseId).locked, true); getHouseData(houseId).entrancePickup.setData("ag.label.locked", getHouseData(houseId).locked, true);
messageClientSuccess(client, `House '${getHouseData(houseId).description}' ${getLockedUnlockedTextFromBool((getHouseData(houseId).locked))}!`); messagePlayerSuccess(client, `House '${getHouseData(houseId).description}' ${getLockedUnlockedTextFromBool((getHouseData(houseId).locked))}!`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -77,7 +80,7 @@ function setHouseDescriptionCommand(command, params, client) {
let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client))); let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)));
if(!getHouseData(houseId)) { if(!getHouseData(houseId)) {
messageClientError("House not found!"); messagePlayerError("House not found!");
return false; return false;
} }
@@ -94,12 +97,12 @@ function setHouseOwnerCommand(command, params, client) {
let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client))); let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)));
if(!newHouseOwner) { if(!newHouseOwner) {
messageClientError("Player not found!"); messagePlayerError("Player not found!");
return false; return false;
} }
if(!getHouseData(houseId)) { if(!getHouseData(houseId)) {
messageClientError("House not found!"); messagePlayerError("House not found!");
return false; return false;
} }
@@ -116,12 +119,12 @@ function setHouseClanCommand(command, params, client) {
let clan = getClanFromParams(params); let clan = getClanFromParams(params);
if(!clan) { if(!clan) {
messageClientError(client, "That clan is invalid or doesn't exist!"); messagePlayerError(client, "That clan is invalid or doesn't exist!");
return false; return false;
} }
if(!getHouseData(houseId)) { if(!getHouseData(houseId)) {
messageClientError("Business not found!"); messagePlayerError("Business not found!");
return false; return false;
} }
@@ -137,14 +140,14 @@ function setHousePickupCommand(command, params, client) {
let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client))); let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)));
if(!getHouseData(houseId)) { if(!getHouseData(houseId)) {
messageClientError(client, "Business not found!"); messagePlayerError(client, "Business not found!");
return false; return false;
} }
if(isNaN(typeParam)) { if(isNaN(typeParam)) {
if(isNull(getGameConfig().pickupModels[getServerGame()][typeParam])) { if(isNull(getGameConfig().pickupModels[getServerGame()][typeParam])) {
messageClientError(client, "Invalid house type! Use a house type name or a pickup model ID"); messagePlayerError(client, "Invalid house type! Use a house type name or a pickup model ID");
messageClientInfo(client, `Pickup Types: [#AAAAAA]${Object.keys(getGameConfig().pickupModels[getServerGame()]).join(", ")}`) messagePlayerInfo(client, `Pickup Types: [#AAAAAA]${Object.keys(getGameConfig().pickupModels[getServerGame()]).join(", ")}`)
return false; return false;
} }
@@ -171,14 +174,14 @@ function setHouseBlipCommand(command, params, client) {
let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client))); let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)));
if(!getHouseData(houseId)) { if(!getHouseData(houseId)) {
messageClientError(client, "Business not found!"); messagePlayerError(client, "Business not found!");
return false; return false;
} }
if(isNaN(typeParam)) { if(isNaN(typeParam)) {
if(isNull(getGameConfig().blipSprites[getServerGame()][typeParam])) { if(isNull(getGameConfig().blipSprites[getServerGame()][typeParam])) {
messageClientError(client, "Invalid house type! Use a house type name or a blip image ID"); messagePlayerError(client, "Invalid house type! Use a house type name or a blip image ID");
messageClientInfo(client, `Pickup Types: [#AAAAAA]${Object.keys(getGameConfig().blipSprites[getServerGame()]).join(", ")}`) messagePlayerInfo(client, `Pickup Types: [#AAAAAA]${Object.keys(getGameConfig().blipSprites[getServerGame()]).join(", ")}`)
return false; return false;
} }
@@ -231,7 +234,7 @@ function moveHouseExitCommand(command, params, client) {
createHouseExitBlip(houseId); createHouseExitBlip(houseId);
createHouseExitPickup(houseId); createHouseExitPickup(houseId);
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).name} [#FFFFFF]exit to their position`); messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]moved house [#11CC11]${getHouseData(houseId).name} [#FFFFFF]exit to their position`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -240,7 +243,7 @@ function deleteHouseCommand(command, params, client) {
let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client))); let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)));
if(!getHouseData(houseId)) { if(!getHouseData(houseId)) {
messageClientError("Business not found!"); messagePlayerError("Business not found!");
return false; return false;
} }
tempHouseData = getHouseData(houseId); tempHouseData = getHouseData(houseId);
@@ -258,7 +261,7 @@ function deleteHouse(houseId, whoDeleted = 0) {
let dbQuery = null; let dbQuery = null;
if(dbConnection) { if(dbConnection) {
dbQuery = queryDatabase(dbConnection, `UPDATE house_main SET house_deleted = 1 AND house_who_deleted = ${whoDeleted} AND house_when_deleted = UNIX_TIMESTAMP() WHERE house_id = ${tempHouseData.databaseId} LIMIT 1`); dbQuery = queryDatabase(dbConnection, `DELETE FROM house_main WHERE house_id = ${tempHouseData.databaseId}`);
if(dbQuery) { if(dbQuery) {
freeDatabaseQuery(dbQuery); freeDatabaseQuery(dbQuery);
} }
@@ -272,6 +275,8 @@ function deleteHouse(houseId, whoDeleted = 0) {
deleteHouseExitBlip(houseId); deleteHouseExitBlip(houseId);
removePlayersFromHouse(houseId); removePlayersFromHouse(houseId);
getServerData().houses.splice(houseId, 1);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -300,15 +305,7 @@ function createHouse(description, entrancePosition, exitPosition, entrancePickup
tempHouseData.exitPickupModel = exitPickupModel; tempHouseData.exitPickupModel = exitPickupModel;
tempHouseData.exitBlipModel = exitBlipModel; tempHouseData.exitBlipModel = exitBlipModel;
tempHouseData.exitInterior = exitInteriorId; tempHouseData.exitInterior = exitInteriorId;
tempHouseData.exitDimension = exitVirtualWorld; tempHouseData.exitDimension = exitVirtualWorld;
if(entrancePickupModel != -1) {
tempHouseData.entrancePickup = gta.createPickup(entrancePickupModel, entrancePosition, getGameConfig().pickupTypes[getServerGame()].house);
}
if(entranceBlipModel != -1) {
tempHouseData.entranceBlip = gta.createBlip(entrancePosition, entranceBlipModel, 1, getColourByName("lime"));
}
return tempHouseData; return tempHouseData;
} }
@@ -416,7 +413,7 @@ function createHouseEntrancePickup(houseId) {
getHouseData(houseId).entrancePickup.setData("ag.label.name", getHouseData(houseId).description, true); getHouseData(houseId).entrancePickup.setData("ag.label.name", getHouseData(houseId).description, true);
getHouseData(houseId).entrancePickup.setData("ag.label.locked", getHouseData(houseId).locked, true); getHouseData(houseId).entrancePickup.setData("ag.label.locked", getHouseData(houseId).locked, true);
if(getHouseData(houseId).buyPrice > 0) { if(getHouseData(houseId).buyPrice > 0) {
getBusinessData(businessId).entrancePickup.setData("ag.label.price", getHouseData(houseId), true); getHouseData(houseId).entrancePickup.setData("ag.label.price", getHouseData(houseId), true);
} }
} }
} }
@@ -473,7 +470,7 @@ function getHouseInfoCommand(command, params, client) {
} }
if(!getHouseData(houseId)) { if(!getHouseData(houseId)) {
messageClientError(client, "House not found!"); messagePlayerError(client, "House not found!");
return false; return false;
} }
@@ -501,7 +498,7 @@ function getHouseInfoCommand(command, params, client) {
break; break;
} }
messageClientNormal(client, `🏠 [#11CC11][House Info] [#FFFFFF]Description: [#AAAAAA]${getHouseData(houseId).description}, [#FFFFFF]Owner: [#AAAAAA]${ownerName} (${getHouseOwnerTypeText(getHouseData(houseId).ownerType)}), [#FFFFFF]Locked: [#AAAAAA]${getYesNoFromBool(intToBool(getHouseData(houseId).locked))}, [#FFFFFF]ID: [#AAAAAA]${houseId}/${getHouseData(houseId).databaseId}`); messagePlayerNormal(client, `🏠 [#11CC11][House Info] [#FFFFFF]Description: [#AAAAAA]${getHouseData(houseId).description}, [#FFFFFF]Owner: [#AAAAAA]${ownerName} (${getHouseOwnerTypeText(getHouseData(houseId).ownerType)}), [#FFFFFF]Locked: [#AAAAAA]${getYesNoFromBool(intToBool(getHouseData(houseId).locked))}, [#FFFFFF]ID: [#AAAAAA]${houseId}/${getHouseData(houseId).databaseId}`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -534,11 +531,11 @@ function doesHouseHaveInterior(houseId) {
// return false; // return false;
//} //}
if(houseData.exitInterior == 0) { if(getHouseData(houseId).exitInterior == 0) {
return false; return false;
} }
if(houseData.exitInterior == -1) { if(getHouseData(houseId).exitInterior == -1) {
return false; return false;
} }

View File

@@ -242,8 +242,8 @@ function showJobInformationToPlayer(client, jobType) {
return false; return false;
} }
if(jobType == getClientCurrentSubAccount(client).job) { if(jobType == getPlayerCurrentSubAccount(client).job) {
messageClientInfo("Welcome back to your job. Use /startwork to begin."); messagePlayerInfo("Welcome back to your job. Use /startwork to begin.");
return false; return false;
} }
@@ -253,63 +253,63 @@ function showJobInformationToPlayer(client, jobType) {
return false; return false;
} }
messageClientInfo(client, "== Job Help ================================="); messagePlayerInfo(client, "== Job Help =================================");
messageClientInfo(client, "- Police Officers are enforcers of the law."); messagePlayerInfo(client, "- Police Officers are enforcers of the law.");
messageClientInfo(client, "- Use /startwork at a police station to work as a Police Officer."); messagePlayerInfo(client, "- Use /startwork at a police station to work as a Police Officer.");
messageClientInfo(client, "- Use /laws to see a list of laws."); messagePlayerInfo(client, "- Use /laws to see a list of laws.");
messageClientInfo(client, "- Commands are: /cuff, /drag, /detain, /arrest, /search /tazer /radio"); messagePlayerInfo(client, "- Commands are: /cuff, /drag, /detain, /arrest, /search /tazer /radio");
messageClientInfo(client, "- When finished, use /stopwork to stop working."); messagePlayerInfo(client, "- When finished, use /stopwork to stop working.");
break; break;
case AG_JOB_MEDICAL: case AG_JOB_MEDICAL:
messageClientInfo(client, "== Job Help ================================="); messagePlayerInfo(client, "== Job Help =================================");
messageClientInfo(client, "- Paramedics help people by healing them."); messagePlayerInfo(client, "- Paramedics help people by healing them.");
messageClientInfo(client, "- Use /startwork at the hospital to work as a Paramedic."); messagePlayerInfo(client, "- Use /startwork at the hospital to work as a Paramedic.");
messageClientInfo(client, "- People can enter your ambulance to get healed."); messagePlayerInfo(client, "- People can enter your ambulance to get healed.");
messageClientInfo(client, "- The pay depends on the player's health before healing them."); messagePlayerInfo(client, "- The pay depends on the player's health before healing them.");
messageClientInfo(client, "- When finished, use /stopwork to stop working."); messagePlayerInfo(client, "- When finished, use /stopwork to stop working.");
break; break;
case AG_JOB_FIRE: case AG_JOB_FIRE:
if(!canClientUseFireJob(client)){ if(!canClientUseFireJob(client)){
return false; return false;
} }
messageClientInfo(client, "== Job Help ================================="); messagePlayerInfo(client, "== Job Help =================================");
messageClientInfo(client, "- Firefighters put out vehicle and building fires."); messagePlayerInfo(client, "- Firefighters put out vehicle and building fires.");
messageClientInfo(client, "- Use /startwork at the fire station to work as a Firefighter."); messagePlayerInfo(client, "- Use /startwork at the fire station to work as a Firefighter.");
messageClientInfo(client, "- Get in a firetruck and you will be told where to go."); messagePlayerInfo(client, "- Get in a firetruck and you will be told where to go.");
messageClientInfo(client, "- Use the firetruck hose to put out fires"); messagePlayerInfo(client, "- Use the firetruck hose to put out fires");
messageClientInfo(client, "- When finished, use /stopwork to stop working."); messagePlayerInfo(client, "- When finished, use /stopwork to stop working.");
break; break;
case AG_JOB_BUS: case AG_JOB_BUS:
messageClientInfo(client, "== Job Help ================================="); messagePlayerInfo(client, "== Job Help =================================");
messageClientInfo(client, "- Bus Drivers transport people around the city on a route"); messagePlayerInfo(client, "- Bus Drivers transport people around the city on a route");
messageClientInfo(client, "- Use /startwork at the bus depot to work as a Bus Driver."); messagePlayerInfo(client, "- Use /startwork at the bus depot to work as a Bus Driver.");
messageClientInfo(client, "- Passengers can get on/off at any stop on your route"); messagePlayerInfo(client, "- Passengers can get on/off at any stop on your route");
messageClientInfo(client, "- Stay on your assigned route. You will be paid when finished."); messagePlayerInfo(client, "- Stay on your assigned route. You will be paid when finished.");
messageClientInfo(client, "- When finished, use /stopwork to stop working."); messagePlayerInfo(client, "- When finished, use /stopwork to stop working.");
break; break;
case AG_JOB_TAXI: case AG_JOB_TAXI:
messageClientInfo(client, "== Job Help ================================="); messagePlayerInfo(client, "== Job Help =================================");
messageClientInfo(client, "- Taxi Drivers transport people around the city"); messagePlayerInfo(client, "- Taxi Drivers transport people around the city");
messageClientInfo(client, "- Use /startwork at the taxi depot to work as a Taxi Driver."); messagePlayerInfo(client, "- Use /startwork at the taxi depot to work as a Taxi Driver.");
messageClientInfo(client, "- Use /fare to set a fare. Fares start when a player gets in."); messagePlayerInfo(client, "- Use /fare to set a fare. Fares start when a player gets in.");
messageClientInfo(client, "- The meter will run until the player exits the vehicle."); messagePlayerInfo(client, "- The meter will run until the player exits the vehicle.");
messageClientInfo(client, "- You will automatically receive the fare money"); messagePlayerInfo(client, "- You will automatically receive the fare money");
messageClientInfo(client, "- When finished, use /stopwork to stop working."); messagePlayerInfo(client, "- When finished, use /stopwork to stop working.");
break; break;
case AG_JOB_GARBAGE: case AG_JOB_GARBAGE:
messageClientInfo(client, "== Job Help ================================="); messagePlayerInfo(client, "== Job Help =================================");
messageClientInfo(client, "- Garbage Collectors pick up the trash around the city."); messagePlayerInfo(client, "- Garbage Collectors pick up the trash around the city.");
messageClientInfo(client, "- Use /startwork at the garbage depot to work as a Garbage Collector."); messagePlayerInfo(client, "- Use /startwork at the garbage depot to work as a Garbage Collector.");
messageClientInfo(client, "- Drive up to a garbage can or dumpster, and right click to grab a bag."); messagePlayerInfo(client, "- Drive up to a garbage can or dumpster, and right click to grab a bag.");
messageClientInfo(client, "- Walk up to the back of your truck and right click again to throw the bag in."); messagePlayerInfo(client, "- Walk up to the back of your truck and right click again to throw the bag in.");
messageClientInfo(client, "- Your truck can hold 25 trashbags. Each bag is worth $25"); messagePlayerInfo(client, "- Your truck can hold 25 trashbags. Each bag is worth $25");
messageClientInfo(client, "- Drive to the garbage depot again to deliver trash"); messagePlayerInfo(client, "- Drive to the garbage depot again to deliver trash");
messageClientInfo(client, "- When finished, use /stopwork to stop working."); messagePlayerInfo(client, "- When finished, use /stopwork to stop working.");
break; break;
case AG_JOB_WEAPON: case AG_JOB_WEAPON:
@@ -327,7 +327,7 @@ function showJobInformationToPlayer(client, jobType) {
function takeJobCommand(command, params, client) { function takeJobCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messageClientError(client, "You are not allowed to use any jobs!"); messagePlayerError(client, "You are not allowed to use any jobs!");
return false; return false;
} }
@@ -335,22 +335,22 @@ function takeJobCommand(command, params, client) {
let jobData = getJobData(closestJobLocation.job); let jobData = getJobData(closestJobLocation.job);
if(closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().takeJobDistance) { if(closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().takeJobDistance) {
messageClientError(client, "There are no job points close enough!"); messagePlayerError(client, "There are no job points close enough!");
return false; return false;
} }
if(getClientCurrentSubAccount(client).job > AG_JOB_NONE) { if(getPlayerCurrentSubAccount(client).job > AG_JOB_NONE) {
messageClientError(client, "You already have a job! Use /quitjob to quit your job."); messagePlayerError(client, "You already have a job! Use /quitjob to quit your job.");
return false; return false;
} }
if(!canPlayerUseJob(client, closestJobLocation.job)) { if(!canPlayerUseJob(client, closestJobLocation.job)) {
messageClientError(client, "You can't use this job!"); messagePlayerError(client, "You can't use this job!");
return false; return false;
} }
takeJob(client, closestJobLocation.job); takeJob(client, closestJobLocation.job);
messageClientSuccess(client, "You now have the " + toString(jobData.name) + " job"); messagePlayerSuccess(client, "You now have the " + toString(jobData.name) + " job");
return true; return true;
} }
@@ -365,23 +365,23 @@ function startWorkingCommand(command, params, client) {
let jobData = getJobData(closestJobLocation.job); let jobData = getJobData(closestJobLocation.job);
if(closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) { if(closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) {
messageClientError(client, "There are no job points close enough!"); messagePlayerError(client, "There are no job points close enough!");
return false; return false;
} }
if(getClientCurrentSubAccount(client).job == AG_JOB_NONE) { if(getPlayerCurrentSubAccount(client).job == AG_JOB_NONE) {
messageClientError(client, "You don't have a job!"); messagePlayerError(client, "You don't have a job!");
messageClientInfo(client, "You can get a job by going the yellow points on the map."); messagePlayerInfo(client, "You can get a job by going the yellow points on the map.");
return false; return false;
} }
if(getClientCurrentSubAccount(client).job != closestJobLocation.job) { if(getPlayerCurrentSubAccount(client).job != closestJobLocation.job) {
messageClientError(client, "This is not your job!"); messagePlayerError(client, "This is not your job!");
messageClientInfo(client, `If you want this job, use /quitjob to quit your current job.`); messagePlayerInfo(client, `If you want this job, use /quitjob to quit your current job.`);
return false; return false;
} }
messageClientSuccess(client, `You are now working as a ${jobData.name}`); messagePlayerSuccess(client, `You are now working as a ${jobData.name}`);
startWorking(client); startWorking(client);
//showStartedWorkingTip(client); //showStartedWorkingTip(client);
return true; return true;
@@ -395,17 +395,17 @@ function stopWorkingCommand(command, params, client) {
} }
if(!isPlayerWorking(client)) { if(!isPlayerWorking(client)) {
messageClientError(client, "You are not working!"); messagePlayerError(client, "You are not working!");
return false; return false;
} }
//if(getClientCurrentSubAccount(client).job != closestJob.jobType) { //if(getPlayerCurrentSubAccount(client).job != closestJob.jobType) {
// messageClientError(client, "This is not your job!"); // messagePlayerError(client, "This is not your job!");
// messageClientInfo(client, "Use /quitjob if you want to quit your current job and take this one."); // messagePlayerInfo(client, "Use /quitjob if you want to quit your current job and take this one.");
// break; // break;
//} //}
messageClientSuccess(client, "You have stopped working!"); messagePlayerSuccess(client, "You have stopped working!");
stopWorking(client); stopWorking(client);
//showApproachCurrentJobTip(client); //showApproachCurrentJobTip(client);
return true; return true;
@@ -418,32 +418,32 @@ function startWorking(client) {
return false; return false;
} }
getClientCurrentSubAccount(client).isWorking = true; getPlayerCurrentSubAccount(client).isWorking = true;
let jobId = getClientCurrentSubAccount(client).job; let jobId = getPlayerCurrentSubAccount(client).job;
switch(getJobType(jobId)) { switch(getJobType(jobId)) {
case AG_JOB_POLICE: case AG_JOB_POLICE:
messageClientInfo(client, "Use /uniform and /equip to get your equipment."); messagePlayerInfo(client, "Use /uniform and /equip to get your equipment.");
break; break;
case AG_JOB_MEDICAL: case AG_JOB_MEDICAL:
messageClientInfo(client, "Use /uniform and /equip to get your equipment."); messagePlayerInfo(client, "Use /uniform and /equip to get your equipment.");
break; break;
case AG_JOB_FIRE: case AG_JOB_FIRE:
messageClientInfo(client, "Use /uniform and /equip to get your equipment."); messagePlayerInfo(client, "Use /uniform and /equip to get your equipment.");
break; break;
case AG_JOB_BUS: case AG_JOB_BUS:
messageClientInfo(client, "Get in a bus to get started."); messagePlayerInfo(client, "Get in a bus to get started.");
break; break;
case AG_JOB_TAXI: case AG_JOB_TAXI:
messageClientInfo(client, "Get in a taxi to get started."); messagePlayerInfo(client, "Get in a taxi to get started.");
break; break;
case AG_JOB_GARBAGE: case AG_JOB_GARBAGE:
messageClientInfo(client, "Get in a trash truck to get started."); messagePlayerInfo(client, "Get in a trash truck to get started.");
break; break;
case AG_JOB_WEAPON: case AG_JOB_WEAPON:
@@ -468,7 +468,7 @@ function givePlayerJobEquipment(client, equipmentId) {
return false; return false;
} }
let jobId = getClientCurrentSubAccount(client).job; let jobId = getPlayerCurrentSubAccount(client).job;
let equipments = getJobData(jobId).equipment; let equipments = getJobData(jobId).equipment;
for(let i in equipments[equipmentId].weapons) { for(let i in equipments[equipmentId].weapons) {
@@ -487,14 +487,14 @@ function stopWorking(client) {
return false; return false;
} }
getClientCurrentSubAccount(client).isWorking = false; getPlayerCurrentSubAccount(client).isWorking = false;
triggerNetworkEvent("ag.skin", client, getClientCurrentSubAccount(client).skin); triggerNetworkEvent("ag.skin", client, getPlayerCurrentSubAccount(client).skin);
let jobVehicle = getClientCurrentSubAccount(client).lastJobVehicle; let jobVehicle = getPlayerCurrentSubAccount(client).lastJobVehicle;
if(jobVehicle) { if(jobVehicle) {
if(client.player.vehicle) { if(client.player.vehicle) {
triggerNetworkEvent("ag.removeFromVehicle", client); removePlayerFromVehicle(client);
//client.player.removeFromVehicle(); //client.player.removeFromVehicle();
} }
@@ -507,35 +507,35 @@ function stopWorking(client) {
setEntityData(jobVehicle, "ag.engine", false, true); setEntityData(jobVehicle, "ag.engine", false, true);
setEntityData(jobVehicle, "ag.siren", false, true); setEntityData(jobVehicle, "ag.siren", false, true);
getClientCurrentSubAccount(client).lastJobVehicle = false; getPlayerCurrentSubAccount(client).lastJobVehicle = false;
} }
triggerNetworkEvent("ag.clearWeapons", client); triggerNetworkEvent("ag.clearWeapons", client);
let jobId = getClientCurrentSubAccount(client).job; let jobId = getPlayerCurrentSubAccount(client).job;
switch(getJobType(jobId)) { switch(getJobType(jobId)) {
case AG_JOB_POLICE: case AG_JOB_POLICE:
messageClientInfo(client, "Your uniform, equipment, and police car have been returned to the police station"); messagePlayerInfo(client, "Your uniform, equipment, and police car have been returned to the police station");
break; break;
case AG_JOB_MEDICAL: case AG_JOB_MEDICAL:
messageClientInfo(client, "Your uniform and ambulance have been returned to the hospital"); messagePlayerInfo(client, "Your uniform and ambulance have been returned to the hospital");
break; break;
case AG_JOB_FIRE: case AG_JOB_FIRE:
messageClientInfo(client, "Your uniform and fire truck have been returned to the fire station"); messagePlayerInfo(client, "Your uniform and fire truck have been returned to the fire station");
break; break;
case AG_JOB_BUS: case AG_JOB_BUS:
messageClientInfo(client, "Your bus has been returned to the bus depot"); messagePlayerInfo(client, "Your bus has been returned to the bus depot");
break; break;
case AG_JOB_TAXI: case AG_JOB_TAXI:
messageClientInfo(client, "Your taxi has been returned to the taxi depot"); messagePlayerInfo(client, "Your taxi has been returned to the taxi depot");
break; break;
case AG_JOB_GARBAGE: case AG_JOB_GARBAGE:
messageClientInfo(client, "Your trash truck has been returned to the city landfill"); messagePlayerInfo(client, "Your trash truck has been returned to the city landfill");
break; break;
case AG_JOB_WEAPON: case AG_JOB_WEAPON:
@@ -555,46 +555,46 @@ function stopWorking(client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function jobUniformCommand(command, params, client) { function jobUniformCommand(command, params, client) {
let jobId = getClientCurrentSubAccount(client).job; let jobId = getPlayerCurrentSubAccount(client).job;
let uniforms = getJobData(jobId).uniforms; let uniforms = getJobData(jobId).uniforms;
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
messageClientNormal(client, `0: No uniform (sets you back to your main skin)`); messagePlayerNormal(client, `0: No uniform (sets you back to your main skin)`);
for(let i in uniforms) { for(let i in uniforms) {
messageClientNormal(client, `${toInteger(i)+1}: ${uniforms[i].name} (Requires rank ${uniforms[i].requiredRank})`); messagePlayerNormal(client, `${toInteger(i)+1}: ${uniforms[i].name} (Requires rank ${uniforms[i].requiredRank})`);
} }
return false; return false;
} }
let uniformId = toInteger(params) || 1; let uniformId = toInteger(params) || 1;
if(uniformId == 0) { if(uniformId == 0) {
triggerNetworkEvent("ag.pedSkin", client, getClientCurrentSubAccount(client).skin); triggerNetworkEvent("ag.pedSkin", client, getPlayerCurrentSubAccount(client).skin);
messageClientSuccess(client, "You changed your uniform to (none)"); messagePlayerSuccess(client, "You changed your uniform to (none)");
return true; return true;
} }
if(uniformId < 1 || uniformId > uniforms.length) { if(uniformId < 1 || uniformId > uniforms.length) {
messageClientError(client, "That uniform ID is invalid!"); messagePlayerError(client, "That uniform ID is invalid!");
return false; return false;
} }
messageClientSuccess(client, `You put on the ${uniforms[uniformId-1].name} uniform`); messagePlayerSuccess(client, `You put on the ${uniforms[uniformId-1].name} uniform`);
triggerNetworkEvent("ag.pedSkin", null, client.player, uniforms[uniformId-1].skin); triggerNetworkEvent("ag.pedSkin", null, client.player, uniforms[uniformId-1].skin);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function jobEquipmentCommand(command, params, client) { function jobEquipmentCommand(command, params, client) {
let jobId = getClientCurrentSubAccount(client).job; let jobId = getPlayerCurrentSubAccount(client).job;
let equipments = getJobData(jobId).equipment; let equipments = getJobData(jobId).equipment;
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
messageClientNormal(client, `0: No equipment`); messagePlayerNormal(client, `0: No equipment`);
for(let i in equipments) { for(let i in equipments) {
messageClientNormal(client, `${toInteger(i)+1}: ${equipments[i].name} (Requires rank ${equipments[i].requiredRank})`); messagePlayerNormal(client, `${toInteger(i)+1}: ${equipments[i].name} (Requires rank ${equipments[i].requiredRank})`);
} }
return false; return false;
} }
@@ -602,17 +602,17 @@ function jobEquipmentCommand(command, params, client) {
let equipmentId = toInteger(params) || 1; let equipmentId = toInteger(params) || 1;
if(equipmentId == 0) { if(equipmentId == 0) {
messageClientSuccess(client, "You put your equipment away"); messagePlayerSuccess(client, "You put your equipment away");
return true; return true;
} }
if(equipmentId < 1 || equipmentId > equipments.length) { if(equipmentId < 1 || equipmentId > equipments.length) {
messageClientError(client, "That equipment ID is invalid!"); messagePlayerError(client, "That equipment ID is invalid!");
return false; return false;
} }
givePlayerJobEquipment(client, equipmentId-1); givePlayerJobEquipment(client, equipmentId-1);
messageClientSuccess(client, `You have been given the ${equipments[equipmentId-1].name} equipment`); messagePlayerSuccess(client, `You have been given the ${equipments[equipmentId-1].name} equipment`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -623,7 +623,7 @@ function quitJobCommand(command, params, client) {
} }
quitJob(client); quitJob(client);
messageClientSuccess(client, "You are now unemployed!"); messagePlayerSuccess(client, "You are now unemployed!");
return true; return true;
} }
@@ -657,7 +657,7 @@ function getJobType(jobId) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function doesPlayerHaveJobType(client, jobType) { function doesPlayerHaveJobType(client, jobType) {
return (getJobType(getClientCurrentSubAccount(client).job) == jobType) ? true : false; return (getJobType(getPlayerCurrentSubAccount(client).job) == jobType) ? true : false;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -675,14 +675,14 @@ function getJobData(jobId) {
function quitJob(client) { function quitJob(client) {
stopWorking(client); stopWorking(client);
getClientCurrentSubAccount(client).job = AG_JOB_NONE; getPlayerCurrentSubAccount(client).job = AG_JOB_NONE;
triggerNetworkEvent("ag.jobType", client, AG_JOB_NONE); triggerNetworkEvent("ag.jobType", client, AG_JOB_NONE);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function takeJob(client, jobId) { function takeJob(client, jobId) {
getClientCurrentSubAccount(client).job = jobId; getPlayerCurrentSubAccount(client).job = jobId;
triggerNetworkEvent("ag.jobType", client, jobId); triggerNetworkEvent("ag.jobType", client, jobId);
} }
@@ -714,7 +714,7 @@ function reloadAllJobsCommand(command, params, client) {
function createJobLocationCommand(command, params, client) { function createJobLocationCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -722,7 +722,7 @@ function createJobLocationCommand(command, params, client) {
let jobId = getJobFromParams(splitParams[0]); let jobId = getJobFromParams(splitParams[0]);
if(!getJobData(jobId)) { if(!getJobData(jobId)) {
messageClientError(client, "That job was not found!"); messagePlayerError(client, "That job was not found!");
return false; return false;
} }
@@ -746,7 +746,7 @@ function deleteJobLocationCommand(command, params, client) {
function toggleJobLocationEnabledCommand(command, params, client) { function toggleJobLocationEnabledCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -761,7 +761,7 @@ function toggleJobLocationEnabledCommand(command, params, client) {
function toggleJobEnabledCommand(command, params, client) { function toggleJobEnabledCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -776,7 +776,7 @@ function toggleJobEnabledCommand(command, params, client) {
function toggleJobWhiteListCommand(command, params, client) { function toggleJobWhiteListCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -791,7 +791,7 @@ function toggleJobWhiteListCommand(command, params, client) {
function toggleJobBlackListCommand(command, params, client) { function toggleJobBlackListCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -806,7 +806,7 @@ function toggleJobBlackListCommand(command, params, client) {
function addPlayerToJobBlackListCommand(command, params, client) { function addPlayerToJobBlackListCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -836,7 +836,7 @@ function addPlayerToJobBlackListCommand(command, params, client) {
function removePlayerFromJobBlackListCommand(command, params, client) { function removePlayerFromJobBlackListCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -866,7 +866,7 @@ function removePlayerFromJobBlackListCommand(command, params, client) {
function addPlayerToJobWhiteListCommand(command, params, client) { function addPlayerToJobWhiteListCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -896,7 +896,7 @@ function addPlayerToJobWhiteListCommand(command, params, client) {
function removePlayerFromJobWhiteListCommand(command, params, client) { function removePlayerFromJobWhiteListCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -934,22 +934,22 @@ function forceAllPlayersToStopWorking() {
function jobStartRouteCommand(command, params, client) { function jobStartRouteCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messageClientError(client, "You are not allowed to use jobs."); messagePlayerError(client, "You are not allowed to use jobs.");
return false; return false;
} }
if(!isPlayerWorking(client)) { if(!isPlayerWorking(client)) {
messageClientError(client, "You aren't working yet! Use /startwork first."); messagePlayerError(client, "You aren't working yet! Use /startwork first.");
return false; return false;
} }
if(!doesPlayerHaveJobType(client, AG_JOB_BUS) && !doesPlayerHaveJobType(client, AG_JOB_GARBAGE)) { if(!doesPlayerHaveJobType(client, AG_JOB_BUS) && !doesPlayerHaveJobType(client, AG_JOB_GARBAGE)) {
messageClientError(client, "Your job doesn't use a route!"); messagePlayerError(client, "Your job doesn't use a route!");
return false; return false;
} }
if(!isPlayerInJobVehicle(client)) { if(!isPlayerInJobVehicle(client)) {
messageClientError(client, "You need to be in a vehicle that belongs to your job!"); messagePlayerError(client, "You need to be in a vehicle that belongs to your job!");
return false; return false;
} }
@@ -962,22 +962,22 @@ function jobStartRouteCommand(command, params, client) {
function jobStopRouteCommand(command, params, client) { function jobStopRouteCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messageClientError(client, "You are not allowed to use jobs."); messagePlayerError(client, "You are not allowed to use jobs.");
return false; return false;
} }
if(!isPlayerWorking(client)) { if(!isPlayerWorking(client)) {
messageClientError(client, "You aren't working yet! Use /startwork first."); messagePlayerError(client, "You aren't working yet! Use /startwork first.");
return false; return false;
} }
if(!doesPlayerHaveJobType(client, AG_JOB_BUS) && !doesPlayerHaveJobType(client, AG_JOB_GARBAGE)) { if(!doesPlayerHaveJobType(client, AG_JOB_BUS) && !doesPlayerHaveJobType(client, AG_JOB_GARBAGE)) {
messageClientError(client, "Your job doesn't use a route!"); messagePlayerError(client, "Your job doesn't use a route!");
return false; return false;
} }
if(!isPlayerOnJobRoute(client)) { if(!isPlayerOnJobRoute(client)) {
messageClientError(client, "You aren't on a job route!"); messagePlayerError(client, "You aren't on a job route!");
return false; return false;
} }
@@ -990,7 +990,7 @@ function jobStopRouteCommand(command, params, client) {
function isPlayerInJobVehicle(client) { function isPlayerInJobVehicle(client) {
if(getPlayerVehicle(client)) { if(getPlayerVehicle(client)) {
let vehicle = getPlayerVehicle(client); let vehicle = getPlayerVehicle(client);
if(isVehicleOwnedByJob(vehicle, getClientCurrentSubAccount(client).job)) { if(isVehicleOwnedByJob(vehicle, getPlayerCurrentSubAccount(client).job)) {
return true; return true;
} }
} }
@@ -1001,10 +1001,10 @@ function isPlayerInJobVehicle(client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function isPlayerWorking(client) { function isPlayerWorking(client) {
if(!getClientCurrentSubAccount(client)) { if(!getPlayerCurrentSubAccount(client)) {
return false; return false;
} }
return getClientCurrentSubAccount(client).isWorking; return getPlayerCurrentSubAccount(client).isWorking;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -1019,7 +1019,7 @@ function startJobRoute(client) {
getPlayerVehicle(client).colour1 = getBusRouteData(getPlayerIsland(client), busRoute).busColour; getPlayerVehicle(client).colour1 = getBusRouteData(getPlayerIsland(client), busRoute).busColour;
getPlayerVehicle(client).colour2 = 1; getPlayerVehicle(client).colour2 = 1;
showCurrentBusStop(client); showCurrentBusStop(client);
messageClientNormal(client, `🚌 You are now driving the [#AAAAAA]${getBusRouteData(getPlayerIsland(client), busRoute).name} [#FFFFFF]bus route! Drive to the green checkpoint.`); messagePlayerNormal(client, `🚌 You are now driving the [#AAAAAA]${getBusRouteData(getPlayerIsland(client), busRoute).name} [#FFFFFF]bus route! Drive to the green checkpoint.`);
} else if(doesPlayerHaveJobType(client, AG_JOB_GARBAGE)) { } else if(doesPlayerHaveJobType(client, AG_JOB_GARBAGE)) {
let garbageRoute = getRandomBusRoute(getPlayerIsland(client)); let garbageRoute = getRandomBusRoute(getPlayerIsland(client));
getPlayerData(client).jobRoute = garbageRoute; getPlayerData(client).jobRoute = garbageRoute;
@@ -1029,7 +1029,7 @@ function startJobRoute(client) {
getPlayerVehicle(client).colour1 = getGarbageRouteData(getPlayerIsland(client), garbageRoute).garbageTruckColour; getPlayerVehicle(client).colour1 = getGarbageRouteData(getPlayerIsland(client), garbageRoute).garbageTruckColour;
getPlayerVehicle(client).colour2 = 1; getPlayerVehicle(client).colour2 = 1;
showCurrentGarbageStop(client); showCurrentGarbageStop(client);
messageClientNormal(client, `🚌 You are now driving the [#AAAAAA]${getGarbageRouteData(getPlayerIsland(client), garbageRoute).name} [#FFFFFF]garbage route! Drive to the grey checkpoint.`); messagePlayerNormal(client, `🚌 You are now driving the [#AAAAAA]${getGarbageRouteData(getPlayerIsland(client), garbageRoute).name} [#FFFFFF]garbage route! Drive to the grey checkpoint.`);
} }
} }
@@ -1041,14 +1041,14 @@ function stopJobRoute(client, successful = false) {
if(doesPlayerHaveJobType(client, AG_JOB_BUS)) { if(doesPlayerHaveJobType(client, AG_JOB_BUS)) {
respawnVehicle(getPlayerData(client).busRouteVehicle); respawnVehicle(getPlayerData(client).busRouteVehicle);
messageClientAlert(client, `You stopped the ${getBusRouteData(getPlayerData(client).busRouteIsland, getPlayerData(client).busRoute).name} bus route! Your bus has been returned to the bus depot.`, getColourByName("yellow")); messagePlayerAlert(client, `You stopped the ${getBusRouteData(getPlayerData(client).busRouteIsland, getPlayerData(client).busRoute).name} bus route! Your bus has been returned to the bus depot.`, getColourByName("yellow"));
getPlayerData(client).busRouteVehicle = false; getPlayerData(client).busRouteVehicle = false;
getPlayerData(client).busRoute = false; getPlayerData(client).busRoute = false;
getPlayerData(client).busRouteStop = false; getPlayerData(client).busRouteStop = false;
getPlayerData(client).busRouteIsland = false; getPlayerData(client).busRouteIsland = false;
} else if(doesPlayerHaveJobType(client, AG_JOB_GARBAGE)) { } else if(doesPlayerHaveJobType(client, AG_JOB_GARBAGE)) {
respawnVehicle(getPlayerData(client).garbageRouteVehicle); respawnVehicle(getPlayerData(client).garbageRouteVehicle);
messageClientAlert(client, `You stopped the ${getBusRouteData(getPlayerData(client).garbageRouteIsland, getPlayerData(client).garbageRoute).name} garbage route! Your trashmaster has been returned to the bus depot.`, getColourByName("yellow")); messagePlayerAlert(client, `You stopped the ${getBusRouteData(getPlayerData(client).garbageRouteIsland, getPlayerData(client).garbageRoute).name} garbage route! Your trashmaster has been returned to the bus depot.`, getColourByName("yellow"));
getPlayerData(client).garbageRouteVehicle = false; getPlayerData(client).garbageRouteVehicle = false;
getPlayerData(client).garbageRoute = false; getPlayerData(client).garbageRoute = false;
getPlayerData(client).garbageRouteStop = false; getPlayerData(client).garbageRouteStop = false;
@@ -1150,7 +1150,7 @@ function sendAllJobLabelsToPlayer(client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function canPlayerUseJob(client, jobId) { function canPlayerUseJob(client, jobId) {
if(doesClientHaveStaffPermission(client, getStaffFlagValue("manageJobs"))) { if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("manageJobs"))) {
return true; return true;
} }

View File

@@ -553,7 +553,7 @@ function showCurrentBusStop(client) {
function arrivedAtBusStop(client) { function arrivedAtBusStop(client) {
if(isLastStopOnBusRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) { if(isLastStopOnBusRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) {
respawnVehicle(getPlayerData(client).jobRouteVehicle); respawnVehicle(getPlayerData(client).jobRouteVehicle);
messageClientNormal(client, `You finished the ${getBusRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).name} bus route! Your bus has been returned to the bus depot.`, getColourByName("yellow")); messagePlayerNormal(client, `You finished the ${getBusRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).name} bus route! Your bus has been returned to the bus depot.`, getColourByName("yellow"));
getPlayerData(client).jobRouteVehicle = false; getPlayerData(client).jobRouteVehicle = false;
getPlayerData(client).jobRoute = 0; getPlayerData(client).jobRoute = 0;
getPlayerData(client).jobRouteStop = 0; getPlayerData(client).jobRouteStop = 0;

View File

@@ -116,7 +116,7 @@ function showCurrentGarbageStop(client) {
function arrivedAtGarbageStop(client) { function arrivedAtGarbageStop(client) {
if(isLastStopOnGarbageRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) { if(isLastStopOnGarbageRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) {
respawnVehicle(getPlayerData(client).jobRouteVehicle); respawnVehicle(getPlayerData(client).jobRouteVehicle);
messageClientNormal(client, `You finished the ${getGarbageRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).name} garbage route! Your trashmaster has been returned to the garbage depot.`, getColourByName("yellow")); messagePlayerNormal(client, `You finished the ${getGarbageRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).name} garbage route! Your trashmaster has been returned to the garbage depot.`, getColourByName("yellow"));
getPlayerData(client).jobRouteVehicle = false; getPlayerData(client).jobRouteVehicle = false;
getPlayerData(client).jobRoute = 0; getPlayerData(client).jobRoute = 0;
getPlayerData(client).jobRouteStop = 0; getPlayerData(client).jobRouteStop = 0;

View File

@@ -10,22 +10,22 @@
function policeTazerCommand(command, params, client) { function policeTazerCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messageClientError(client, "You are not allowed to use jobs."); messagePlayerError(client, "You are not allowed to use jobs.");
return false; return false;
} }
if(!canPlayerUsePoliceJob(client)) { if(!canPlayerUsePoliceJob(client)) {
messageClientError(client, "You are not allowed to use the police job."); messagePlayerError(client, "You are not allowed to use the police job.");
return false; return false;
} }
if(!isPlayerWorking(client)) { if(!isPlayerWorking(client)) {
messageClientError(client, "You are not working! Use /startwork first."); messagePlayerError(client, "You are not working! Use /startwork first.");
return false; return false;
} }
if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) { if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) {
messageClientError(client, "You don't have a police job."); messagePlayerError(client, "You don't have a police job.");
return false; return false;
} }
@@ -36,22 +36,22 @@ function policeTazerCommand(command, params, client) {
function policeCuffCommand(command, params, client) { function policeCuffCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messageClientError(client, "You are not allowed to use jobs."); messagePlayerError(client, "You are not allowed to use jobs.");
return false; return false;
} }
if(!canPlayerUsePoliceJob(client)) { if(!canPlayerUsePoliceJob(client)) {
messageClientError(client, "You are not allowed to use the police job."); messagePlayerError(client, "You are not allowed to use the police job.");
return false; return false;
} }
if(!isPlayerWorking(client)) { if(!isPlayerWorking(client)) {
messageClientError(client, "You are not working! Use /startwork first."); messagePlayerError(client, "You are not working! Use /startwork first.");
return false; return false;
} }
if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) { if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) {
messageClientError(client, "You don't have a police job."); messagePlayerError(client, "You don't have a police job.");
return false; return false;
} }
@@ -62,22 +62,22 @@ function policeCuffCommand(command, params, client) {
function policeArrestCommand(command, params, client) { function policeArrestCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messageClientError(client, "You are not allowed to use jobs."); messagePlayerError(client, "You are not allowed to use jobs.");
return false; return false;
} }
if(!canPlayerUsePoliceJob(client)) { if(!canPlayerUsePoliceJob(client)) {
messageClientError(client, "You are not allowed to use the police job."); messagePlayerError(client, "You are not allowed to use the police job.");
return false; return false;
} }
if(!isPlayerWorking(client)) { if(!isPlayerWorking(client)) {
messageClientError(client, "You are not working! Use /startwork first."); messagePlayerError(client, "You are not working! Use /startwork first.");
return false; return false;
} }
if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) { if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) {
messageClientError(client, "You don't have a police job."); messagePlayerError(client, "You don't have a police job.");
return false; return false;
} }
@@ -88,22 +88,22 @@ function policeArrestCommand(command, params, client) {
function policeSearchCommand(command, params, client) { function policeSearchCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messageClientError(client, "You are not allowed to use jobs."); messagePlayerError(client, "You are not allowed to use jobs.");
return false; return false;
} }
if(!canPlayerUsePoliceJob(client)) { if(!canPlayerUsePoliceJob(client)) {
messageClientError(client, "You are not allowed to use the police job."); messagePlayerError(client, "You are not allowed to use the police job.");
return false; return false;
} }
if(!isPlayerWorking(client)) { if(!isPlayerWorking(client)) {
messageClientError(client, "You are not working! Use /startwork first."); messagePlayerError(client, "You are not working! Use /startwork first.");
return false; return false;
} }
if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) { if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) {
messageClientError(client, "You don't have a police job."); messagePlayerError(client, "You don't have a police job.");
return false; return false;
} }
@@ -114,22 +114,22 @@ function policeSearchCommand(command, params, client) {
function policeDragCommand(command, params, client) { function policeDragCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messageClientError(client, "You are not allowed to use jobs."); messagePlayerError(client, "You are not allowed to use jobs.");
return false; return false;
} }
if(!canPlayerUsePoliceJob(client)) { if(!canPlayerUsePoliceJob(client)) {
messageClientError(client, "You are not allowed to use the police job."); messagePlayerError(client, "You are not allowed to use the police job.");
return false; return false;
} }
if(!isPlayerWorking(client)) { if(!isPlayerWorking(client)) {
messageClientError(client, "You are not working! Use /startwork first."); messagePlayerError(client, "You are not working! Use /startwork first.");
return false; return false;
} }
if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) { if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) {
messageClientError(client, "You don't have a police job."); messagePlayerError(client, "You don't have a police job.");
return false; return false;
} }
@@ -140,22 +140,22 @@ function policeDragCommand(command, params, client) {
function policeDetainCommand(command, params, client) { function policeDetainCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messageClientError(client, "You are not allowed to use jobs."); messagePlayerError(client, "You are not allowed to use jobs.");
return false; return false;
} }
if(!canPlayerUsePoliceJob(client)) { if(!canPlayerUsePoliceJob(client)) {
messageClientError(client, "You are not allowed to use the police job."); messagePlayerError(client, "You are not allowed to use the police job.");
return false; return false;
} }
if(!isPlayerWorking(client)) { if(!isPlayerWorking(client)) {
messageClientError(client, "You are not working! Use /startwork first."); messagePlayerError(client, "You are not working! Use /startwork first.");
return false; return false;
} }
if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) { if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) {
messageClientError(client, "You don't have a police job."); messagePlayerError(client, "You don't have a police job.");
return false; return false;
} }

View File

@@ -10,22 +10,22 @@
function taxiSetFareCommand(command, params, client) { function taxiSetFareCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messageClientError(client, "You are not allowed to use jobs."); messagePlayerError(client, "You are not allowed to use jobs.");
return false; return false;
} }
if(!canPlayerUseTaxiJob(client)) { if(!canPlayerUseTaxiJob(client)) {
messageClientError(client, "You are not allowed to use the taxi job."); messagePlayerError(client, "You are not allowed to use the taxi job.");
return false; return false;
} }
if(!isPlayerWorking(client)) { if(!isPlayerWorking(client)) {
messageClientError(client, "You are not working! Use /startwork first."); messagePlayerError(client, "You are not working! Use /startwork first.");
return false; return false;
} }
if(!doesPlayerHaveJobType(client, AG_JOB_TAXI)) { if(!doesPlayerHaveJobType(client, AG_JOB_TAXI)) {
messageClientError(client, "You don't have a taxi job."); messagePlayerError(client, "You don't have a taxi job.");
return false; return false;
} }

View File

@@ -143,24 +143,24 @@ function addKeyBindCommand(command, params, client) {
let tempParams = (splitParams.length > 2) ? splitParams.slice(2).join(" ") : ""; let tempParams = (splitParams.length > 2) ? splitParams.slice(2).join(" ") : "";
if(!keyId) { if(!keyId) {
messageClientError(client, "The key ID or name you input is invalid!"); messagePlayerError(client, "The key ID or name you input is invalid!");
messageClientTip(client, "Use simple key names, letters, or numbers. Don't add spaces."); messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces.");
messageClientInfo(client, "Examples: [#AAAAAA]1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl"); messagePlayerInfo(client, "Examples: [#AAAAAA]1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl");
return false; return false;
} }
if(!keyId) { if(!keyId) {
messageClientError(client, "That key name/id is invalid!"); messagePlayerError(client, "That key name/id is invalid!");
return false; return false;
} }
if(areParamsEmpty(tempCommand)) { if(areParamsEmpty(tempCommand)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
addPlayerKeyBind(keyId, tempCommand, tempParams); addPlayerKeyBind(keyId, tempCommand, tempParams);
messageClientSuccess(client, `You binded the [#AAAAAA]${sdl.getKeyName(keyId)} [#FFFFFF]key to command: [#AAAAAA]/${tempCommand} ${tempParams}`); messagePlayerSuccess(client, `You binded the [#AAAAAA]${sdl.getKeyName(keyId)} [#FFFFFF]key to command: [#AAAAAA]/${tempCommand} ${tempParams}`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -171,19 +171,19 @@ function removeKeyBindCommand(command, params, client) {
let keyId = getKeyIdFromParams(splitParams[0]); let keyId = getKeyIdFromParams(splitParams[0]);
if(!keyId) { if(!keyId) {
messageClientError(client, "The key ID or name you input is invalid!"); messagePlayerError(client, "The key ID or name you input is invalid!");
messageClientTip(client, "Use simple key names, letters, or numbers. Don't add spaces."); messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces.");
messageClientInfo(client, "Examples: [#AAAAAA]1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl"); messagePlayerInfo(client, "Examples: [#AAAAAA]1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl");
return false; return false;
} }
if(!keyId) { if(!keyId) {
messageClientError(client, "That key name/id is invalid!"); messagePlayerError(client, "That key name/id is invalid!");
return false; return false;
} }
removePlayerKeyBind(client, keyId); removePlayerKeyBind(client, keyId);
messageClientSuccess(client, `You removed the keybind for the [#AAAAAA]${sdl.getKeyName(keyId)} [#FFFFFF]key`); messagePlayerSuccess(client, `You removed the keybind for the [#AAAAAA]${sdl.getKeyName(keyId)} [#FFFFFF]key`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -257,7 +257,7 @@ function getPlayerKeyBindForKey(client, key) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function playerUsedKeyBind(client, key) { function playerUsedKeyBind(client, key) {
if(!isClientLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
return false; return false;
} }
@@ -265,7 +265,7 @@ function playerUsedKeyBind(client, key) {
return false; return false;
} }
console.log(`[Asshat.KeyBind] ${getClientDisplayForConsole(client)} used keybind ${sdl.getKeyName(key)} (${key})`); console.log(`[Asshat.KeyBind] ${getPlayerDisplayForConsole(client)} used keybind ${sdl.getKeyName(key)} (${key})`);
if(doesPlayerHaveKeyBindForKey(client, key)) { if(doesPlayerHaveKeyBindForKey(client, key)) {
let keyBindData = getPlayerKeyBindForKey(client, key); let keyBindData = getPlayerKeyBindForKey(client, key);
if(keyBindData.enabled) { if(keyBindData.enabled) {

View File

@@ -19,8 +19,8 @@ function messageAdminAction(messageText) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function messageClientNormal(client, messageText, colour = COLOUR_WHITE) { function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) {
if(client.console) { if(isConsole(client)) {
console.log(`[Asshat.Messaging] ${messageText}`); console.log(`[Asshat.Messaging] ${messageText}`);
return true; return true;
} }
@@ -40,7 +40,7 @@ function messageAdmins(messageText, colour = COLOUR_WHITE) {
if(clients[i].console) { if(clients[i].console) {
console.log(`[Asshat.Messaging] 🛡️ ${messageText}`); console.log(`[Asshat.Messaging] 🛡️ ${messageText}`);
} else { } else {
if(doesClientHaveStaffPermission(clients[i], getStaffFlagValue("basicModeration"))) { if(doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("basicModeration"))) {
messageClient(`🛡️ ${messageText}`, clients[i], getColourByName("softRed")); messageClient(`🛡️ ${messageText}`, clients[i], getColourByName("softRed"));
} }
} }
@@ -50,14 +50,14 @@ function messageAdmins(messageText, colour = COLOUR_WHITE) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function messageClientError(client, messageText) { function messagePlayerError(client, messageText) {
if(client.console) { if(isConsole(client)) {
console.log(`[Asshat.Messaging] ERROR: ${messageText}`); console.log(`[Asshat.Messaging] ERROR: ${messageText}`);
return true; return true;
} }
if(!isClientFromDiscord(client)) { if(!isClientFromDiscord(client)) {
messageClientNormal(client, `🚫 ${messageText}`, getColourByName("white")); messagePlayerNormal(client, `🚫 ${messageText}`, getColourByName("white"));
} else { } else {
messageDiscordUser(client, `:no_entry_sign: ${messageText}`); messageDiscordUser(client, `:no_entry_sign: ${messageText}`);
} }
@@ -65,14 +65,14 @@ function messageClientError(client, messageText) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function messageClientSyntax(client, messageText) { function messagePlayerSyntax(client, messageText) {
if(client.console) { if(isConsole(client)) {
console.log(`[Asshat.Messaging] USAGE: ${messageText}`); console.log(`[Asshat.Messaging] USAGE: ${messageText}`);
return true; return true;
} }
if(!isClientFromDiscord(client)) { if(!isClientFromDiscord(client)) {
messageClientNormal(client, `⌨️ USAGE: [#FFFFFF] ${messageText}`, getColourByType("syntaxMessage")); messagePlayerNormal(client, `⌨️ USAGE: [#FFFFFF] ${messageText}`, getColourByType("syntaxMessage"));
} else { } else {
messageDiscordUser(client, `:keyboard: ${messageText}`); messageDiscordUser(client, `:keyboard: ${messageText}`);
} }
@@ -80,14 +80,14 @@ function messageClientSyntax(client, messageText) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function messageClientAlert(client, messageText) { function messagePlayerAlert(client, messageText) {
if(client.console) { if(isConsole(client)) {
console.log(`[Asshat.Messaging] ALERT: ${messageText}`); console.log(`[Asshat.Messaging] ALERT: ${messageText}`);
return true; return true;
} }
if(!isClientFromDiscord(client)) { if(!isClientFromDiscord(client)) {
messageClientNormal(client, `⚠️ [#FFFFFF] ${messageText}`, getColourByName("white")); messagePlayerNormal(client, `⚠️ [#FFFFFF] ${messageText}`, getColourByName("white"));
} else { } else {
messageDiscordUser(client, `:warning: ${messageText}`); messageDiscordUser(client, `:warning: ${messageText}`);
} }
@@ -95,14 +95,14 @@ function messageClientAlert(client, messageText) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function messageClientSuccess(client, messageText) { function messagePlayerSuccess(client, messageText) {
if(client.console) { if(isConsole(client)) {
console.log(`[Asshat.Messaging] SUCCESS: ${messageText}`); console.log(`[Asshat.Messaging] SUCCESS: ${messageText}`);
return true; return true;
} }
if(!isClientFromDiscord(client)) { if(!isClientFromDiscord(client)) {
messageClientNormal(client, `👍 [#FFFFFF] ${messageText}`, getColourByName("white")); messagePlayerNormal(client, `👍 [#FFFFFF] ${messageText}`, getColourByName("white"));
} else { } else {
messageDiscordUser(client, `:thumbsup: ${messageText}`); messageDiscordUser(client, `:thumbsup: ${messageText}`);
} }
@@ -110,14 +110,14 @@ function messageClientSuccess(client, messageText) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function messageClientInfo(client, messageText) { function messagePlayerInfo(client, messageText) {
if(client.console) { if(isConsole(client)) {
console.log(`[INFO] ${messageText}`); console.log(`[INFO] ${messageText}`);
return true; return true;
} }
if(!isClientFromDiscord(client)) { if(!isClientFromDiscord(client)) {
messageClientNormal(client, ` [#FFFFFF] ${messageText}`, getColourByName("white")); messagePlayerNormal(client, ` [#FFFFFF] ${messageText}`, getColourByName("white"));
} else { } else {
messageDiscordUser(client, `:information_source: ${messageText}`); messageDiscordUser(client, `:information_source: ${messageText}`);
} }
@@ -125,14 +125,14 @@ function messageClientInfo(client, messageText) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function messageClientTip(client, messageText) { function messagePlayerTip(client, messageText) {
if(client.console) { if(isConsole(client)) {
console.log(`[TIP] ${messageText}`); console.log(`[TIP] ${messageText}`);
return true; return true;
} }
if(!isClientFromDiscord(client)) { if(!isClientFromDiscord(client)) {
messageClientNormal(client, ` [#FFFFFF] ${messageText}`, getColourByName("white")); messagePlayerNormal(client, ` [#FFFFFF] ${messageText}`, getColourByName("white"));
} else { } else {
messageDiscordUser(client, `:information_source: ${messageText}`); messageDiscordUser(client, `:information_source: ${messageText}`);
} }
@@ -140,46 +140,46 @@ function messageClientTip(client, messageText) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function messageClientTalk(client, talkingClient, messageText) { function messagePlayerTalk(client, talkingClient, messageText) {
messageClientNormal(client, `${getClientSubAccountName(talkingClient)} says: ${messageText}`, getColourByType("talkMessage")); messagePlayerNormal(client, `${getClientSubAccountName(talkingClient)} says: ${messageText}`, getColourByType("talkMessage"));
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function messageClientWhisper(client, whisperingClient, messageText) { function messagePlayerWhisper(client, whisperingClient, messageText) {
messageClientNormal(client, `${getClientSubAccountName(whisperingClient)} whispers: ${messageText}`, getColourByType("whisperMessage")); messagePlayerNormal(client, `${getClientSubAccountName(whisperingClient)} whispers: ${messageText}`, getColourByType("whisperMessage"));
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function messageClientShout(client, shoutingClient, messageText) { function messagePlayerShout(client, shoutingClient, messageText) {
messageClientNormal(client, `${getClientSubAccountName(shoutingClient)} shouts: ${messageText}!`, getColourByType("shoutMessage")); messagePlayerNormal(client, `${getClientSubAccountName(shoutingClient)} shouts: ${messageText}!`, getColourByType("shoutMessage"));
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function messageClientDoAction(client, doingActionClient, messageText) { function messagePlayerDoAction(client, doingActionClient, messageText) {
if(!isClientFromDiscord(client)) { if(!isClientFromDiscord(client)) {
messageClientNormal(client, `${messageText} * (${getClientSubAccountName(doingActionClient)})`, getColourByType("doActionMessage")); messagePlayerNormal(client, `${messageText} * (${getClientSubAccountName(doingActionClient)})`, getColourByType("doActionMessage"));
} }
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function messageClientMeAction(client, doingActionClient, messageText) { function messagePlayerMeAction(client, doingActionClient, messageText) {
messageClientNormal(client, `${getClientSubAccountName(doingActionClient)} ${messageText}`, getColourByType("meActionMessage")); messagePlayerNormal(client, `${getClientSubAccountName(doingActionClient)} ${messageText}`, getColourByType("meActionMessage"));
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function messageClientClanChat(client, clanChattingClient, messageText) { function messagePlayerClanChat(client, clanChattingClient, messageText) {
messageClientNormal(client, `(${getClientSubAccountClanRank(clanChattingClient)}) ${getClientSubAccountName(clanChattingClient)} says (clan): ${messageText}`, getColourByType("clanChatMessage")); messagePlayerNormal(client, `(${getClientSubAccountClanRank(clanChattingClient)}) ${getClientSubAccountName(clanChattingClient)} says (clan): ${messageText}`, getColourByType("clanChatMessage"));
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function messageClientAdminChat(client, adminChattingClient, messageText) { function messagePlayerAdminChat(client, adminChattingClient, messageText) {
messageClientNormal(client, `[ADMIN CHAT] [#AAAAAA]${getPlayerData(adminChattingClient).accountData.staffTitle} [#CCCCCC]${getPlayerData(adminChattingClient).accountData.name}: [#FFFFFF]${messageText}`, getColourByType("orange")); messagePlayerNormal(client, `[ADMIN CHAT] [#AAAAAA]${getPlayerData(adminChattingClient).accountData.staffTitle} [#CCCCCC]${getPlayerData(adminChattingClient).accountData.name}: [#FFFFFF]${messageText}`, getColourByType("orange"));
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -21,8 +21,8 @@ function initMiscScript() {
function getPositionCommand(command, params, client) { function getPositionCommand(command, params, client) {
let position = client.player.position; let position = client.player.position;
messageClientNormal(client, `Your position is: ${position.x.toFixed(2)}, ${position.y.toFixed(2)}, ${position.z.toFixed(2)}`); messagePlayerNormal(client, `Your position is: ${position.x.toFixed(2)}, ${position.y.toFixed(2)}, ${position.z.toFixed(2)}`);
console.log(`${getClientDisplayForConsole(client)}'s position is: ${position.x.toFixed(2)}, ${position.y.toFixed(2)}, ${position.z.toFixed(2)}`); console.log(`${getPlayerDisplayForConsole(client)}'s position is: ${position.x.toFixed(2)}, ${position.y.toFixed(2)}, ${position.z.toFixed(2)}`);
return true; return true;
} }
@@ -47,7 +47,7 @@ function setNewCharacterSpawnPositionCommand(command, params, client) {
getServerConfig().newCharacter.spawnPosition = position; getServerConfig().newCharacter.spawnPosition = position;
getServerConfig().newCharacter.spawnHeading = client.player.heading; getServerConfig().newCharacter.spawnHeading = client.player.heading;
messageClientNormal(client, `The new character spawn position has been set to ${position.x.toFixed(2)}, ${position.y.toFixed(2)}, ${position.z.toFixed(2)}`) messagePlayerNormal(client, `The new character spawn position has been set to ${position.x.toFixed(2)}, ${position.y.toFixed(2)}, ${position.z.toFixed(2)}`)
return true; return true;
} }
@@ -55,7 +55,7 @@ function setNewCharacterSpawnPositionCommand(command, params, client) {
function setNewCharacterMoneyCommand(command, params, client) { function setNewCharacterMoneyCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -64,7 +64,7 @@ function setNewCharacterMoneyCommand(command, params, client) {
getServerConfig().newCharacter.cash = skinId; getServerConfig().newCharacter.cash = skinId;
messageClientNormal(client, `The new character money has been set to $${amount}`); messagePlayerNormal(client, `The new character money has been set to $${amount}`);
return true; return true;
} }
@@ -72,7 +72,7 @@ function setNewCharacterMoneyCommand(command, params, client) {
function setNewCharacterSkinCommand(command, params, client) { function setNewCharacterSkinCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -85,7 +85,7 @@ function setNewCharacterSkinCommand(command, params, client) {
getServerConfig().newCharacter.skin = skinId; getServerConfig().newCharacter.skin = skinId;
messageClientNormal(client, `The new character skin has been set to ${getSkinNameFromId(skinId)} (ID ${skinId})`); messagePlayerNormal(client, `The new character skin has been set to ${getSkinNameFromId(skinId)} (ID ${skinId})`);
return true; return true;
} }
@@ -93,13 +93,13 @@ function setNewCharacterSkinCommand(command, params, client) {
function submitIdeaCommand(command, params, client) { function submitIdeaCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
submitIdea(client, params); submitIdea(client, params);
messageClientNormal(client, `Your suggestion/idea has been sent to the developers!`); messagePlayerNormal(client, `Your suggestion/idea has been sent to the developers!`);
return true; return true;
} }
@@ -107,13 +107,13 @@ function submitIdeaCommand(command, params, client) {
function submitBugReportCommand(command, params, client) { function submitBugReportCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
submitBugReport(client, params); submitBugReport(client, params);
messageClientNormal(client, `Your bug report has been sent to the developers!`); messagePlayerNormal(client, `Your bug report has been sent to the developers!`);
return true; return true;
} }
@@ -155,8 +155,8 @@ function enterExitPropertyCommand(command, params, client) {
let closestBusiness = getBusinessData(closestBusinessId) let closestBusiness = getBusinessData(closestBusinessId)
if(getDistance(closestBusiness.entrancePosition, getPlayerPosition(client)) <= getGlobalConfig().enterPropertyDistance) { if(getDistance(closestBusiness.entrancePosition, getPlayerPosition(client)) <= getGlobalConfig().enterPropertyDistance) {
if(!doesBusinessHaveInterior(closestBusinessId)) { if(!doesBusinessHaveInterior(closestBusinessId)) {
messageClientAlert(client, "This business does not have an interior."); messagePlayerAlert(client, "This business does not have an interior.");
messageClientTip(client, "You can use business commands at the door."); messagePlayerTip(client, "You can use business commands at the door.");
return false; return false;
} }
@@ -179,8 +179,8 @@ function enterExitPropertyCommand(command, params, client) {
//let distance = getDistance(closestHouse.entrancePosition, getPlayerPosition(client)); //let distance = getDistance(closestHouse.entrancePosition, getPlayerPosition(client));
if(getDistance(closestHouse.entrancePosition, getPlayerPosition(client)) <= getGlobalConfig().enterPropertyDistance) { if(getDistance(closestHouse.entrancePosition, getPlayerPosition(client)) <= getGlobalConfig().enterPropertyDistance) {
if(!doesHouseHaveInterior(closestHouseId)) { if(!doesHouseHaveInterior(closestHouseId)) {
messageClientAlert(client, "This house does not have an interior."); messagePlayerAlert(client, "This house does not have an interior.");
messageClientTip(client, "You can use house commands at the door."); messagePlayerTip(client, "You can use house commands at the door.");
return false; return false;
} }
@@ -197,7 +197,7 @@ function enterExitPropertyCommand(command, params, client) {
} }
} }
//messageClientError(client, "You aren't close enough to a door!"); //messagePlayerError(client, "You aren't close enough to a door!");
return true; return true;
} }

View File

@@ -15,20 +15,20 @@ function initModerationScript() {
function kickClientCommand(command, params, client) { function kickClientCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
// Prevent kicking admins with really high permissions // Prevent kicking admins with really high permissions
if(doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) { if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) {
if(!doesClientHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesClientHaveStaffPermission(client, getStaffFlagsCommand("developer"))) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("developer"))) {
messageClientError(client, "You cannot kick this person!"); messagePlayerError(client, "You cannot kick this person!");
return false; return false;
} }
} }
@@ -41,7 +41,7 @@ function kickClientCommand(command, params, client) {
function setClientStaffTitleCommand(command, params, client) { function setClientStaffTitleCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -50,21 +50,21 @@ function setClientStaffTitleCommand(command, params, client) {
let staffTitle = splitParams.slice(1).join(" "); let staffTitle = splitParams.slice(1).join(" ");
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
// Prevent setting titles on staff with really high permissions // Prevent setting titles on staff with really high permissions
if(doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) { if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) {
if(!doesClientHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesClientHaveStaffPermission(client, getStaffFlagsCommand("developer"))) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("developer"))) {
messageClientError(client, "You cannot set this person's staff title!"); messagePlayerError(client, "You cannot set this person's staff title!");
return false; return false;
} }
} }
getPlayerData(targetClient).accountData.staffTitle = staffTitle; getPlayerData(targetClient).accountData.staffTitle = staffTitle;
messageClientSuccess(client, `You set ${targetClient.name}'s staff title to ${staffTitle}`); messagePlayerSuccess(client, `You set ${targetClient.name}'s staff title to ${staffTitle}`);
messageClientAlert(client, `${client.name} set your staff title to ${staffTitle}`); messagePlayerAlert(client, `${client.name} set your staff title to ${staffTitle}`);
targetClient.disconnect(); targetClient.disconnect();
} }
@@ -72,20 +72,20 @@ function setClientStaffTitleCommand(command, params, client) {
function muteClientCommand(command, params, client) { function muteClientCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
// Prevent muting admins with really high permissions // Prevent muting admins with really high permissions
if(doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) { if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) {
if(!doesClientHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesClientHaveStaffPermission(client, getStaffFlagsCommand("developer"))) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("developer"))) {
messageClientError(client, "You cannot mute this person!"); messagePlayerError(client, "You cannot mute this person!");
return false; return false;
} }
} }
@@ -99,20 +99,20 @@ function muteClientCommand(command, params, client) {
function unMuteClientCommand(command, params, client) { function unMuteClientCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
// Prevent unmuting admins with really high permissions // Prevent unmuting admins with really high permissions
if(doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) { if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) {
if(!doesClientHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesClientHaveStaffPermission(client, getStaffFlagsCommand("developer"))) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("developer"))) {
messageClientError(client, "You cannot unmute this person!"); messagePlayerError(client, "You cannot unmute this person!");
return false; return false;
} }
} }
@@ -125,20 +125,20 @@ function unMuteClientCommand(command, params, client) {
function freezeClientCommand(command, params, client) { function freezeClientCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
// Prevent freeze admins with really high permissions // Prevent freeze admins with really high permissions
if(doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) { if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) {
if(!doesClientHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesClientHaveStaffPermission(client, getStaffFlagsCommand("developer"))) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("developer"))) {
messageClientError(client, "You cannot freeze this person!"); messagePlayerError(client, "You cannot freeze this person!");
return false; return false;
} }
} }
@@ -151,20 +151,20 @@ function freezeClientCommand(command, params, client) {
function unFreezeClientCommand(command, params, client) { function unFreezeClientCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
// Prevent unfreezing admins with really high permissions // Prevent unfreezing admins with really high permissions
if(doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) { if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) {
if(!doesClientHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesClientHaveStaffPermission(client, getStaffFlagsCommand("developer"))) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("developer"))) {
messageClientError(client, "You cannot freeze this person!"); messagePlayerError(client, "You cannot freeze this person!");
return false; return false;
} }
} }
@@ -177,20 +177,20 @@ function unFreezeClientCommand(command, params, client) {
function gotoPlayerCommand(command, params, client) { function gotoPlayerCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
//message(`[#996600][ADMIN]: [#FFFFFF]${toString(targetClient.name)} has been un-frozen by an admin!`); //message(`[#996600][ADMIN]: [#FFFFFF]${toString(targetClient.name)} has been un-frozen by an admin!`);
client.player.velocity = toVector3(0.0, 0.0, 0.0); client.player.velocity = toVector3(0.0, 0.0, 0.0);
triggerNetworkEvent("ag.position", client, getPosBehindPos(getPlayerPosition(targetClient), getPlayerHeading(targetClient), 2)); setPlayerPosition(client, getPosBehindPos(getPlayerPosition(targetClient), getPlayerHeading(targetClient), 2));
triggerNetworkEvent("ag.heading", client, getPlayerHeading(targetClient)); setPlayerHeading(client, getPlayerHeading(targetClient));
if(isPlayerInAnyBusiness(targetClient)) { if(isPlayerInAnyBusiness(targetClient)) {
let businessData = getBusinessData(getPlayerBusiness(targetClient)); let businessData = getBusinessData(getPlayerBusiness(targetClient));
@@ -205,19 +205,19 @@ function gotoPlayerCommand(command, params, client) {
//triggerNetworkEvent("ag.dimension", client, houseData.exitInterior); //triggerNetworkEvent("ag.dimension", client, houseData.exitInterior);
client.player.dimension = houseData.exitDimension; client.player.dimension = houseData.exitDimension;
} }
messageClientSuccess(client, `You teleported to [#AAAAAA]${targetClient.name}`); messagePlayerSuccess(client, `You teleported to [#AAAAAA]${targetClient.name}`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function gotoVehicleCommand(command, params, client) { function gotoVehicleCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
if(typeof getServerData().vehicles[toInteger(params)] == "undefined") { if(typeof getServerData().vehicles[toInteger(params)] == "undefined") {
messageClientError(client, "That vehicle ID doesn't exist!"); messagePlayerError(client, "That vehicle ID doesn't exist!");
} }
let vehicle = getServerData().vehicles[toInteger(params)].vehicle; let vehicle = getServerData().vehicles[toInteger(params)].vehicle;
@@ -229,21 +229,21 @@ function gotoVehicleCommand(command, params, client) {
setPlayerVirtualWorld(client, vehicle.dimension); setPlayerVirtualWorld(client, vehicle.dimension);
}, 500); }, 500);
messageClientSuccess(client, `You teleported to a [#CC22CC]${getVehicleName(vehicle)} [#AAAAAA](ID ${vehicle.id})`); messagePlayerSuccess(client, `You teleported to a [#CC22CC]${getVehicleName(vehicle)} [#AAAAAA](ID ${vehicle.id})`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function gotoBusinessCommand(command, params, client) { function gotoBusinessCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let businessId = getBusinessFromParams(params) let businessId = getBusinessFromParams(params)
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messageClientError(client, "That business doesn't exist!"); messagePlayerError(client, "That business doesn't exist!");
return false; return false;
} }
@@ -254,21 +254,21 @@ function gotoBusinessCommand(command, params, client) {
setPlayerVirtualWorld(client, getBusinessData(businessId).entranceDimension); setPlayerVirtualWorld(client, getBusinessData(businessId).entranceDimension);
}, 500); }, 500);
messageClientSuccess(client, `You teleported to business [#0099FF]${getBusinessData(businessId).name} [#AAAAAA](ID ${businessId})`); messagePlayerSuccess(client, `You teleported to business [#0099FF]${getBusinessData(businessId).name} [#AAAAAA](ID ${businessId})`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function gotoHouseCommand(command, params, client) { function gotoHouseCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let houseId = getHouseFromParams(params) let houseId = getHouseFromParams(params)
if(!getHouseData(houseId)) { if(!getHouseData(houseId)) {
messageClientError(client, "That house doesn't exist!"); messagePlayerError(client, "That house doesn't exist!");
return false; return false;
} }
@@ -279,14 +279,14 @@ function gotoHouseCommand(command, params, client) {
setPlayerVirtualWorld(client, getHouseData(houseId).entranceDimension); setPlayerVirtualWorld(client, getHouseData(houseId).entranceDimension);
}, 500); }, 500);
messageClientSuccess(client, `You teleported to business [#0099FF]${getHouseData(houseId).description} [#AAAAAA](ID ${houseId})`); messagePlayerSuccess(client, `You teleported to business [#0099FF]${getHouseData(houseId).description} [#AAAAAA](ID ${houseId})`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function gotoJobLocationCommand(command, params, client) { function gotoJobLocationCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -295,14 +295,14 @@ function gotoJobLocationCommand(command, params, client) {
let jobId = getJobFromParams(splitParams[0]) || getClosestJobLocation(getPlayerPosition(client)).job; let jobId = getJobFromParams(splitParams[0]) || getClosestJobLocation(getPlayerPosition(client)).job;
if(!getJobData(jobId)) { if(!getJobData(jobId)) {
messageClientError(client, `That job does not exist!`); messagePlayerError(client, `That job does not exist!`);
return false; return false;
} }
let jobLocationId = splitParams[1] || 0; let jobLocationId = splitParams[1] || 0;
if(typeof getJobData(jobId).locations[jobLocationId] == "undefined") { if(typeof getJobData(jobId).locations[jobLocationId] == "undefined") {
messageClientError(client, `That location ID does not exist!`); messagePlayerError(client, `That location ID does not exist!`);
return false; return false;
} }
@@ -311,14 +311,14 @@ function gotoJobLocationCommand(command, params, client) {
setPlayerInterior(client, getJobData(jobId).locations[jobLocationId].interior); setPlayerInterior(client, getJobData(jobId).locations[jobLocationId].interior);
setPlayerVirtualWorld(client, getJobData(jobId).locations[jobLocationId].dimension); setPlayerVirtualWorld(client, getJobData(jobId).locations[jobLocationId].dimension);
messageClientSuccess(client, `You teleported to location [#AAAAAA]${jobLocationId} [#FFFFFF]for the [#AAAAAA]${getJobData(jobId).name} [#FFFFFF]job`); messagePlayerSuccess(client, `You teleported to location [#AAAAAA]${jobLocationId} [#FFFFFF]for the [#AAAAAA]${getJobData(jobId).name} [#FFFFFF]job`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function gotoPositionCommand(command, params, client) { function gotoPositionCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -338,128 +338,126 @@ function gotoPositionCommand(command, params, client) {
setPlayerInterior(client, Number(int)); setPlayerInterior(client, Number(int));
setPlayerVirtualWorld(client, Number(vw)); setPlayerVirtualWorld(client, Number(vw));
messageClientSuccess(client, `You teleported to coordinates [#AAAAAA]${x}, ${y}, ${z} with interior ${int} and dimension ${vw}`); messagePlayerSuccess(client, `You teleported to coordinates [#AAAAAA]${x}, ${y}, ${z} with interior ${int} and dimension ${vw}`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function teleportForwardCommand(command, params, client) { function teleportForwardCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
setPlayerPosition(client, getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), params)); setPlayerPosition(client, getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), params));
messageClientSuccess(client, `You teleported forward ${params} meters`); messagePlayerSuccess(client, `You teleported forward ${params} meters`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function teleportBackwardCommand(command, params, client) { function teleportBackwardCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
setPlayerPosition(client, getPosBehindPos(getPlayerPosition(client), getPlayerHeading(client), params)); setPlayerPosition(client, getPosBehindPos(getPlayerPosition(client), getPlayerHeading(client), params));
messageClientSuccess(client, `You teleported backward [#AAAAAA]${params} [#FFFFFF]meters`); messagePlayerSuccess(client, `You teleported backward [#AAAAAA]${params} [#FFFFFF]meters`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function teleportLeftCommand(command, params, client) { function teleportLeftCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
setPlayerPosition(client, getPosToLeftOfPos(getPlayerPosition(client), getPlayerHeading(client), params)); setPlayerPosition(client, getPosToLeftOfPos(getPlayerPosition(client), getPlayerHeading(client), params));
messageClientSuccess(client, `You teleported left [#AAAAAA]${params} [#FFFFFF]meters`); messagePlayerSuccess(client, `You teleported left [#AAAAAA]${params} [#FFFFFF]meters`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function teleportUpCommand(command, params, client) { function teleportUpCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
setPlayerPosition(client, getPosAbovePos(getPlayerPosition(client), params)); setPlayerPosition(client, getPosAbovePos(getPlayerPosition(client), params));
messageClientSuccess(client, `You teleported up [#AAAAAA]${params} [#FFFFFF]meters`); messagePlayerSuccess(client, `You teleported up [#AAAAAA]${params} [#FFFFFF]meters`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function teleportDownCommand(command, params, client) { function teleportDownCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
triggerNetworkEvent("ag.position", client, getPosBelowPos(getPlayerPosition(client), params)); triggerNetworkEvent("ag.position", client, getPosBelowPos(getPlayerPosition(client), params));
messageClientSuccess(client, `You teleported down [#AAAAAA]${params} [#FFFFFF]meters`); messagePlayerSuccess(client, `You teleported down [#AAAAAA]${params} [#FFFFFF]meters`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function teleportRightCommand(command, params, client) { function teleportRightCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
triggerNetworkEvent("ag.position", client, getPosToRightOfPos(getPlayerPosition(client), getPlayerHeading(client), params)); setPlayerPosition(client, getPosToRightOfPos(getPlayerPosition(client), getPlayerHeading(client), params));
messageClientSuccess(client, `You teleported right [#AAAAAA]${params} [#FFFFFF]meters`); messagePlayerSuccess(client, `You teleported right [#AAAAAA]${params} [#FFFFFF]meters`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function getPlayerCommand(command, params, client) { function getPlayerCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
triggerNetworkEvent("ag.removeFromVehicle", targetClient); removePlayerFromVehicle(targetClient);
triggerNetworkEvent("ag.position", targetClient, getPosBehindPos(getPlayerPosition(client), getPlayerHeading(client), 2)); setPlayerPosition(targetClient, getPosBehindPos(getPlayerPosition(client), getPlayerHeading(client), 2));
triggerNetworkEvent("ag.heading", targetClient, getPlayerHeading(client)); setPlayerHeading(targetClient, getPlayerHeading(client));
if(isPlayerInAnyBusiness(client)) { if(isPlayerInAnyBusiness(client)) {
let businessData = getBusinessData(getPlayerBusiness(client)); let businessData = getBusinessData(getPlayerBusiness(client));
triggerNetworkEvent("ag.interior", targetClient, businessData.exitInterior); setPlayerInterior(targetClient, businessData.exitInterior);
//triggerNetworkEvent("ag.dimension", client, businessData.exitInterior); setPlayerVirtualWorld(targetClient, businessData.exitDimension);
targetClient.player.dimension = businessData.exitDimension;
} }
if(isPlayerInAnyHouse(client)) { if(isPlayerInAnyHouse(client)) {
let houseData = getHouseData(getPlayerHouse(client)); let houseData = getHouseData(getPlayerHouse(client));
triggerNetworkEvent("ag.interior", targetClient, houseData.exitInterior); setPlayerInterior(targetClient, houseData.exitInterior);
//triggerNetworkEvent("ag.dimension", client, houseData.exitInterior); setPlayerVirtualWorld(client, houseData.exitDimension);
targetClient.player.dimension = houseData.exitDimension;
} }
messageClientSuccess(client, `You teleported [#AAAAAA]${targetClient.name} [#FFFFFF]to you.`); messagePlayerSuccess(client, `You teleported [#AAAAAA]${targetClient.name} [#FFFFFF]to you.`);
messageClientAlert(targetClient, `An admin has teleported you to their location`); messagePlayerAlert(targetClient, `An admin has teleported you to their location`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function addStaffFlagCommand(command, params, client) { function addStaffFlagCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -468,32 +466,32 @@ function addStaffFlagCommand(command, params, client) {
let flagName = splitParams[1] || "none"; let flagName = splitParams[1] || "none";
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
// Prevent setting flags on admins with really high permissions // Prevent setting flags on admins with really high permissions
if(doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) { if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) {
if(!doesClientHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesClientHaveStaffPermission(client, getStaffFlagsCommand("developer"))) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("developer"))) {
messageClientError(client, "You cannot give staff flags to this person!"); messagePlayerError(client, "You cannot give staff flags to this person!");
return false; return false;
} }
} }
if(!getStaffFlagValue(flagName)) { if(!getStaffFlagValue(flagName)) {
messageClientError(client, "That staff flag doesn't exist!"); messagePlayerError(client, "That staff flag doesn't exist!");
return false; return false;
} }
giveClientStaffFlag(targetClient, flagName); givePlayerStaffFlag(targetClient, flagName);
messageClientSuccess(client, `You have ${getBoolRedGreenInlineColour(true)}given [#AAAAAA]${targetClient.name} [#FFFFFF]the [#AAAAAA]${flagName} [#FFFFFF]staff flag`); messagePlayerSuccess(client, `You have ${getBoolRedGreenInlineColour(true)}given [#AAAAAA]${targetClient.name} [#FFFFFF]the [#AAAAAA]${flagName} [#FFFFFF]staff flag`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function takeStaffFlagCommand(command, params, client) { function takeStaffFlagCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -502,32 +500,32 @@ function takeStaffFlagCommand(command, params, client) {
let flagName = splitParams[1] || "none"; let flagName = splitParams[1] || "none";
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
// Prevent setting flags on admins with really high permissions // Prevent setting flags on admins with really high permissions
if(doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) { if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) {
if(!doesClientHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesClientHaveStaffPermission(client, getStaffFlagsCommand("developer"))) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("developer"))) {
messageClientError(client, "You cannot take staff flags from this person!"); messagePlayerError(client, "You cannot take staff flags from this person!");
return false; return false;
} }
} }
if(!getStaffFlagValue(flagName)) { if(!getStaffFlagValue(flagName)) {
messageClientError(client, "That staff flag doesn't exist!"); messagePlayerError(client, "That staff flag doesn't exist!");
return false; return false;
} }
takeClientStaffFlag(targetClient, flagName); takePlayerStaffFlag(targetClient, flagName);
messageClientSuccess(client, `You have ${getBoolRedGreenInlineColour(false)}taken [#FFFFFF]the [#AAAAAA]${flagName} [#FFFFFF]staff flag from [#AAAAAA]${targetClient.name}`); messagePlayerSuccess(client, `You have ${getBoolRedGreenInlineColour(false)}taken [#FFFFFF]the [#AAAAAA]${flagName} [#FFFFFF]staff flag from [#AAAAAA]${targetClient.name}`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function clearStaffFlagsCommand(command, params, client) { function clearStaffFlagsCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -536,44 +534,44 @@ function clearStaffFlagsCommand(command, params, client) {
let flagName = splitParams[1] || "none"; let flagName = splitParams[1] || "none";
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
// Prevent setting flags on admins with really high permissions // Prevent setting flags on admins with really high permissions
if(doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesClientHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) { if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("manageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagsCommand("developer"))) {
if(!doesClientHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesClientHaveStaffPermission(client, getStaffFlagsCommand("developer"))) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("manageServer")) && !doesPlayerHaveStaffPermission(client, getStaffFlagsCommand("developer"))) {
messageClientError(client, "You cannot clear staff flags for this person!"); messagePlayerError(client, "You cannot clear staff flags for this person!");
return false; return false;
} }
} }
if(!getStaffFlagValue(flagName)) { if(!getStaffFlagValue(flagName)) {
messageClientError(client, "That staff flag doesn't exist!"); messagePlayerError(client, "That staff flag doesn't exist!");
return false; return false;
} }
clearClientStaffFlags(targetClient); clearPlayerStaffFlags(targetClient);
messageClientSuccess(client, `You have removed all staff flags from [#AAAAAA]${targetClient.name}`); messagePlayerSuccess(client, `You have removed all staff flags from [#AAAAAA]${targetClient.name}`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function getStaffFlagsCommand(command, params, client) { function getStaffFlagsCommand(command, params, client) {
if(getCommand(command).requireLogin) { if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
messageClientError(client, "You must be logged in to use this command!"); messagePlayerError(client, "You must be logged in to use this command!");
return false; return false;
} }
} }
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) { if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
messageClientError(client, "You do not have permission to use this command!"); messagePlayerError(client, "You do not have permission to use this command!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -582,7 +580,7 @@ function getStaffFlagsCommand(command, params, client) {
let flagName = splitParams[1] || "none"; let flagName = splitParams[1] || "none";
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
@@ -590,19 +588,19 @@ function getStaffFlagsCommand(command, params, client) {
let serverBitFlagKeys = getServerBitFlagKeys(); let serverBitFlagKeys = getServerBitFlagKeys();
for(let i in serverBitFlagKeys) { for(let i in serverBitFlagKeys) {
let tempFlagValue = getStaffFlagValue(serverBitFlagKeys[i]); let tempFlagValue = getStaffFlagValue(serverBitFlagKeys[i]);
if(doesClientHaveStaffPermission(client, tempFlagValue)) { if(doesPlayerHaveStaffPermission(client, tempFlagValue)) {
tempStaffFlags.push(serverBitFlagKeys[i]); tempStaffFlags.push(serverBitFlagKeys[i]);
} }
} }
messageClientInfo(client, `[#FFFFFF]${targetClient.name}'s staff flags: [#AAAAAA]${tempStaffFlags.join("[#FFFFFF], [#AAAAAA]")}`); messagePlayerInfo(client, `[#FFFFFF]${targetClient.name}'s staff flags: [#AAAAAA]${tempStaffFlags.join("[#FFFFFF], [#AAAAAA]")}`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function allStaffFlagsCommand(command, params, client) { function allStaffFlagsCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -611,18 +609,18 @@ function allStaffFlagsCommand(command, params, client) {
let flagName = splitParams[1] || "none"; let flagName = splitParams[1] || "none";
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
messageClientInfo(client, `[#FFFFFF]Staff flags: [#AAAAAA]${getServerBitFlagKeys().join("[#FFFFFF], [#AAAAAA]")}`); messagePlayerInfo(client, `[#FFFFFF]Staff flags: [#AAAAAA]${getServerBitFlagKeys().join("[#FFFFFF], [#AAAAAA]")}`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function givePlayerMoneyCommand(command, params, client) { function givePlayerMoneyCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -631,14 +629,14 @@ function givePlayerMoneyCommand(command, params, client) {
let amount = toInteger(splitParams[1]); let amount = toInteger(splitParams[1]);
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
getClientCurrentSubAccount(targetClient).cash += amount; getPlayerCurrentSubAccount(targetClient).cash += amount;
updatePlayerCash(targetClient); updatePlayerCash(targetClient);
messageClientSuccess(client, `You gave [#AAAAAA]$${amount} [#FFFFFF]to [#AAAAAA]${getCharacterFullName(targetClient)}`); messagePlayerSuccess(client, `You gave [#AAAAAA]$${amount} [#FFFFFF]to [#AAAAAA]${getCharacterFullName(targetClient)}`);
messageClientAlert(client, `An admin gave you [#AAAAAA]$${amount}`); messagePlayerAlert(client, `An admin gave you [#AAAAAA]$${amount}`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -145,7 +145,7 @@ function getPlayerVehicleSeat(client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function isPlayerSpawned(client) { function isPlayerSpawned(client) {
return client.player return (client.player != null);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -175,7 +175,11 @@ function getVehicleForNetworkEvent(vehicle) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function deleteGameElement(element) { function deleteGameElement(element) {
destroyElement(element); if(element != null) {
destroyElement(element);
return true;
}
return false;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -184,4 +188,11 @@ function isPlayerInFrontVehicleSeat(client) {
return (getPlayerVehicleSeat(client) == 0 || getPlayerVehicleSeat(client) == 1); return (getPlayerVehicleSeat(client) == 0 || getPlayerVehicleSeat(client) == 1);
} }
// ---------------------------------------------------------------------------
function removePlayerFromVehicle(client) {
triggerNetworkEvent("ag.removeFromVehicle", client);
return true;
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -16,6 +16,8 @@ const triggerSource = {
house, house,
}; };
// ---------------------------------------------------------------------------
const NPC = { const NPC = {
Trigger: { Trigger: {
farProximity, // Comes within a far distance of NPC farProximity, // Comes within a far distance of NPC
@@ -108,6 +110,10 @@ const NPC = {
} }
}; };
// ---------------------------------------------------------------------------
function npcTrigger(triggerName, triggerSource) { function npcTrigger(triggerName, triggerSource) {
} }
// ---------------------------------------------------------------------------

View File

@@ -127,16 +127,16 @@ function showCharacterSelectToClient(client) {
getPlayerData(client).currentSubAccount = 0; getPlayerData(client).currentSubAccount = 0;
let tempSubAccount = getPlayerData(client).subAccounts[0]; let tempSubAccount = getPlayerData(client).subAccounts[0];
triggerNetworkEvent("ag.showCharacterSelect", client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.placeOfOrigin, tempSubAccount.dateOfBirth, tempSubAccount.skin); triggerNetworkEvent("ag.showCharacterSelect", client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.placeOfOrigin, tempSubAccount.dateOfBirth, tempSubAccount.skin);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the character select GUI`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the character select GUI`);
} else { } else {
//let emojiNumbers = ["➊", "➋", "➌", "➍", "➎", "➏", "➐", "➑", "➒"]; //let emojiNumbers = ["➊", "➋", "➌", "➍", "➎", "➏", "➐", "➑", "➒"];
//let emojiNumbers = ["①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨"]; //let emojiNumbers = ["①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨"];
//let emojiNumbers = ["1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣"]; //let emojiNumbers = ["1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣"];
messageClientNormal(client, `You have the following characters. Use /usechar <id> to select one:`, getColourByName("teal")); messagePlayerNormal(client, `You have the following characters. Use /usechar <id> to select one:`, getColourByName("teal"));
getPlayerData(client).subAccounts.forEach(function(subAccount, index) { getPlayerData(client).subAccounts.forEach(function(subAccount, index) {
messageClientNormal(client, `${index+1} • [#AAAAAA]${subAccount.firstName} ${subAccount.lastName}`); messagePlayerNormal(client, `${index+1} • [#AAAAAA]${subAccount.firstName} ${subAccount.lastName}`);
}); });
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the character select/list message (GUI disabled)`); console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} is being shown the character select/list message (GUI disabled)`);
} }
} }
@@ -174,9 +174,9 @@ function checkNewCharacter(client, firstName, lastName, dateOfBirth, placeOfOrig
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.newCharacterFailed", client, "Something went wrong. Your character could not be created!"); triggerNetworkEvent("ag.newCharacterFailed", client, "Something went wrong. Your character could not be created!");
} else { } else {
messageClientAlert(client, "Something went wrong. Your character could not be created!"); messagePlayerAlert(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."); messagePlayerAlert(client, "Asshat Gaming staff have been notified of the problem and will fix it shortly.");
return false; return false;
} }
@@ -230,14 +230,14 @@ async function selectCharacter(client, characterId = -1) {
getPlayerData(client).currentSubAccount = characterId; getPlayerData(client).currentSubAccount = characterId;
} }
let tempSubAccount = getClientCurrentSubAccount(client); let tempSubAccount = getPlayerCurrentSubAccount(client);
spawnPlayer(client, tempSubAccount.spawnPosition, tempSubAccount.spawnHeading, tempSubAccount.skin); spawnPlayer(client, tempSubAccount.spawnPosition, tempSubAccount.spawnHeading, tempSubAccount.skin);
tempSubAccount.lastLogin = new Date().getTime(); tempSubAccount.lastLogin = new Date().getTime();
messageClientAlert(client, `You are now playing as: [#0099FF]${tempSubAccount.firstName} ${tempSubAccount.lastName}`, getColourByName("white")); messagePlayerAlert(client, `You are now playing as: [#0099FF]${tempSubAccount.firstName} ${tempSubAccount.lastName}`, getColourByName("white"));
messageClientNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange")); messagePlayerNormal(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")); messagePlayerNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
triggerNetworkEvent("ag.restoreCamera", client); triggerNetworkEvent("ag.restoreCamera", client);
setEntityData(client, "ag.spawned", true, true); setEntityData(client, "ag.spawned", true, true);
@@ -265,12 +265,12 @@ addNetworkHandler("ag.selectCharacter", selectCharacter);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function switchCharacterCommand(command, params, client) { function switchCharacterCommand(command, params, client) {
getClientCurrentSubAccount(client).spawnPosition = getPlayerPosition(client); getPlayerCurrentSubAccount(client).spawnPosition = getPlayerPosition(client);
getClientCurrentSubAccount(client).spawnHeading = getPlayerHeading(client); getPlayerCurrentSubAccount(client).spawnHeading = getPlayerHeading(client);
getClientCurrentSubAccount(client).interior = getPlayerInterior(client); getPlayerCurrentSubAccount(client).interior = getPlayerInterior(client);
getClientCurrentSubAccount(client).dimension = getPlayerVirtualWorld(client); getPlayerCurrentSubAccount(client).dimension = getPlayerVirtualWorld(client);
saveSubAccountToDatabase(getClientCurrentSubAccount(client)); saveSubAccountToDatabase(getPlayerCurrentSubAccount(client));
resetClientStuff(client); resetClientStuff(client);
@@ -283,7 +283,7 @@ function switchCharacterCommand(command, params, client) {
function newCharacterCommand(command, params, client) { function newCharacterCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -303,7 +303,7 @@ function useCharacterCommand(command, params, client) {
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -334,7 +334,7 @@ function transferCharacterToServer(subAccountDatabaseId, newServerId) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function getCharacterFullName(client) { function getCharacterFullName(client) {
return `${getClientCurrentSubAccount(client).firstName} ${getClientCurrentSubAccount(client).lastName}`; return `${getPlayerCurrentSubAccount(client).firstName} ${getPlayerCurrentSubAccount(client).lastName}`;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -49,7 +49,7 @@ function vehicleRentCheck() {
if(getServerData().vehicles[i].rentedBy) { if(getServerData().vehicles[i].rentedBy) {
let rentedBy = getServerData().vehicles[i].rentedBy; let rentedBy = getServerData().vehicles[i].rentedBy;
if(getPlayerData(rentedBy).cash < getServerData().vehicles[i].rentPrice) { if(getPlayerData(rentedBy).cash < getServerData().vehicles[i].rentPrice) {
messageClientAlert(rentedBy, `You do not have enough money to continue renting this vehicle!`); messagePlayerAlert(rentedBy, `You do not have enough money to continue renting this vehicle!`);
stopRentingVehicle(rentedBy); stopRentingVehicle(rentedBy);
} else { } else {
getPlayerData(rentedBy).cash -= getServerData().vehicles[i].rentPrice; getPlayerData(rentedBy).cash -= getServerData().vehicles[i].rentPrice;

View File

@@ -735,7 +735,7 @@ function getClientFromName(clientName) {
return clients[i]; return clients[i];
} }
let charName = `${getClientCurrentSubAccount(clients[i]).firstName} ${getClientCurrentSubAccount(clients[i]).lastName}`; let charName = `${getPlayerCurrentSubAccount(clients[i]).firstName} ${getPlayerCurrentSubAccount(clients[i]).lastName}`;
if(toLowerCase(charName).indexOf(toLowerCase(clientName)) != -1) { if(toLowerCase(charName).indexOf(toLowerCase(clientName)) != -1) {
return clients[i]; return clients[i];
} }
@@ -1154,7 +1154,7 @@ function getPlayerData(client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function getClientCurrentSubAccount(client) { function getPlayerCurrentSubAccount(client) {
if(!getPlayerData(client)) { if(!getPlayerData(client)) {
return false; return false;
} }
@@ -1170,7 +1170,7 @@ function getClientCurrentSubAccount(client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function getClientSubAccountName(client) { function getClientSubAccountName(client) {
let subAccountData = getClientCurrentSubAccount(client); let subAccountData = getPlayerCurrentSubAccount(client);
return `${subAccountData.firstName} ${subAccountData.lastName}`; return `${subAccountData.firstName} ${subAccountData.lastName}`;
} }
@@ -1455,22 +1455,22 @@ function processHoldActionKey(client) {
let jobData = getJobData(closestJobId); let jobData = getJobData(closestJobId);
if(getClientCurrentSubAccount(client).job == AG_JOB_NONE) { if(getPlayerCurrentSubAccount(client).job == AG_JOB_NONE) {
if(jobData.position.distance(client.player.position) <= getGlobalConfig().takeJobDistance) { if(jobData.position.distance(client.player.position) <= getGlobalConfig().takeJobDistance) {
takeJob(client, closestJobId); takeJob(client, closestJobId);
messageClientSuccess(client, "You now have the " + toString(jobData.name) + " job"); messagePlayerSuccess(client, "You now have the " + toString(jobData.name) + " job");
} }
} else { } else {
if(jobData.jobType == getClientCurrentSubAccount(client).job) { if(jobData.jobType == getPlayerCurrentSubAccount(client).job) {
if(jobData.position.distance(client.player.position) <= getGlobalConfig().startWorkDistance) { if(jobData.position.distance(client.player.position) <= getGlobalConfig().startWorkDistance) {
startWorking(client); startWorking(client);
messageClientSuccess(client, "You are now working as a " + toString(jobData.name)); messagePlayerSuccess(client, "You are now working as a " + toString(jobData.name));
showStartedWorkingTip(client); showStartedWorkingTip(client);
return true; return true;
} }
} else { } else {
messageClientError(client, "This is not your job!"); messagePlayerError(client, "This is not your job!");
messageClientInfo(client, `Use /quitjob to quit your current job.`); messagePlayerInfo(client, `Use /quitjob to quit your current job.`);
} }
} }
} }
@@ -1481,7 +1481,7 @@ function processPressActionKey(client) {
// Check job stuff // Check job stuff
let closestJob = getClosestJob(client.player.position); let closestJob = getClosestJob(client.player.position);
if(getClientCurrentSubAccount(client).job == AG_JOB_NONE) { if(getPlayerCurrentSubAccount(client).job == AG_JOB_NONE) {
if(closestJob.position.distance(client.player.position) <= getGlobalConfig().takeJobDistance) { if(closestJob.position.distance(client.player.position) <= getGlobalConfig().takeJobDistance) {
} }
@@ -1509,7 +1509,7 @@ function processHoldVehicleEngineKey(client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function getClientChatColour(client) { function getClientChatColour(client) {
let tempJob = getClientCurrentSubAccount(client).job; let tempJob = getPlayerCurrentSubAccount(client).job;
if(tempJob != -1) { if(tempJob != -1) {
if(getPlayerData(client).isWorking) { if(getPlayerData(client).isWorking) {
return getJobData(tempJob).jobColour; return getJobData(tempJob).jobColour;
@@ -1647,7 +1647,7 @@ function getHouseFromParams(params) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function updatePlayerCash(client) { function updatePlayerCash(client) {
triggerNetworkEvent("ag.money", client, getClientCurrentSubAccount(client).cash); triggerNetworkEvent("ag.money", client, getPlayerCurrentSubAccount(client).cash);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -1751,7 +1751,7 @@ function arrayBufferToString(arrayBuffer) {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function getClientDisplayForConsole(client) { function getPlayerDisplayForConsole(client) {
return `${client.name}[${client.index}]`; return `${client.name}[${client.index}]`;
} }
@@ -1759,7 +1759,7 @@ function getClientDisplayForConsole(client) {
function getPlayerNameForNameTag(client) { function getPlayerNameForNameTag(client) {
if(isPlayerSpawned(client)) { if(isPlayerSpawned(client)) {
return `${getClientCurrentSubAccount(client).firstName} ${getClientCurrentSubAccount(client).lastName}`; return `${getPlayerCurrentSubAccount(client).firstName} ${getPlayerCurrentSubAccount(client).lastName}`;
} }
return client.name; return client.name;
} }

View File

@@ -131,7 +131,7 @@ function createVehicleCommand(command, params, client) {
let modelId = getVehicleModelIdFromParams(params); let modelId = getVehicleModelIdFromParams(params);
if(!modelId) { if(!modelId) {
messageClientError(client, "That vehicle type is invalid!"); messagePlayerError(client, "That vehicle type is invalid!");
return false; return false;
} }
@@ -140,7 +140,7 @@ function createVehicleCommand(command, params, client) {
let vehicle = gta.createVehicle(modelId, frontPos, getPlayerHeading(client)); let vehicle = gta.createVehicle(modelId, frontPos, getPlayerHeading(client));
if(!vehicle) { if(!vehicle) {
messageClientError(client, "The vehicle could not be created!"); messagePlayerError(client, "The vehicle could not be created!");
return false; return false;
} }
vehicle.heading = getPlayerHeading(client); vehicle.heading = getPlayerHeading(client);
@@ -162,7 +162,7 @@ function createTemporaryVehicleCommand(command, params, client) {
let modelId = getVehicleModelIdFromParams(params); let modelId = getVehicleModelIdFromParams(params);
if(!modelId) { if(!modelId) {
messageClientError(client, "That vehicle type is invalid!"); messagePlayerError(client, "That vehicle type is invalid!");
return false; return false;
} }
@@ -171,7 +171,7 @@ function createTemporaryVehicleCommand(command, params, client) {
let vehicle = gta.createVehicle(modelId, frontPos, getPlayerHeading(client)); let vehicle = gta.createVehicle(modelId, frontPos, getPlayerHeading(client));
if(!vehicle) { if(!vehicle) {
messageClientError(client, "The vehicle could not be created!"); messagePlayerError(client, "The vehicle could not be created!");
return false; return false;
} }
vehicle.heading = getPlayerHeading(client); vehicle.heading = getPlayerHeading(client);
@@ -194,19 +194,19 @@ function vehicleLockCommand(command, params, client) {
let vehicle = getClosestVehicle(getPlayerPosition(client)); let vehicle = getClosestVehicle(getPlayerPosition(client));
if(!getPlayerVehicle(client) && getDistance(getVehiclePosition(vehicle), getPlayerPosition(client)) > getGlobalConfig().vehicleLockDistance) { if(!getPlayerVehicle(client) && getDistance(getVehiclePosition(vehicle), getPlayerPosition(client)) > getGlobalConfig().vehicleLockDistance) {
messageClientError(client, "You need to be in or near a vehicle!"); messagePlayerError(client, "You need to be in or near a vehicle!");
return false; return false;
} }
if(isPlayerInAnyVehicle(client)) { if(isPlayerInAnyVehicle(client)) {
vehicle = getPlayerVehicle(client); vehicle = getPlayerVehicle(client);
if(!isPlayerInFrontVehicleSeat(client)) { if(!isPlayerInFrontVehicleSeat(client)) {
messageClientError(client, "You need to be in the front seat!"); messagePlayerError(client, "You need to be in the front seat!");
return false; return false;
} }
} else { } else {
if(!doesClientHaveVehicleKeys(client, vehicle)) { if(!doesClientHaveVehicleKeys(client, vehicle)) {
messageClientError(client, "You don't have keys to this vehicle!"); messagePlayerError(client, "You don't have keys to this vehicle!");
return false; return false;
} }
} }
@@ -228,14 +228,14 @@ function vehicleLockCommand(command, params, client) {
function vehicleLightsCommand(command, params, client) { function vehicleLightsCommand(command, params, client) {
if(!getPlayerVehicle(client)) { if(!getPlayerVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
let vehicle = getPlayerVehicle(client); let vehicle = getPlayerVehicle(client);
if(getPlayerVehicleSeat(client) > 1) { if(getPlayerVehicleSeat(client) > 1) {
messageClientError(client, "You need to be in the front seat!"); messagePlayerError(client, "You need to be in the front seat!");
return false; return false;
} }
@@ -250,7 +250,7 @@ function vehicleLightsCommand(command, params, client) {
function deleteVehicleCommand(command, params, client) { function deleteVehicleCommand(command, params, client) {
if(!getPlayerVehicle(client)) { if(!getPlayerVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
@@ -261,26 +261,26 @@ function deleteVehicleCommand(command, params, client) {
getServerData().vehicles[dataIndex] = null; getServerData().vehicles[dataIndex] = null;
destroyElement(vehicle); destroyElement(vehicle);
messageClientSuccess(client, `The ${vehicleName} has been deleted!`); messagePlayerSuccess(client, `The ${vehicleName} has been deleted!`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function vehicleEngineCommand(command, params, client) { function vehicleEngineCommand(command, params, client) {
if(!getPlayerVehicle(client)) { if(!getPlayerVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
if(getPlayerVehicleSeat(client) > 0) { if(getPlayerVehicleSeat(client) > 0) {
messageClientError(client, "You need to be the driver!"); messagePlayerError(client, "You need to be the driver!");
return false; return false;
} }
let vehicle = getPlayerVehicle(client); let vehicle = getPlayerVehicle(client);
if(!doesClientHaveVehicleKeys(client, vehicle)) { if(!doesClientHaveVehicleKeys(client, vehicle)) {
messageClientError(client, "You don't have keys to this vehicle!"); messagePlayerError(client, "You don't have keys to this vehicle!");
return false; return false;
} }
@@ -295,19 +295,19 @@ function vehicleEngineCommand(command, params, client) {
function vehicleSirenCommand(command, params, client) { function vehicleSirenCommand(command, params, client) {
if(!getPlayerVehicle(client)) { if(!getPlayerVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
if(getPlayerVehicleSeat(client) > 1) { if(getPlayerVehicleSeat(client) > 1) {
messageClientError(client, "You need to be in the front seat!"); messagePlayerError(client, "You need to be in the front seat!");
return false; return false;
} }
let vehicle = getPlayerVehicle(client); let vehicle = getPlayerVehicle(client);
if(!doesClientHaveVehicleKeys(client, vehicle)) { if(!doesClientHaveVehicleKeys(client, vehicle)) {
messageClientError(client, "You don't have keys to this vehicle!"); messagePlayerError(client, "You don't have keys to this vehicle!");
return false; return false;
} }
@@ -321,21 +321,21 @@ function vehicleSirenCommand(command, params, client) {
function setVehicleColourCommand(command, params, client) { function setVehicleColourCommand(command, params, client) {
if(!getPlayerVehicle(client)) { if(!getPlayerVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
let vehicle = getPlayerVehicle(client); let vehicle = getPlayerVehicle(client);
if(!isAtPayAndSpray(getVehiclePosition(vehicle))) { if(!isAtPayAndSpray(getVehiclePosition(vehicle))) {
if(!doesClientHaveStaffPermission(client, getStaffFlagValue("manageVehicles"))) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("manageVehicles"))) {
messageClientError(client, "You need to be at a pay-n-spray!"); messagePlayerError(client, "You need to be at a pay-n-spray!");
return false; return false;
} }
} }
if(getClientCurrentSubAccount(client).cash < getGlobalConfig().resprayVehicleCost) { if(getPlayerCurrentSubAccount(client).cash < getGlobalConfig().resprayVehicleCost) {
messageClientError(client, `You don't have enough money to respray the vehicle (need $${getGlobalConfig().resprayVehicleCost-getClientCurrentSubAccount(client).cash} more!)`); messagePlayerError(client, `You don't have enough money to respray the vehicle (need $${getGlobalConfig().resprayVehicleCost-getPlayerCurrentSubAccount(client).cash} more!)`);
return false; return false;
} }
@@ -343,7 +343,7 @@ function setVehicleColourCommand(command, params, client) {
let colour1 = toInteger(splitParams[0]) || 0; let colour1 = toInteger(splitParams[0]) || 0;
let colour2 = toInteger(splitParams[1]) || 0; let colour2 = toInteger(splitParams[1]) || 0;
getClientCurrentSubAccount(client).cash -= getGlobalConfig().resprayVehicleCost; getPlayerCurrentSubAccount(client).cash -= getGlobalConfig().resprayVehicleCost;
updatePlayerCash(client); updatePlayerCash(client);
vehicle.colour1 = colour1; vehicle.colour1 = colour1;
vehicle.colour2 = colour2; vehicle.colour2 = colour2;
@@ -357,26 +357,26 @@ function setVehicleColourCommand(command, params, client) {
function vehicleRepairCommand(command, params, client) { function vehicleRepairCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
let vehicle = getPlayerVehicle(client); let vehicle = getPlayerVehicle(client);
if(!isAtPayAndSpray(getVehiclePosition(vehicle))) { if(!isAtPayAndSpray(getVehiclePosition(vehicle))) {
if(!doesClientHaveStaffPermission(client, getStaffFlagValue("manageVehicles"))) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("manageVehicles"))) {
messageClientError(client, "You need to be at a pay-n-spray!"); messagePlayerError(client, "You need to be at a pay-n-spray!");
return false; return false;
} }
} }
if(getClientCurrentSubAccount(client).cash < getGlobalConfig().repairVehicleCost) { if(getPlayerCurrentSubAccount(client).cash < getGlobalConfig().repairVehicleCost) {
messageClientError(client, `You don't have enough money to repair the vehicle (need $${getGlobalConfig().resprayVehicleCost-getClientCurrentSubAccount(client).cash} more!)`); messagePlayerError(client, `You don't have enough money to repair the vehicle (need $${getGlobalConfig().resprayVehicleCost-getPlayerCurrentSubAccount(client).cash} more!)`);
return false; return false;
} }
getClientCurrentSubAccount(client).cash -= getGlobalConfig().repairVehicleCost; getPlayerCurrentSubAccount(client).cash -= getGlobalConfig().repairVehicleCost;
repairVehicle(vehicle); repairVehicle(vehicle);
meActionToNearbyPlayers(client, `repairs the ${getVehicleName(vehicle)}!`); meActionToNearbyPlayers(client, `repairs the ${getVehicleName(vehicle)}!`);
@@ -386,55 +386,55 @@ function vehicleRepairCommand(command, params, client) {
function buyVehicleCommand(command, params, client) { function buyVehicleCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
let vehicle = getPlayerVehicle(client); let vehicle = getPlayerVehicle(client);
if(getVehicleData(vehicle).buyPrice <= 0) { if(getVehicleData(vehicle).buyPrice <= 0) {
messageClientError(client, `This ${getVehicleName(vehicle)} is not for sale!`); messagePlayerError(client, `This ${getVehicleName(vehicle)} is not for sale!`);
return false; return false;
} }
if(getClientCurrentSubAccount(client).cash < getVehicleData(vehicle).buyPrice) { if(getPlayerCurrentSubAccount(client).cash < getVehicleData(vehicle).buyPrice) {
messageClientError(client, `You don't have enough money to buy this vehicle (need $${getVehicleData(vehicle).buyPrice-getClientCurrentSubAccount(client).cash} more!)`); messagePlayerError(client, `You don't have enough money to buy this vehicle (need $${getVehicleData(vehicle).buyPrice-getPlayerCurrentSubAccount(client).cash} more!)`);
return false; return false;
} }
getPlayerData(client).buyingVehicle = vehicle; getPlayerData(client).buyingVehicle = vehicle;
//getClientCurrentSubAccount(client).cash -= getVehicleData(vehicle).buyPrice; //getPlayerCurrentSubAccount(client).cash -= getVehicleData(vehicle).buyPrice;
//getVehicleData(vehicle).buyPrice = 0; //getVehicleData(vehicle).buyPrice = 0;
//getVehicleData(vehicle).rentPrice = 0; //getVehicleData(vehicle).rentPrice = 0;
getVehicleData(vehicle).engine = true; getVehicleData(vehicle).engine = true;
vehicle.engine = true; vehicle.engine = true;
meActionToNearbyPlayers(client, `receives a set of keys to test drive the ${getVehicleName(vehicle)} and starts the engine`); meActionToNearbyPlayers(client, `receives a set of keys to test drive the ${getVehicleName(vehicle)} and starts the engine`);
messageClientInfo(client, `Drive the vehicle away from the dealership to buy it, or get out to cancel.`); messagePlayerInfo(client, `Drive the vehicle away from the dealership to buy it, or get out to cancel.`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function rentVehicleCommand(command, params, client) { function rentVehicleCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
let vehicle = getPlayerVehicle(client); let vehicle = getPlayerVehicle(client);
if(getVehicleData(vehicle).rentPrice <= 0) { if(getVehicleData(vehicle).rentPrice <= 0) {
messageClientError(client, `This ${getVehicleName(vehicle)} is not for rent!`); messagePlayerError(client, `This ${getVehicleName(vehicle)} is not for rent!`);
return false; return false;
} }
getVehicleData(vehicle).rentedBy = client; getVehicleData(vehicle).rentedBy = client;
getClientCurrentSubAccount(client).rentingVehicle = vehicle; getPlayerCurrentSubAccount(client).rentingVehicle = vehicle;
getVehicleData(vehicle).rentStart = new Date().getTime(); getVehicleData(vehicle).rentStart = new Date().getTime();
meActionToNearbyPlayers(client, `rents the ${getVehicleName(vehicle)} and receives a set of vehicle keys!`); meActionToNearbyPlayers(client, `rents the ${getVehicleName(vehicle)} and receives a set of vehicle keys!`);
messageClientAlert(client, `You will be charged ${getVehicleData(vehicle).rentPrice} per minute to use this vehicle. To stop renting this vehicle, use /vehrent again.`); messagePlayerAlert(client, `You will be charged ${getVehicleData(vehicle).rentPrice} per minute to use this vehicle. To stop renting this vehicle, use /vehrent again.`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -446,11 +446,11 @@ function enterVehicleAsPassengerCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function stopRentingVehicleCommand(command, params, client) { function stopRentingVehicleCommand(command, params, client) {
//getClientCurrentSubAccount(client).cash -= getVehicleData(vehicle).rentPrice; //getPlayerCurrentSubAccount(client).cash -= getVehicleData(vehicle).rentPrice;
let vehicle = getClientCurrentSubAccount(client).rentingVehicle; let vehicle = getPlayerCurrentSubAccount(client).rentingVehicle;
stopRentingVehicle(client); stopRentingVehicle(client);
messageClientAlert(client, `You are no longer renting the ${getVehicleName(vehicle)}`); messagePlayerAlert(client, `You are no longer renting the ${getVehicleName(vehicle)}`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -458,7 +458,7 @@ function stopRentingVehicleCommand(command, params, client) {
function doesClientHaveVehicleKeys(client, vehicle) { function doesClientHaveVehicleKeys(client, vehicle) {
let vehicleData = getVehicleData(vehicle); let vehicleData = getVehicleData(vehicle);
if(doesClientHaveStaffPermission(client, getStaffFlagValue("manageVehicles"))) { if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("manageVehicles"))) {
return true; return true;
} }
@@ -473,23 +473,23 @@ function doesClientHaveVehicleKeys(client, vehicle) {
} }
if(vehicleData.ownerType == AG_VEHOWNER_CLAN) { if(vehicleData.ownerType == AG_VEHOWNER_CLAN) {
if(vehicleData.ownerId == getClientCurrentSubAccount(client).clan) { if(vehicleData.ownerId == getPlayerCurrentSubAccount(client).clan) {
if(vehicleData.clanRank <= getClientCurrentSubAccount(client).clanRank) { if(vehicleData.clanRank <= getPlayerCurrentSubAccount(client).clanRank) {
return true; return true;
} }
} }
} }
if(vehicleData.ownerType == AG_VEHOWNER_FACTION) { if(vehicleData.ownerType == AG_VEHOWNER_FACTION) {
if(vehicleData.ownerId == getClientCurrentSubAccount(client).faction) { if(vehicleData.ownerId == getPlayerCurrentSubAccount(client).faction) {
if(vehicleData.factionRank <= getClientCurrentSubAccount(client).factionRank) { if(vehicleData.factionRank <= getPlayerCurrentSubAccount(client).factionRank) {
return true; return true;
} }
} }
} }
if(vehicleData.ownerType == AG_VEHOWNER_JOB) { if(vehicleData.ownerType == AG_VEHOWNER_JOB) {
if(getJobType(vehicleData.ownerId) == getJobType(getClientCurrentSubAccount(client).job)) { if(getJobType(vehicleData.ownerId) == getJobType(getPlayerCurrentSubAccount(client).job)) {
return true; return true;
} }
} }
@@ -502,7 +502,7 @@ function doesClientHaveVehicleKeys(client, vehicle) {
function doesClientOwnVehicle(client, vehicle) { function doesClientOwnVehicle(client, vehicle) {
let vehicleData = getVehicleData(vehicle); let vehicleData = getVehicleData(vehicle);
if(doesClientHaveStaffPermission(client, getStaffFlagValue("manageVehicles"))) { if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("manageVehicles"))) {
return true; return true;
} }
@@ -513,7 +513,7 @@ function doesClientOwnVehicle(client, vehicle) {
} }
if(vehicleData.ownerType == AG_VEHOWNER_CLAN) { if(vehicleData.ownerType == AG_VEHOWNER_CLAN) {
if(vehicleData.ownerId == getClientCurrentSubAccount(client).clan) { if(vehicleData.ownerId == getPlayerCurrentSubAccount(client).clan) {
if(doesClientHaveClanPermission(client, "manageVehicles") || doesClientHaveClanPermission(client, "owner")) { if(doesClientHaveClanPermission(client, "manageVehicles") || doesClientHaveClanPermission(client, "owner")) {
return true; return true;
} }
@@ -533,7 +533,7 @@ function getVehicleName(vehicle) {
function setVehicleJobCommand(command, params, client) { function setVehicleJobCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
@@ -547,8 +547,8 @@ function setVehicleJobCommand(command, params, client) {
} }
//if(!jobId) { //if(!jobId) {
// messageClientError(client, "That job is invalid!"); // messagePlayerError(client, "That job is invalid!");
// messageClientInfo(client, "Please specify a job ID or leave it out to get the closest job."); // messagePlayerInfo(client, "Please specify a job ID or leave it out to get the closest job.");
// return false; // return false;
//} //}
@@ -562,7 +562,7 @@ function setVehicleJobCommand(command, params, client) {
function setVehicleClanCommand(command, params, client) { function setVehicleClanCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
@@ -570,7 +570,7 @@ function setVehicleClanCommand(command, params, client) {
let clanId = getClanFromParams(params); let clanId = getClanFromParams(params);
if(!getClanData(clanId)) { if(!getClanData(clanId)) {
messageClientError(client, "That clan is invalid or doesn't exist!"); messagePlayerError(client, "That clan is invalid or doesn't exist!");
return false; return false;
} }
@@ -584,7 +584,7 @@ function setVehicleClanCommand(command, params, client) {
function setVehicleToDealershipCommand(command, params, client) { function setVehicleToDealershipCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
@@ -601,7 +601,7 @@ function setVehicleToDealershipCommand(command, params, client) {
function setVehicleOwnerCommand(command, params, client) { function setVehicleOwnerCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
@@ -609,12 +609,12 @@ function setVehicleOwnerCommand(command, params, client) {
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is invalid or isn't connected!"); messagePlayerError(client, "That player is invalid or isn't connected!");
return false; return false;
} }
getVehicleData(vehicle).ownerType = AG_VEHOWNER_PLAYER; getVehicleData(vehicle).ownerType = AG_VEHOWNER_PLAYER;
getVehicleData(vehicle).ownerId = getClientCurrentSubAccount(client).databaseId; getVehicleData(vehicle).ownerId = getPlayerCurrentSubAccount(client).databaseId;
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set their [#AAAAAA]${getVehicleName(vehicle)} [#FFFFFF]owner to [#AAAAAA]${getClientSubAccountName(client)}`); messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set their [#AAAAAA]${getVehicleName(vehicle)} [#FFFFFF]owner to [#AAAAAA]${getClientSubAccountName(client)}`);
} }
@@ -623,15 +623,15 @@ function setVehicleOwnerCommand(command, params, client) {
function setVehicleRentPriceCommand(command, params, client) { function setVehicleRentPriceCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
let vehicle = getPlayerVehicle(client); let vehicle = getPlayerVehicle(client);
if(!doesClientOwnVehicle(client, vehicle)) { if(!doesClientOwnVehicle(client, vehicle)) {
if(!doesClientHaveStaffPermission(client, getStaffFlagValue("manageVehicles"))) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("manageVehicles"))) {
messageClientError(client, "You can't set the rent price for this vehicle!"); messagePlayerError(client, "You can't set the rent price for this vehicle!");
} }
} }
@@ -646,15 +646,15 @@ function setVehicleRentPriceCommand(command, params, client) {
function setVehicleBuyPriceCommand(command, params, client) { function setVehicleBuyPriceCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
let vehicle = getPlayerVehicle(client); let vehicle = getPlayerVehicle(client);
if(!doesClientOwnVehicle(client, vehicle)) { if(!doesClientOwnVehicle(client, vehicle)) {
if(!doesClientHaveStaffPermission(client, getStaffFlagValue("manageVehicles"))) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("manageVehicles"))) {
messageClientError(client, "You can't set the buy price for this vehicle!"); messagePlayerError(client, "You can't set the buy price for this vehicle!");
} }
} }
@@ -669,7 +669,7 @@ function setVehicleBuyPriceCommand(command, params, client) {
function removeVehicleOwnerCommand(command, params, client) { function removeVehicleOwnerCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
@@ -677,7 +677,7 @@ function removeVehicleOwnerCommand(command, params, client) {
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messageClientError(client, "That player is invalid or isn't connected!"); messagePlayerError(client, "That player is invalid or isn't connected!");
return false; return false;
} }
@@ -685,21 +685,21 @@ function removeVehicleOwnerCommand(command, params, client) {
getVehicleData(vehicle).ownerId = 0; getVehicleData(vehicle).ownerId = 0;
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set their [#AAAAAA]${getVehicleName(vehicle)} [#FFFFFF]owner to nobody!`); messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set their [#AAAAAA]${getVehicleName(vehicle)} [#FFFFFF]owner to nobody!`);
messageClientInfo(client, `Nobody will be able to use this vehicle until it receives a new owner (either bought or set by admin).`); messagePlayerInfo(client, `Nobody will be able to use this vehicle until it receives a new owner (either bought or set by admin).`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function getVehicleInfoCommand(command, params, client) { function getVehicleInfoCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }
let vehicle = getPlayerVehicle(client); let vehicle = getPlayerVehicle(client);
if(!getVehicleData(vehicle)) { if(!getVehicleData(vehicle)) {
messageClientError(client, "This is a random traffic vehicle and doesn't have any info"); messagePlayerError(client, "This is a random traffic vehicle and doesn't have any info");
return false; return false;
} }
@@ -734,14 +734,14 @@ function getVehicleInfoCommand(command, params, client) {
break; break;
} }
messageClientNormal(client, `🚗 [#CC22CC][Vehicle Info] [#FFFFFF]ID: [#AAAAAA]${vehicle.id}, [#FFFFFF]DatabaseID: [#AAAAAA]${vehicleData.databaseId}, [#FFFFFF]Owner: [#AAAAAA]${ownerName}[ID ${vehicleData.ownerId}] (${ownerType}), [#FFFFFF]Type: [#AAAAAA]${getVehicleName(vehicle)}[${vehicle.modelIndex}], [#FFFFFF]BuyPrice: [#AAAAAA]${vehicleData.buyPrice}, [#FFFFFF]RentPrice: [#AAAAAA]${vehicleData.rentPrice}`); messagePlayerNormal(client, `🚗 [#CC22CC][Vehicle Info] [#FFFFFF]ID: [#AAAAAA]${vehicle.id}, [#FFFFFF]DatabaseID: [#AAAAAA]${vehicleData.databaseId}, [#FFFFFF]Owner: [#AAAAAA]${ownerName}[ID ${vehicleData.ownerId}] (${ownerType}), [#FFFFFF]Type: [#AAAAAA]${getVehicleName(vehicle)}[${vehicle.modelIndex}], [#FFFFFF]BuyPrice: [#AAAAAA]${vehicleData.buyPrice}, [#FFFFFF]RentPrice: [#AAAAAA]${vehicleData.rentPrice}`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function toggleVehicleSpawnLockCommand(command, params, client) { function toggleVehicleSpawnLockCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messageClientError(client, "You need to be in a vehicle!"); messagePlayerError(client, "You need to be in a vehicle!");
return false; return false;
} }

View File

@@ -105,4 +105,10 @@ function getDistance(vec1, vec2) {
return vec1.distance(vec2); return vec1.distance(vec2);
} }
// ---------------------------------------------------------------------------
function isConsole(client) {
return client.console;
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------