Lots of stuff

This commit is contained in:
Vortrex
2020-12-11 01:51:55 -06:00
parent ecc495de5c
commit fbaafa6c0c
67 changed files with 5755 additions and 4208 deletions

View File

@@ -31,143 +31,6 @@ function addMiscCommandHandlers() {
// ---------------------------------------------------------------------------
function setTimeCommand(command, params, client) {
if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) {
messageClientError(client, "You must be logged in to use this command!");
return false;
}
}
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
messageClientError(client, "You do not have permission to use this command!");
return false;
}
if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command));
return false;
}
let splitParams = params.split();
let hour = Number(splitParams[0]) || 0;
let minute = Number(splitParams[1]) || 0;
if(hour > 23 || hour < 0) {
messageClientError(client, "The hour must be between 0 and 23!");
return false;
}
if(minute > 59 || minute < 0) {
messageClientError(client, "The minute must be between 0 and 59!");
return false;
}
gta.time.hour = hour;
gta.time.minute = minute;
messageAdminAction(`${client.name} set the time to ${makeReadableTime(hour, minute)}`);
return true;
}
// ---------------------------------------------------------------------------
function setWeatherCommand(command, params, client) {
if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) {
messageClientError(client, "You must be logged in to use this command!");
return false;
}
}
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
messageClientError(client, "You do not have permission to use this command!");
return false;
}
if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command));
return false;
}
let splitParams = params.split();
let weatherId = getWeatherFromParams(splitParams[0]);
if(!weatherId) {
messageClientError(client, `That weather ID or name is invalid!`);
return false;
}
gta.forceWeather(weatherId);
messageAdminAction(`${client.name} set the weather to to ${weatherNames[server.game][weatherId]}`);
updateServerRules();
return true;
}
// ---------------------------------------------------------------------------
function setSnowingCommand(command, params, client) {
if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) {
messageClientError(client, "You must be logged in to use this command!");
return false;
}
}
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
messageClientError(client, "You do not have permission to use this command!");
return false;
}
if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command));
return false;
}
let splitParams = params.split();
let fallingSnow = Number(splitParams[0]) || 0;
let groundSnow = Number(splitParams[1]) || 0;
serverConfig.fallingSnow = 0;
messageAdminAction(`${client.name} turned falling snow ${getOnOffFromBool(intToBool(fallingSnow))} and ground snow ${getOnOffFromBool(intToBool(groundSnow))}`);
updateServerRules();
return true;
}
// ---------------------------------------------------------------------------
function toggleServerLogoCommand(command, params, client) {
if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) {
messageClientError(client, "You must be logged in to use this command!");
return false;
}
}
if(!doesClientHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
messageClientError(client, "You do not have permission to use this command!");
return false;
}
if(areParamsEmpty(params)) {
messageClientSyntax(client, getCommandSyntaxText(command));
return false;
}
let splitParams = params.split();
let logoState = Number(params) || 1;
serverConfig.useLogo = !!logoState;
messageAdminAction(`${client.name} turned the server logo image ${getOnOffFromBool(!!logoState).toLowerCase()}`);
updateServerRules();
return true;
}
// ---------------------------------------------------------------------------
function getPositionCommand(command, params, client) {
if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) {
@@ -204,8 +67,8 @@ function setNewCharacterSpawnPositionCommand(command, params, client) {
}
let position = client.player.position;
serverConfig.newCharacter.spawnPosition = position;
serverConfig.newCharacter.spawnHeading = client.player.heading;
getServerConfig().newCharacter.spawnPosition = position;
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)}`)
return true;
@@ -232,9 +95,9 @@ function setNewCharacterMoneyCommand(command, params, client) {
}
let splitParams = params.split();
let amount = Number(splitParams[0]) || 1000;
let amount = toInteger(splitParams[0]) || 1000;
serverConfig.newCharacter.cash = skinId;
getServerConfig().newCharacter.cash = skinId;
messageClientNormal(client, `The new character money has been set to $${amount}`);
return true;
@@ -262,7 +125,7 @@ function setNewCharacterSkinCommand(command, params, client) {
skinId = getSkinFromParams(params);
}
serverConfig.newCharacter.skin = skinId;
getServerConfig().newCharacter.skin = skinId;
messageClientNormal(client, `The new character skin has been set to ${getSkinNameFromId(skinId)} (ID ${skinId})`);
return true;
@@ -291,7 +154,7 @@ function submitIdeaCommand(command, params, client) {
// ---------------------------------------------------------------------------
function submitBugCommand(command, params, client) {
function submitBugReportCommand(command, params, client) {
if(getCommand(command).requireLogin) {
if(!isClientLoggedIn(client)) {
messageClientError(client, "You must be logged in to use this command!");