Mass commit

This commit is contained in:
Vortrex
2021-01-01 16:18:59 -06:00
parent a9dad59b27
commit 5af3023c85
45 changed files with 1648 additions and 1599 deletions

View File

@@ -28,7 +28,7 @@ addEventHandler("OnFocus", function(event) {
if(gta.game != GAME_GTA_SA) { if(gta.game != GAME_GTA_SA) {
gta.setCiviliansEnabled(true); gta.setCiviliansEnabled(true);
} }
gta.setTrafficEnabled(true); gta.setTrafficEnabled(true);
} }
}); });

File diff suppressed because it is too large Load Diff

View File

@@ -45,11 +45,11 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price)
if(propertyLabelNameFont == null) { if(propertyLabelNameFont == null) {
return false; return false;
} }
if(propertyLabelLockedFont == null) { if(propertyLabelLockedFont == null) {
return false; return false;
} }
if(localPlayer.position.distance(position) > 7.5) { if(localPlayer.position.distance(position) > 7.5) {
return false; return false;
} }
@@ -62,9 +62,9 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price)
if(price > 0) { if(price > 0) {
text = `For sale: $${price}`; text = `For sale: $${price}`;
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true); let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(0, 150, 0, 255), false, true, false, true); propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(0, 150, 0, 255), false, true, false, true);
screenPosition.y -= 18; screenPosition.y -= 18;
} }
text = (locked) ? "LOCKED" : "UNLOCKED"; text = (locked) ? "LOCKED" : "UNLOCKED";
@@ -73,13 +73,13 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price)
} }
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true); let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, (locked) ? lockedColour : unlockedColour, false, true, false, true); propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, (locked) ? lockedColour : unlockedColour, false, true, false, true);
screenPosition.y -= 22; screenPosition.y -= 22;
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, (isBusiness) ? toColour(0, 153, 255, 255) : toColour(17, 204, 17, 255), 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);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -92,11 +92,11 @@ function renderPropertyExitLabel(position) {
if(propertyLabelNameFont == null) { if(propertyLabelNameFont == null) {
return false; return false;
} }
if(propertyLabelLockedFont == null) { if(propertyLabelLockedFont == null) {
return false; return false;
} }
if(localPlayer.position.distance(position) > 7.5) { if(localPlayer.position.distance(position) > 7.5) {
return false; return false;
} }
@@ -107,7 +107,7 @@ function renderPropertyExitLabel(position) {
let text = "EXIT"; let text = "EXIT";
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, COLOUR_WHITE, false, true, false, true);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -120,11 +120,11 @@ function renderJobLabel(name, position, jobType) {
if(jobNameLabelFont == null) { if(jobNameLabelFont == null) {
return false; return false;
} }
if(jobHelpLabelFont == null) { if(jobHelpLabelFont == null) {
return false; return false;
} }
if(localPlayer.position.distance(position) > 7.5) { if(localPlayer.position.distance(position) > 7.5) {
return false; return false;
} }
@@ -149,13 +149,13 @@ function renderJobLabel(name, position, jobType) {
} }
let size = jobHelpLabelFont.measure(text, game.width, 0.0, 0.0, jobHelpLabelFont.size, true, true); let size = jobHelpLabelFont.measure(text, game.width, 0.0, 0.0, jobHelpLabelFont.size, true, true);
jobHelpLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobHelpLabelFont.size, COLOUR_YELLOW, false, true, false, true); jobHelpLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobHelpLabelFont.size, COLOUR_YELLOW, false, true, false, true);
screenPosition.y -= 18; screenPosition.y -= 18;
text = name + " Job"; text = name + " Job";
size = jobNameLabelFont.measure(text, game.width, 0.0, 0.0, jobNameLabelFont.size, true, true); size = jobNameLabelFont.measure(text, game.width, 0.0, 0.0, jobNameLabelFont.size, true, true);
jobNameLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobNameLabelFont.size, COLOUR_WHITE, false, true, false, true); jobNameLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobNameLabelFont.size, COLOUR_WHITE, false, true, false, true);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -182,14 +182,14 @@ addEventHandler("OnDrawnHUD", function (event) {
case AG_LABEL_HOUSE: case AG_LABEL_HOUSE:
renderPropertyEntranceLabel(pickups[i].getData("ag.label.name"), pickups[i].position, pickups[i].getData("ag.label.locked"), false, price); renderPropertyEntranceLabel(pickups[i].getData("ag.label.name"), pickups[i].position, pickups[i].getData("ag.label.locked"), false, price);
break; break;
case AG_LABEL_JOB: case AG_LABEL_JOB:
renderJobLabel(pickups[i].getData("ag.label.name"), pickups[i].position, pickups[i].getData("ag.label.jobType")); renderJobLabel(pickups[i].getData("ag.label.name"), pickups[i].position, pickups[i].getData("ag.label.jobType"));
break; break;
case AG_LABEL_EXIT: case AG_LABEL_EXIT:
renderPropertyExitLabel(pickups[i].position); renderPropertyExitLabel(pickups[i].position);
break; break;
} }
//} //}
//} //}

View File

@@ -72,6 +72,9 @@ bindEventHandler("onResourceStart", thisResource, function(event, resource) {
gta.setCiviliansEnabled(false); gta.setCiviliansEnabled(false);
} }
// Run garbage collector every minute
garbageCollectorInterval = setInterval(collectAllGarbage, 1000*60);
addNetworkHandler("ag.passenger", enterVehicleAsPassenger); addNetworkHandler("ag.passenger", enterVehicleAsPassenger);
}); });
@@ -338,6 +341,12 @@ function processEvent(event, deltaTime) {
} }
}); });
getElementsByType(ELEMENT_PICKUP).forEach(function(pickup) {
if(pickup.owner != -1) {
destroyElement(pickup);
}
});
if(gta.game == GAME_GTA_SA) { if(gta.game == GAME_GTA_SA) {
if(jobRouteStopSphere != null) { if(jobRouteStopSphere != null) {
if(position.distance(jobRouteStopSphere.position) <= 2.0) { if(position.distance(jobRouteStopSphere.position) <= 2.0) {
@@ -381,10 +390,12 @@ addEventHandler("OnDrawnHUD", function (event) {
} }
// Draw logo in corner of screen // Draw logo in corner of screen
if(mainLogo != null && showLogo) { if(mainLogo != null) {
let logoPos = toVector2(gta.width-132, gta.height-132); if(showLogo) {
let logoSize = toVector2(128, 128); let logoPos = toVector2(gta.width-132, gta.height-132);
drawing.drawRectangle(mainLogo, logoPos, logoSize); let logoSize = toVector2(128, 128);
drawing.drawRectangle(mainLogo, logoPos, logoSize);
}
} }
}); });
@@ -482,9 +493,7 @@ addNetworkHandler("ag.showBusStop", function(position, colour) {
jobRouteStopSphere.colour = colour; jobRouteStopSphere.colour = colour;
} }
jobRouteStopBlip = gta.createBlip(position, 0, 2, colour); jobRouteStopBlip = gta.createBlip(position, 0, 2, colour);
}); });
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -429,14 +429,14 @@ addEventHandler("OnProcess", (event, deltaTime) =>
if(!localPlayer) { if(!localPlayer) {
return false; return false;
} }
if(gta.game >= GAME_GTA_SA) { if(gta.game >= GAME_GTA_SA) {
// We don't need this for GTA SA+ // We don't need this for GTA SA+
return false; return false;
} }
/* /*
if(localPlayer.vehicle == null) { if(localPlayer.vehicle == null) {
let newAngle = 0.0; let newAngle = 0.0;
let moveKeyHeld = false; let moveKeyHeld = false;
if(isKeyDown(SDLK_w)) { if(isKeyDown(SDLK_w)) {
@@ -462,15 +462,15 @@ addEventHandler("OnProcess", (event, deltaTime) =>
newAngle = Math.PI/2; newAngle = Math.PI/2;
moveKeyHeld = true; moveKeyHeld = true;
} }
if(moveKeyHeld && !gui.cursorEnabled) { if(moveKeyHeld && !gui.cursorEnabled) {
localPlayer.heading = cameraAngle + newAngle; localPlayer.heading = cameraAngle + newAngle;
} }
if(sdl.getModState()&KMOD_ALT && !gui.cursorEnabled) { if(sdl.getModState()&KMOD_ALT && !gui.cursorEnabled) {
if(moveKeyHeld) { if(moveKeyHeld) {
let position = getPosInFrontOfPos(localPlayer.position, localPlayer.heading, 1.0); let position = getPosInFrontOfPos(localPlayer.position, localPlayer.heading, 1.0);
localPlayer.walkTo(vec3ToVec2(position)); localPlayer.walkTo(vec3ToVec2(position));
isWalking = true; isWalking = true;
triggerNetworkEvent("ag.walk", true); triggerNetworkEvent("ag.walk", true);
} else { } else {
@@ -479,7 +479,7 @@ addEventHandler("OnProcess", (event, deltaTime) =>
} }
} else { } else {
isWalking = false; isWalking = false;
triggerNetworkEvent("ag.walk", false); triggerNetworkEvent("ag.walk", false);
} }
} }
*/ */
@@ -490,7 +490,7 @@ let IdleTime = 0;//2019 Lucas was here!
function processReturnToRestRotation() function processReturnToRestRotation()
{ {
//resetCameraRotation();//2019 Lucas was here! //resetCameraRotation();//2019 Lucas was here!
//2019 Lucas was here! //2019 Lucas was here!
let Target = getCameraTarget(); let Target = getCameraTarget();
if (!ShouldReturnToRestRotation(Target)) if (!ShouldReturnToRestRotation(Target))
@@ -652,7 +652,7 @@ function update()
positionX += normalX*Distance; positionX += normalX*Distance;
positionY += normalY*Distance; positionY += normalY*Distance;
positionZ += normalZ*Distance; positionZ += normalZ*Distance;
cameraMatrix.m41 = positionX; cameraMatrix.m41 = positionX;
cameraMatrix.m42 = positionY; cameraMatrix.m42 = positionY;
cameraMatrix.m43 = positionZ; cameraMatrix.m43 = positionZ;
@@ -680,7 +680,7 @@ function getPosInFrontOfPos(pos, angle, distance) {
let x = (pos.x+((Math.cos(angle+(Math.PI/2)))*distance)); let x = (pos.x+((Math.cos(angle+(Math.PI/2)))*distance));
let y = (pos.y+((Math.sin(angle+(Math.PI/2)))*distance)); let y = (pos.y+((Math.sin(angle+(Math.PI/2)))*distance));
let z = pos.z; let z = pos.z;
return new Vec3(x,y,z); return new Vec3(x,y,z);
} }

View File

@@ -50,16 +50,16 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
if(nametagFont == null) { if(nametagFont == null) {
return false; return false;
} }
alpha *= 0.75; alpha *= 0.75;
let width = nametagWidth; let width = nametagWidth;
health = Math.max(0.0, Math.min(1.0, health)); health = Math.max(0.0, Math.min(1.0, health));
armour = Math.max(0.0, Math.min(1.0, armour)); armour = Math.max(0.0, Math.min(1.0, armour));
// Starts at bottom and works it's way up // Starts at bottom and works it's way up
// ------------------------------------------- // -------------------------------------------
// Health Bar // Health Bar
if(gta.game == GAME_GTA_III) { if(gta.game == GAME_GTA_III) {
// Mickey Hamfists is ridiculously tall. Raise the nametag for him a bit // Mickey Hamfists is ridiculously tall. Raise the nametag for him a bit
if(skin == 109) { if(skin == 109) {
@@ -70,7 +70,7 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
} else { } else {
y -= 5; y -= 5;
} }
if(health > 0.0) { if(health > 0.0) {
let hx = x-width/2; let hx = x-width/2;
let hy = y-10/2; let hy = y-10/2;
@@ -79,12 +79,12 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
let colour = createColour(Math.floor(255.0*alpha), Math.floor(255.0-(health*255.0)), Math.floor(health*255.0), 0); // Health bar colour (varies, depending on health) let colour = createColour(Math.floor(255.0*alpha), Math.floor(255.0-(health*255.0)), Math.floor(health*255.0), 0); // Health bar colour (varies, depending on health)
drawing.drawRectangle(null, [hx+2, hy+2], [(width-4)*health, 10-6], colour, colour, colour, colour); drawing.drawRectangle(null, [hx+2, hy+2], [(width-4)*health, 10-6], colour, colour, colour, colour);
} }
// Armour Bar // Armour Bar
if (armour > 0.0) if (armour > 0.0)
{ {
// Go up 10 pixels to draw the next part // Go up 10 pixels to draw the next part
y -= 10; y -= 10;
let hx = x-width/2; let hx = x-width/2;
let hy = y-10/2; let hy = y-10/2;
let colourB = toColour(255, 0, 0, 0); // Background colour (black) let colourB = toColour(255, 0, 0, 0); // Background colour (black)
@@ -92,18 +92,18 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
let colour = toColour(255, 255, 255, 255); // Armour bar colour (white) let colour = toColour(255, 255, 255, 255); // Armour bar colour (white)
drawing.drawRectangle(null, [hx+2, hy+2], [(width-4)*armour, 10-6], colour, colour, colour, colour); drawing.drawRectangle(null, [hx+2, hy+2], [(width-4)*armour, 10-6], colour, colour, colour, colour);
} }
y -= 20; y -= 20;
// Nametag // Nametag
if(nametagFont != null) { if(nametagFont != null) {
let size = nametagFont.measure(text, game.width, 0.0, 0.0, nametagFont.size, false, false); let size = nametagFont.measure(text, game.width, 0.0, 0.0, nametagFont.size, false, false);
nametagFont.render(text, [x-size[0]/2, y-size[1]/2], game.width, 0.0, 0.0, nametagFont.size, colour, false, false, false, true); nametagFont.render(text, [x-size[0]/2, y-size[1]/2], game.width, 0.0, 0.0, nametagFont.size, colour, false, false, false, true);
} }
// Go up another 10 pixels for the next part // Go up another 10 pixels for the next part
y -= 20; y -= 20;
// AFK Status // AFK Status
if(afkStatusFont != null) { if(afkStatusFont != null) {
if(afk) { if(afk) {
@@ -119,34 +119,34 @@ function updateNametags(element) {
if(localPlayer != null) { if(localPlayer != null) {
let playerPos = localPlayer.position; let playerPos = localPlayer.position;
let elementPos = element.position; let elementPos = element.position;
let client = getClientFromPlayerElement(element); let client = getClientFromPlayerElement(element);
elementPos[2] += 0.9; elementPos[2] += 0.9;
let screenPos = getScreenFromWorldPosition(elementPos); let screenPos = getScreenFromWorldPosition(elementPos);
if (screenPos[2] >= 0.0) { if (screenPos[2] >= 0.0) {
let health = element.health/100.0; let health = element.health/100.0;
if(health > 1.0) { if(health > 1.0) {
health = 1.0; health = 1.0;
} }
let armour = element.armour/100.0; let armour = element.armour/100.0;
if(armour > 1.0) { if(armour > 1.0) {
armour = 1.0; armour = 1.0;
} }
let distance = playerPos.distance(elementPos); let distance = playerPos.distance(elementPos);
if(distance <= nametagDistance) { if(distance <= nametagDistance) {
if(element.type == ELEMENT_PLAYER) { if(element.type == ELEMENT_PLAYER) {
let name = element.name; let name = element.name;
let colour = COLOUR_WHITE; let colour = COLOUR_WHITE;
let paused = false; let paused = false;
let ping = -1; let ping = -1;
if(typeof playerNames[element.name] != "undefined") { if(typeof playerNames[element.name] != "undefined") {
name = playerNames[element.name]; name = playerNames[element.name];
} }
if(typeof playerPaused[element.name] != "undefined") { if(typeof playerPaused[element.name] != "undefined") {
paused = playerPaused[element.name]; paused = playerPaused[element.name];
} }
@@ -154,10 +154,10 @@ function updateNametags(element) {
if(typeof playerColours[element.name] != "undefined") { if(typeof playerColours[element.name] != "undefined") {
colour = playerColours[element.name]; colour = playerColours[element.name];
} }
if(typeof playerPing[element.name] != "undefined") { if(typeof playerPing[element.name] != "undefined") {
ping = playerPing[element.name]; ping = playerPing[element.name];
} }
drawNametag(screenPos[0], screenPos[1], health, armour, name, ping, 1.0-distance/nametagDistance, distance, colour, paused, element.skin); drawNametag(screenPos[0], screenPos[1], health, armour, name, ping, 1.0-distance/nametagDistance, distance, colour, paused, element.skin);
} }
@@ -182,7 +182,7 @@ addEventHandler("OnDrawnHUD", function(event) {
if(gta.game >= GAME_GTA_IV) { if(gta.game >= GAME_GTA_IV) {
return false; return false;
} }
getElementsByType(ELEMENT_PLAYER).forEach(function(player) { getElementsByType(ELEMENT_PLAYER).forEach(function(player) {
if(player != localPlayer) { if(player != localPlayer) {
updateNametags(player); updateNametags(player);

View File

@@ -28,23 +28,23 @@ addEventHandler("OnDrawnHUD", function (event) {
if(listFont != null && titleFont != null) { if(listFont != null && titleFont != null) {
let scoreboardStart = (game.height/2)-(Math.floor(getClients().length/2)*20); let scoreboardStart = (game.height/2)-(Math.floor(getClients().length/2)*20);
let titleSize = titleFont.measure("PLAYERS", game.width, 0.0, 1.0, 10, false, false); let titleSize = titleFont.measure("PLAYERS", game.width, 0.0, 1.0, 10, false, false);
titleFont.render("PLAYERS", [game.width/2, scoreboardStart-50], 0, 0.5, 0.0, titleFont.size, COLOUR_WHITE, false, false, false, true); titleFont.render("PLAYERS", [game.width/2, scoreboardStart-50], 0, 0.5, 0.0, titleFont.size, COLOUR_WHITE, false, false, false, true);
titleSize = titleFont.measure("____________________________", game.width, 0.0, 1.0, 10, false, false); titleSize = titleFont.measure("____________________________", game.width, 0.0, 1.0, 10, false, false);
titleFont.render("____________________________", [game.width/2, scoreboardStart-35], 0, 0.5, 0.0, titleFont.size, COLOUR_WHITE, false, false, false, true); titleFont.render("____________________________", [game.width/2, scoreboardStart-35], 0, 0.5, 0.0, titleFont.size, COLOUR_WHITE, false, false, false, true);
let clients = getClients(); let clients = getClients();
for(let i in clients) { for(let i in clients) {
if(!clients[i].console) { if(!clients[i].console) {
let name = clients[i].name; let name = clients[i].name;
let colour = COLOUR_WHITE; let colour = COLOUR_WHITE;
let paused = false; let paused = false;
let ping = "-1"; let ping = "-1";
if(typeof playerNames[clients[i].name] != "undefined") { if(typeof playerNames[clients[i].name] != "undefined") {
name = playerNames[clients[i].name]; name = playerNames[clients[i].name];
} }
if(typeof playerPaused[clients[i].name] != "undefined") { if(typeof playerPaused[clients[i].name] != "undefined") {
paused = playerPaused[clients[i].name]; paused = playerPaused[clients[i].name];
} }
@@ -55,27 +55,27 @@ addEventHandler("OnDrawnHUD", function (event) {
if(typeof playerPing[clients[i].name] != "undefined") { if(typeof playerPing[clients[i].name] != "undefined") {
ping = toString(playerPing[clients[i].name]); ping = toString(playerPing[clients[i].name]);
} }
// Player ID // Player ID
let text = String(clients[i].index); let text = String(clients[i].index);
let size = listFont.measure(text, 75, 0.0, 1.0, 10, false, false); let size = listFont.measure(text, 75, 0.0, 1.0, 10, false, false);
listFont.render(text, [game.width/2-100, scoreboardStart + (i*20)], 0, 0.5, 0.0, listFont.size, COLOUR_WHITE, false, false, false, true); listFont.render(text, [game.width/2-100, scoreboardStart + (i*20)], 0, 0.5, 0.0, listFont.size, COLOUR_WHITE, false, false, false, true);
// Player Name // Player Name
text = name; text = name;
size = listFont.measure(text, 100, 0.0, 1.0, 10, false, false); size = listFont.measure(text, 100, 0.0, 1.0, 10, false, false);
listFont.render(text, [game.width/2, scoreboardStart + (i*20)], 0, 0.5, 0.0, listFont.size, colour, false, false, false, true); listFont.render(text, [game.width/2, scoreboardStart + (i*20)], 0, 0.5, 0.0, listFont.size, colour, false, false, false, true);
// Ping // Ping
text = ping; text = ping;
size = listFont.measure(ping, 75, 0.0, 1.0, 10, false, false); size = listFont.measure(ping, 75, 0.0, 1.0, 10, false, false);
listFont.render(ping, [game.width/2+100, scoreboardStart + (i*20)], 0, 0.5, 0.0, listFont.size, COLOUR_WHITE, false, false, false, true); listFont.render(ping, [game.width/2+100, scoreboardStart + (i*20)], 0, 0.5, 0.0, listFont.size, COLOUR_WHITE, false, false, false, true);
// PAUSED Status (depends on resource "afk") // PAUSED Status (depends on resource "afk")
if(paused == true) { if(paused == true) {
size = listFont.measure("PAUSED", 100, 0.0, 1.0, 10, false, false); size = listFont.measure("PAUSED", 100, 0.0, 1.0, 10, false, false);
listFont.render("PAUSED", [game.width/2+200, scoreboardStart + (i*20)], 0, 0.5, 0.0, listFont.size, pausedColour, false, false, false, true); listFont.render("PAUSED", [game.width/2+200, scoreboardStart + (i*20)], 0, 0.5, 0.0, listFont.size, pausedColour, false, false, false, true);
} }
} }
} }

View File

@@ -18,7 +18,7 @@ addEventHandler("onProcess", function(event, deltaTime) {
if(localPlayer != null && localPlayer.getData("ag.spawned") != null) { if(localPlayer != null && localPlayer.getData("ag.spawned") != null) {
if(localPlayer.health <= 0) { if(localPlayer.health <= 0) {
localPlayer.clearWeapons(); localPlayer.clearWeapons();
triggerNetworkEvent("ag.player.death", localPlayer.position, localPlayer.heading.toFixed(2)); triggerNetworkEvent("ag.player.death", localPlayer.position);
} }
} }
}); });

View File

@@ -20,12 +20,12 @@ function loginCommand(command, params, client) {
messagePlayerError(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)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
checkLogin(client, params); checkLogin(client, params);
return true; return true;
} }
@@ -34,7 +34,7 @@ function loginCommand(command, params, client) {
function autoLoginByIPCommand(command, params, client) { function autoLoginByIPCommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("autoLoginIP"); let flagValue = getAccountSettingsFlagValue("autoLoginIP");
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;
messagePlayerSuccess(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})`);
@@ -49,7 +49,7 @@ function autoLoginByIPCommand(command, params, client) {
function autoSelectLastCharacterCommand(command, params, client) { function autoSelectLastCharacterCommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("autoSelectLastCharacter"); let flagValue = getAccountSettingsFlagValue("autoSelectLastCharacter");
if(doesPlayerHaveAutoSelectLastCharacterEnabled(client)) { if(doesPlayerHaveAutoSelectLastCharacterEnabled(client)) {
getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue; getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue;
messagePlayerSuccess(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`);
@@ -64,7 +64,7 @@ function autoSelectLastCharacterCommand(command, params, client) {
function toggleAccountGUICommand(command, params, client) { function toggleAccountGUICommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("noGUI"); let flagValue = getAccountSettingsFlagValue("noGUI");
if(!doesPlayerHaveGUIEnabled(client)) { if(!doesPlayerHaveGUIEnabled(client)) {
getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue; getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue;
messagePlayerNormal(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)`);
@@ -101,7 +101,7 @@ function toggleAccountGUICommand(command, params, client) {
function toggleAccountServerLogoCommand(command, params, client) { function toggleAccountServerLogoCommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("noServerLogo"); let flagValue = getAccountSettingsFlagValue("noServerLogo");
if(!doesPlayerHaveLogoEnabled(client)) { if(!doesPlayerHaveLogoEnabled(client)) {
getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue; getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue;
messagePlayerNormal(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)`);
@@ -113,7 +113,7 @@ function toggleAccountServerLogoCommand(command, params, client) {
console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(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);
} }
return true; return true;
} }
@@ -123,7 +123,7 @@ function toggleAccountServerLogoCommand(command, params, client) {
// TO-DO: Make GUI, add command to generate code to add to auth app and command to input code returned by auth app // TO-DO: Make GUI, add command to generate code to add to auth app and command to input code returned by auth app
function toggleAccountTwoFactorAuthCommand(command, params, client) { function toggleAccountTwoFactorAuthCommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("twoStepAuth"); let flagValue = getAccountSettingsFlagValue("twoStepAuth");
if(getPlayerData(client).emailAddress != "") { if(getPlayerData(client).emailAddress != "") {
messagePlayerError(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.");
messagePlayerTip(client, "[#FFFFFF]Use [#AAAAAA]/setemail [#FFFFFF]to add your email."); messagePlayerTip(client, "[#FFFFFF]Use [#AAAAAA]/setemail [#FFFFFF]to add your email.");
@@ -132,7 +132,7 @@ function toggleAccountTwoFactorAuthCommand(command, params, client) {
if(!isValidEmailAddress(getPlayerData(client).emailAddress)) { if(!isValidEmailAddress(getPlayerData(client).emailAddress)) {
messagePlayerError(client, "The email you previously added is not valid."); messagePlayerError(client, "The email you previously added is not valid.");
messagePlayerTip(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;
} }
@@ -155,12 +155,12 @@ function registerCommand(command, params, client) {
messagePlayerError(client, "Your name is already registered!"); messagePlayerError(client, "Your name is already registered!");
return false; return false;
} }
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messagePlayerSyntax(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;
//messagePlayerSuccess(client, "Your account has been created!"); //messagePlayerSuccess(client, "Your account has been created!");
@@ -183,13 +183,13 @@ function changePasswordCommand(command, params, client) {
messagePlayerError(client, "The old password is invalid!"); messagePlayerError(client, "The old password is invalid!");
return false; return false;
} }
if(!doesPasswordMeetRequirements(newPassword)) { if(!doesPasswordMeetRequirements(newPassword)) {
messagePlayerError(client, "The new password must meet the requirements!"); messagePlayerError(client, "The new password must meet the requirements!");
messagePlayerInfo(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);
messagePlayerSuccess(client, "Your password has been changed!"); messagePlayerSuccess(client, "Your password has been changed!");
} }
@@ -207,12 +207,12 @@ function setAccountEmailCommand(command, params, client) {
let splitParams = params.split(" "); let splitParams = params.split(" ");
let emailAddress = splitParams[0]; let emailAddress = splitParams[0];
if(!isValidEmailAddress(emailAddress)) { if(!isValidEmailAddress(emailAddress)) {
messagePlayerError(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;
messagePlayerSuccess(client, "Your password has been changed!"); messagePlayerSuccess(client, "Your password has been changed!");
@@ -231,12 +231,12 @@ function setAccountDiscordCommand(command, params, client) {
let splitParams = params.split(" "); let splitParams = params.split(" ");
let discordName = splitParams[0]; let discordName = splitParams[0];
if(!isValidEmailAddress(emailAddress)) { if(!isValidEmailAddress(emailAddress)) {
messagePlayerError(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;
//messagePlayerSuccess(client, "Your discord account has been attached to your game account!"); //messagePlayerSuccess(client, "Your discord account has been attached to your game account!");
@@ -268,7 +268,7 @@ function isPlayerRegistered(client) {
return true; return true;
} }
} }
return false; return false;
} }
@@ -285,7 +285,7 @@ function isAccountPasswordCorrect(accountData, password) {
if(accountData.password == password) { if(accountData.password == password) {
return true; return true;
} }
return false; return false;
} }
@@ -295,7 +295,7 @@ function loadAccountFromName(accountName, fullLoad = false) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
if(dbConnection) { if(dbConnection) {
accountName = escapeDatabaseString(dbConnection, accountName); accountName = escapeDatabaseString(dbConnection, accountName);
let dbQueryString = `SELECT * FROM acct_main WHERE acct_name = '${accountName}' LIMIT 1;`; let dbQueryString = `SELECT *, INET_NTOA(acct_ip) AS ipstring FROM acct_main WHERE acct_name = '${accountName}' LIMIT 1;`;
let dbQuery = queryDatabase(dbConnection, dbQueryString); let dbQuery = queryDatabase(dbConnection, dbQueryString);
if(dbQuery) { if(dbQuery) {
if(dbQuery.numRows > 0) { if(dbQuery.numRows > 0) {
@@ -313,7 +313,7 @@ function loadAccountFromName(accountName, fullLoad = false) {
} }
disconnectFromDatabase(dbConnection); disconnectFromDatabase(dbConnection);
} }
return false; return false;
} }
@@ -322,7 +322,7 @@ function loadAccountFromName(accountName, fullLoad = false) {
function loadAccountFromId(accountId, fullLoad = false) { function loadAccountFromId(accountId, fullLoad = false) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
if(dbConnection) { if(dbConnection) {
let dbQueryString = `SELECT *, INET_NTOA(acct_ip) AS ip FROM acct_main WHERE acct_id = ${accountId} LIMIT 1;`; let dbQueryString = `SELECT *, INET_NTOA(acct_ip) AS ipstring FROM acct_main WHERE acct_id = ${accountId} LIMIT 1;`;
let dbQuery = queryDatabase(dbConnection, dbQueryString); let dbQuery = queryDatabase(dbConnection, dbQueryString);
if(dbQuery) { if(dbQuery) {
let dbAssoc = fetchQueryAssoc(dbQuery); let dbAssoc = fetchQueryAssoc(dbQuery);
@@ -339,7 +339,7 @@ function loadAccountFromId(accountId, fullLoad = false) {
} }
disconnectFromDatabase(dbConnection); disconnectFromDatabase(dbConnection);
} }
return false; return false;
} }
@@ -349,27 +349,27 @@ function getAccountHashingFunction() {
switch(toLowerCase(getGlobalConfig().accountPasswordHash)) { switch(toLowerCase(getGlobalConfig().accountPasswordHash)) {
case "md5": case "md5":
return module.hashing.md5; return module.hashing.md5;
case "sha1": case "sha1":
return module.hashing.sha1; return module.hashing.sha1;
case "sha224": case "sha224":
return module.hashing.sha224; return module.hashing.sha224;
case "sha256": case "sha256":
return module.hashing.sha256; return module.hashing.sha256;
case "sha384": case "sha384":
return module.hashing.sha384; return module.hashing.sha384;
case "sha512": case "sha512":
return module.hashing.sha512; return module.hashing.sha512;
case "ripemd128": case "ripemd128":
return module.hashing.ripemd128; return module.hashing.ripemd128;
case "ripemd160": case "ripemd160":
return module.hashing.ripemd160; return module.hashing.ripemd160;
case "ripemd256": case "ripemd256":
return module.hashing.ripemd256; return module.hashing.ripemd256;
@@ -378,7 +378,7 @@ function getAccountHashingFunction() {
return module.hashing.ripemd320; return module.hashing.ripemd320;
case "whirlpool": case "whirlpool":
return module.hashing.whirlpool; return module.hashing.whirlpool;
} }
} }
@@ -389,7 +389,7 @@ function isNameRegistered(name) {
if(accountData.databaseId > 0) { if(accountData.databaseId > 0) {
return true; return true;
} }
return false; return false;
} }
@@ -430,7 +430,7 @@ function loginSuccess(client) {
} else { } else {
showCharacterSelectToClient(client); showCharacterSelectToClient(client);
} }
getPlayerData(client).accountData.ipAddress = client.ip; getPlayerData(client).accountData.ipAddress = client.ip;
sendRemovedWorldObjectsToPlayer(client); sendRemovedWorldObjectsToPlayer(client);
@@ -443,7 +443,7 @@ function loginSuccess(client) {
function saveAccountToDatabase(accountData) { function saveAccountToDatabase(accountData) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
if(dbConnection) { if(dbConnection) {
let safePassword = escapeDatabaseString(dbConnection, accountData.password); let safePassword = escapeDatabaseString(dbConnection, accountData.password);
let safeStaffTitle = escapeDatabaseString(dbConnection, accountData.staffTitle); let safeStaffTitle = escapeDatabaseString(dbConnection, accountData.staffTitle);
let safeEmailAddress = escapeDatabaseString(dbConnection, accountData.emailAddress); let safeEmailAddress = escapeDatabaseString(dbConnection, accountData.emailAddress);
@@ -460,7 +460,7 @@ function saveAccountToDatabase(accountData) {
function saveAccountKeyBindsDatabase(keyBindData) { function saveAccountKeyBindsDatabase(keyBindData) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
if(dbConnection) { if(dbConnection) {
let safeCommandString = escapeDatabaseString(dbConnection, keyBindData.commandString); let safeCommandString = escapeDatabaseString(dbConnection, keyBindData.commandString);
if(keyBindData.databaseId == 0) { if(keyBindData.databaseId == 0) {
let dbQueryString = `INSERT INTO acct_hotkey (acct_hotkey_cmdstr, acct_hotkey_key, acct_hotkey_down, acct_hotkey_enabled) VALUES ('${safeCommandString}', ${keyBindData.key}, ${boolToInt(keyBindData.keyState)}, ${boolToInt(keyBindData.enabled)}, ${keyBindData.account}`; let dbQueryString = `INSERT INTO acct_hotkey (acct_hotkey_cmdstr, acct_hotkey_key, acct_hotkey_down, acct_hotkey_enabled) VALUES ('${safeCommandString}', ${keyBindData.key}, ${boolToInt(keyBindData.keyState)}, ${boolToInt(keyBindData.enabled)}, ${keyBindData.account}`;
@@ -470,7 +470,7 @@ function saveAccountKeyBindsDatabase(keyBindData) {
} else { } else {
let dbQueryString = `UPDATE acct_hotkey SET acct_hotkey_cmdstr='${safeCommandString}', acct_hotkey_key=${keyBindData.key}, acct_hotkey_down=${boolToInt(keyBindData.keyState)}, acct_hotkey_enabled=${boolToInt(keyBindData.enabled)} WHERE acct_hotkey_id=${keyBindData.databaseId}`; let dbQueryString = `UPDATE acct_hotkey SET acct_hotkey_cmdstr='${safeCommandString}', acct_hotkey_key=${keyBindData.key}, acct_hotkey_down=${boolToInt(keyBindData.keyState)}, acct_hotkey_enabled=${boolToInt(keyBindData.enabled)} WHERE acct_hotkey_id=${keyBindData.databaseId}`;
let dbQuery = queryDatabase(dbConnection, dbQueryString); let dbQuery = queryDatabase(dbConnection, dbQueryString);
freeDatabaseQuery(dbQuery); freeDatabaseQuery(dbQuery);
} }
disconnectFromDatabase(dbConnection); disconnectFromDatabase(dbConnection);
@@ -481,7 +481,7 @@ function saveAccountKeyBindsDatabase(keyBindData) {
function saveAccountStaffNotesDatabase(staffNoteData) { function saveAccountStaffNotesDatabase(staffNoteData) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
if(dbConnection) { if(dbConnection) {
let safeNoteContent = escapeDatabaseString(dbConnection, staffNoteData.note); let safeNoteContent = escapeDatabaseString(dbConnection, staffNoteData.note);
if(staffNoteData.databaseId == 0) { if(staffNoteData.databaseId == 0) {
let dbQueryString = `INSERT INTO acct_note (acct_note_message, acct_note_who_added, acct_note_when_added, acct_note_server, acct_note_acct) VALUES ('${safeNoteContent}', ${staffNoteData.whoAdded}, UNIX_TIMESTAMP(), ${getServerId()}, ${staffNoteData.account}`; let dbQueryString = `INSERT INTO acct_note (acct_note_message, acct_note_who_added, acct_note_when_added, acct_note_server, acct_note_acct) VALUES ('${safeNoteContent}', ${staffNoteData.whoAdded}, UNIX_TIMESTAMP(), ${getServerId()}, ${staffNoteData.account}`;
@@ -499,7 +499,7 @@ function saveAccountStaffNotesDatabase(staffNoteData) {
/* /*
function saveAccountContactsDatabase(accountContactData) { function saveAccountContactsDatabase(accountContactData) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
if(dbConnection) { if(dbConnection) {
let safeNoteContent = escapeDatabaseString(dbConnection, accountContactData.note); let safeNoteContent = escapeDatabaseString(dbConnection, accountContactData.note);
if(accountContactData.databaseId == 0) { if(accountContactData.databaseId == 0) {
let dbQueryString = `INSERT INTO acct_contact (acct_contact_note, acct_contact_, acct_note_when_added, acct_note_server, acct_note_acct) VALUES ('${safeNoteContent}', ${staffNoteData.whoAdded}, UNIX_TIMESTAMP(), ${getServerId()}, ${staffNoteData.account}`; let dbQueryString = `INSERT INTO acct_contact (acct_contact_note, acct_contact_, acct_note_when_added, acct_note_server, acct_note_acct) VALUES ('${safeNoteContent}', ${staffNoteData.whoAdded}, UNIX_TIMESTAMP(), ${getServerId()}, ${staffNoteData.account}`;
@@ -509,7 +509,7 @@ function saveAccountContactsDatabase(accountContactData) {
}// else { }// else {
// let dbQueryString = `UPDATE acct_hotkey SET acct_hotkey_cmdstr='${safeCommandString}', acct_hotkey_key=${keyBindData.key}, acct_hotkey_down=${boolToInt(keyBindData.keyState)}, acct_hotkey_enabled=${boolToInt(keyBindData.enabled)} WHERE acct_hotkey_id=${keyBindData.databaseId}`; // let dbQueryString = `UPDATE acct_hotkey SET acct_hotkey_cmdstr='${safeCommandString}', acct_hotkey_key=${keyBindData.key}, acct_hotkey_down=${boolToInt(keyBindData.keyState)}, acct_hotkey_enabled=${boolToInt(keyBindData.enabled)} WHERE acct_hotkey_id=${keyBindData.databaseId}`;
// let dbQuery = queryDatabase(dbConnection, dbQueryString); // let dbQuery = queryDatabase(dbConnection, dbQueryString);
// freeDatabaseQuery(dbQuery); // freeDatabaseQuery(dbQuery);
//} //}
disconnectFromDatabase(dbConnection); disconnectFromDatabase(dbConnection);
@@ -544,16 +544,16 @@ function checkLogin(client, password) {
let loginAttemptsRemaining = getEntityData(client, "ag.loginAttemptsRemaining")-1; let loginAttemptsRemaining = getEntityData(client, "ag.loginAttemptsRemaining")-1;
if(isPlayerLoggedIn(client)) { if(isPlayerLoggedIn(client)) {
console.warn(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.loginSuccess", client); triggerNetworkEvent("ag.loginSuccess", client);
console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} has successfully logged in`);
} else { } else {
messagePlayerError(client, "You are already logged in!"); messagePlayerError(client, "You are already logged in!");
console.warn(`[Asshat.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
} }
return false; return false;
} }
if(!isPlayerRegistered(client)) { if(!isPlayerRegistered(client)) {
console.warn(`[Asshat.Account] ${getPlayerDisplayForConsole(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)) {
@@ -562,22 +562,22 @@ function checkLogin(client, password) {
} else { } else {
messagePlayerError(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] ${getPlayerDisplayForConsole(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] ${getPlayerDisplayForConsole(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] ${getPlayerDisplayForConsole(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 {
messagePlayerError(client, `You must enter a password! ${loginAttemptsRemaining} tries remaining.`); messagePlayerError(client, `You must enter a password! ${loginAttemptsRemaining} tries remaining.`);
console.log(`[Asshat.Account] ${getPlayerDisplayForConsole(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] ${getPlayerDisplayForConsole(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)) {
@@ -589,7 +589,7 @@ function checkLogin(client, password) {
} }
return false; return false;
} }
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.loginSuccess", client); triggerNetworkEvent("ag.loginSuccess", client);
} }
@@ -650,7 +650,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
return false; return false;
} }
} }
if(!doesPasswordMeetRequirements(password)) { if(!doesPasswordMeetRequirements(password)) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
// 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.
@@ -675,7 +675,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
} else { } else {
messagePlayerAlert(client, "Something went wrong. Your account could not be created!"); messagePlayerAlert(client, "Something went wrong. Your account could not be created!");
} }
messagePlayerAlert(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;
} }
@@ -685,7 +685,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
messagePlayerSuccess(client, "Your account has been created!"); messagePlayerSuccess(client, "Your account has been created!");
messagePlayerAlert(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");
@@ -718,7 +718,7 @@ function savePlayerToDatabase(client) {
if(getPlayerData(client) == null) { if(getPlayerData(client) == null) {
return false; return false;
} }
if(!getPlayerData(client).loggedIn) { if(!getPlayerData(client).loggedIn) {
return false; return false;
} }
@@ -755,7 +755,7 @@ function initClient(client) {
showConnectCameraToPlayer(client); showConnectCameraToPlayer(client);
messageClient(`Please wait ...`, client, getColourByName("softGreen")); messageClient(`Please wait ...`, client, getColourByName("softGreen"));
setTimeout(function() { setTimeout(function() {
let sessionId = saveSessionToDatabase(client); let sessionId = saveSessionToDatabase(client);
setEntityData(client, "ag.session", sessionId, false); setEntityData(client, "ag.session", sessionId, false);
@@ -763,7 +763,7 @@ function initClient(client) {
clearChatBox(client); clearChatBox(client);
let tempAccountData = loadAccountFromName(client.name, true); let tempAccountData = loadAccountFromName(client.name, true);
let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId); let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId);
getServerData().clients[client.index] = new serverClasses.clientData(client, tempAccountData, tempSubAccounts); getServerData().clients[client.index] = new serverClasses.clientData(client, tempAccountData, tempSubAccounts);
if(tempAccountData != false) { if(tempAccountData != false) {
@@ -818,7 +818,7 @@ function loadAccountKeybindsFromDatabase(accountDatabaseID) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let dbQuery = null; let dbQuery = null;
let dbAssoc; let dbAssoc;
if(dbConnection) { if(dbConnection) {
dbQuery = queryDatabase(dbConnection, `SELECT * FROM acct_hotkey WHERE acct_hotkey_enabled = 1 AND acct_hotkey_acct = ${accountDatabaseID}`); dbQuery = queryDatabase(dbConnection, `SELECT * FROM acct_hotkey WHERE acct_hotkey_enabled = 1 AND acct_hotkey_acct = ${accountDatabaseID}`);
if(dbQuery) { if(dbQuery) {
@@ -847,7 +847,7 @@ function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let dbQuery = null; let dbQuery = null;
let dbAssoc; let dbAssoc;
if(dbConnection) { if(dbConnection) {
dbQuery = queryDatabase(dbConnection, "SELECT * FROM `acct_note` WHERE `acct_note_deleted` = 0 AND `acct_note_acct` = " + toString(accountDatabaseID)); dbQuery = queryDatabase(dbConnection, "SELECT * FROM `acct_note` WHERE `acct_note_deleted` = 0 AND `acct_note_acct` = " + toString(accountDatabaseID));
if(dbQuery) { if(dbQuery) {
@@ -876,7 +876,7 @@ function loadAccountContactsFromDatabase(accountDatabaseID) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let dbQuery = null; let dbQuery = null;
let dbAssoc; let dbAssoc;
if(dbConnection) { if(dbConnection) {
dbQuery = queryDatabase(dbConnection, "SELECT * FROM `acct_contact` WHERE `acct_contact_deleted` = 0 AND `acct_contact_acct` = " + toString(accountDatabaseID)); dbQuery = queryDatabase(dbConnection, "SELECT * FROM `acct_contact` WHERE `acct_contact_deleted` = 0 AND `acct_contact_acct` = " + toString(accountDatabaseID));
if(dbQuery) { if(dbQuery) {
@@ -905,7 +905,7 @@ function loadAccountMessagesFromDatabase(accountDatabaseID) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let dbQuery = null; let dbQuery = null;
let dbAssoc; let dbAssoc;
if(dbConnection) { if(dbConnection) {
dbQuery = queryDatabase(dbConnection, "SELECT * FROM `acct_msg` WHERE `acct_msg_deleted` = 0 AND `acct_msg_acct` = " + toString(accountDatabaseID)); dbQuery = queryDatabase(dbConnection, "SELECT * FROM `acct_msg` WHERE `acct_msg_deleted` = 0 AND `acct_msg_acct` = " + toString(accountDatabaseID));
if(dbQuery) { if(dbQuery) {

View File

@@ -26,7 +26,7 @@ function loadAntiCheatGameScriptWhiteListFromDatabase() {
if(dbQuery.numRows > 0) { if(dbQuery.numRows > 0) {
let dbAssoc = fetchQueryAssoc(dbQuery); let dbAssoc = fetchQueryAssoc(dbQuery);
let tempWhiteListedGameScriptData = new serverClasses.whiteListedGameScriptData(dbAssoc); let tempWhiteListedGameScriptData = new serverClasses.whiteListedGameScriptData(dbAssoc);
tempWhiteListedGameScripts.push(tempWhiteListedGameScriptData); tempWhiteListedGameScripts.push(tempWhiteListedGameScriptData);
console.log(`[Asshat.AntiCheat] Whitelisted game script '${tempWhiteListedGameScriptData.scriptName}' loaded successfully!`); console.log(`[Asshat.AntiCheat] Whitelisted game script '${tempWhiteListedGameScriptData.scriptName}' loaded successfully!`);
} }
@@ -51,7 +51,7 @@ function loadAntiCheatGameScriptBlackListFromDatabase() {
if(dbQuery.numRows > 0) { if(dbQuery.numRows > 0) {
let dbAssoc = fetchQueryAssoc(dbQuery); let dbAssoc = fetchQueryAssoc(dbQuery);
let tempBlackListedGameScriptData = new serverClasses.blackListedGameScriptData(dbAssoc); let tempBlackListedGameScriptData = new serverClasses.blackListedGameScriptData(dbAssoc);
tempBlackListedGameScripts.push(tempBlackListedGameScriptData); tempBlackListedGameScripts.push(tempBlackListedGameScriptData);
console.log(`[Asshat.AntiCheat] Blacklisted game script '${tempBlackListedGameScriptData.scriptName}' loaded successfully!`); console.log(`[Asshat.AntiCheat] Blacklisted game script '${tempBlackListedGameScriptData.scriptName}' loaded successfully!`);
} }

View File

@@ -55,7 +55,7 @@ function subAccountBanCommand(command, params, client, fromDiscord) {
messagePlayerError(client, "You cannot ban this person!"); messagePlayerError(client, "You cannot ban this person!");
return false; return false;
} }
let splitParams = params.split(" "); let splitParams = params.split(" ");
let targetClient = getPlayerFromParams(splitParams[0]); let targetClient = getPlayerFromParams(splitParams[0]);
let reason = splitParams.slice(1).join(" "); let reason = splitParams.slice(1).join(" ");
@@ -77,14 +77,14 @@ function ipBanCommand(command, params, client, fromDiscord) {
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) { if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
messagePlayerError(client, "You cannot ban this person!"); messagePlayerError(client, "You cannot ban this person!");
return false; return false;
} }
let splitParams = params.split(" "); let splitParams = params.split(" ");
let targetClient = getPlayerFromParams(splitParams[0]); let targetClient = getPlayerFromParams(splitParams[0]);
let reason = splitParams.slice(1).join(" "); let reason = splitParams.slice(1).join(" ");
messageAdminAction(`${targetClient.name} has been banned from the server (IP ban).`); messageAdminAction(`${targetClient.name} has been banned from the server (IP ban).`);
banIPAddress(targetClient.ip, getPlayerData(client).accountData.databaseId, reason); banIPAddress(targetClient.ip, getPlayerData(client).accountData.databaseId, reason);
server.banIP(targetClient.ip); server.banIP(targetClient.ip);
targetClient.disconnect(); targetClient.disconnect();
} }
@@ -102,14 +102,14 @@ function subNetBanCommand(command, params, client, fromDiscord) {
messagePlayerError(client, "You cannot ban this person!"); messagePlayerError(client, "You cannot ban this person!");
return false; return false;
} }
let splitParams = params.split(" "); let splitParams = params.split(" ");
let targetClient = getPlayerFromParams(splitParams[0]); let targetClient = getPlayerFromParams(splitParams[0]);
let octetAmount = Number(splitParams[1]); let octetAmount = Number(splitParams[1]);
let reason = splitParams.slice(2).join(" "); let reason = splitParams.slice(2).join(" ");
messageAdminAction(`${targetClient.name} has been banned from the server (subnet ban).`); messageAdminAction(`${targetClient.name} has been banned from the server (subnet ban).`);
banSubNet(targetClient.ip, getSubNet(targetClient.ip, octetAmount), getPlayerData(client).accountData.databaseId, reason); banSubNet(targetClient.ip, getSubNet(targetClient.ip, octetAmount), getPlayerData(client).accountData.databaseId, reason);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -254,7 +254,7 @@ function isSubAccountBanned(subAccountId) {
} }
} }
} }
return false; return false;
} }
@@ -269,7 +269,7 @@ function isIpAddressBanned(ipAddress) {
} }
} }
} }
return false; return false;
} }

View File

@@ -23,22 +23,22 @@ let serverBitFlags = {
let serverBitFlagKeys = { let serverBitFlagKeys = {
staffFlagKeys: [ staffFlagKeys: [
"none", "none",
"basicModeration", "basicModeration",
"manageHouses", "manageHouses",
"manageVehicles", "manageVehicles",
"manageBusinesses", "manageBusinesses",
"manageFactions", "manageFactions",
"manageClans", "manageClans",
"manageServer", "manageServer",
"manageAdmins", "manageAdmins",
"manageJobs", "manageJobs",
"developer", "developer",
], ],
moderationFlagKeys: [ moderationFlagKeys: [
"none", "none",
"muted", "muted",
"frozen", "frozen",
"hackerBox", "hackerBox",
"jobBanned", "jobBanned",
"ammuBanned", "ammuBanned",
@@ -47,47 +47,47 @@ let serverBitFlagKeys = {
"gunBanned", "gunBanned",
], ],
factionFlagKeys: [ factionFlagKeys: [
"none", "none",
"police", "police",
"medical", "medical",
"fire", "fire",
"government" "government"
], ],
clanFlagKeys: [ clanFlagKeys: [
"none", "none",
"illegal", "illegal",
"legal", "legal",
"mafia", "mafia",
"streetGang", "streetGang",
"weapons", "weapons",
"drugs", "drugs",
"humanTrafficking", "humanTrafficking",
"vigilante", "vigilante",
"hitContracts" "hitContracts"
], ],
clanPermissionFlagKeys: [ clanPermissionFlagKeys: [
"none", "none",
"inviteMember", "inviteMember",
"removeMember", "removeMember",
"memberRank", "memberRank",
"memberFlags", "memberFlags",
"memberTag", "memberTag",
"memberTitle", "memberTitle",
"rankFlags", "rankFlags",
"rankTag", "rankTag",
"rankTitle", "rankTitle",
"clanTag", "clanTag",
"clanName", "clanName",
"manageVehicles", "manageVehicles",
"manageHouses", "manageHouses",
"manageBusinesses", "manageBusinesses",
"owner", "owner",
], ],
accountSettingsFlagKeys: [ accountSettingsFlagKeys: [
"none", "none",
"useWhiteList", "useWhiteList",
"useBlackList", "useBlackList",
"twoStepAuth", "twoStepAuth",
"authAttemptAlert", "authAttemptAlert",
"noGUI", "noGUI",
"autoLoginIP", "autoLoginIP",
@@ -122,14 +122,14 @@ function createBitFlagTable(keyNames) {
let bitVal = 0; let bitVal = 0;
let bitTable = {}; let bitTable = {};
let incVal = 1; let incVal = 1;
for(let i in keyNames) { for(let i in keyNames) {
let key = keyNames[i]; let key = keyNames[i];
bitTable[key] = bitVal; bitTable[key] = bitVal;
bitVal = 1 << incVal; bitVal = 1 << incVal;
incVal++; incVal++;
} }
return bitTable; return bitTable;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -204,7 +204,7 @@ function getStaffFlagValue(flagName) {
if(flagName == "all") { if(flagName == "all") {
return -1; return -1;
} }
if(typeof serverBitFlags.staffFlags[flagName] === "undefined") { if(typeof serverBitFlags.staffFlags[flagName] === "undefined") {
return false; return false;
} }
@@ -218,7 +218,7 @@ function getClanFlagValue(flagName) {
if(flagName == "all") { if(flagName == "all") {
return -1; return -1;
} }
if(typeof getServerBitFlags().clanFlags[flagName] === "undefined") { if(typeof getServerBitFlags().clanFlags[flagName] === "undefined") {
return false; return false;
} }
@@ -232,7 +232,7 @@ function getAccountSettingsFlagValue(flagName) {
if(flagName == "all") { if(flagName == "all") {
return -1; return -1;
} }
if(typeof serverBitFlags.accountSettingsFlags[flagName] === "undefined") { if(typeof serverBitFlags.accountSettingsFlags[flagName] === "undefined") {
return false; return false;
} }
@@ -246,7 +246,7 @@ function getAccountFlagsFlagValue(flagName) {
if(flagName == "all") { if(flagName == "all") {
return -1; return -1;
} }
if(typeof serverBitFlags.accountFlags[flagName] === "undefined") { if(typeof serverBitFlags.accountFlags[flagName] === "undefined") {
return false; return false;
} }

View File

@@ -31,7 +31,7 @@ function loadBusinessFromId(businessId) {
} }
disconnectFromDatabase(dbConnection); disconnectFromDatabase(dbConnection);
} }
return false; return false;
} }
@@ -44,7 +44,7 @@ function loadBusinessesFromDatabase() {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let dbQuery = null; let dbQuery = null;
let dbAssoc; let dbAssoc;
if(dbConnection) { if(dbConnection) {
dbQuery = queryDatabase(dbConnection, `SELECT * FROM biz_main WHERE biz_server = ${getServerId()}`); dbQuery = queryDatabase(dbConnection, `SELECT * FROM biz_main WHERE biz_server = ${getServerId()}`);
if(dbQuery) { if(dbQuery) {
@@ -74,7 +74,7 @@ function loadBusinessLocationsFromDatabase(businessId) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let dbQuery = null; let dbQuery = null;
let dbAssoc; let dbAssoc;
if(dbConnection) { if(dbConnection) {
dbQuery = queryDatabase(dbConnection, "SELECT * FROM `biz_loc` WHERE `biz_loc_biz` = " + toString(businessId)); dbQuery = queryDatabase(dbConnection, "SELECT * FROM `biz_loc` WHERE `biz_loc_biz` = " + toString(businessId));
if(dbQuery) { if(dbQuery) {
@@ -103,7 +103,9 @@ function createBusinessCommand(command, params, client) {
createBusinessEntrancePickup(getServerData().businesses.length-1); createBusinessEntrancePickup(getServerData().businesses.length-1);
createBusinessExitPickup(getServerData().businesses.length-1); createBusinessExitPickup(getServerData().businesses.length-1);
createBusinessEntranceBlip(getServerData().businesses.length-1); createBusinessEntranceBlip(getServerData().businesses.length-1);
createBusinessExitBlip(getServerData().businesses.length-1); createBusinessExitBlip(getServerData().businesses.length-1);
saveBusinessToDatabase(getServerData().businesses.length-1);
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]created business [#0099FF]${tempBusinessData.name}`); messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]created business [#0099FF]${tempBusinessData.name}`);
} }
@@ -121,12 +123,12 @@ function createBusinessLocationCommand(command, params, client) {
if(!areParamsEmpty(params)) { if(!areParamsEmpty(params)) {
businessId = getBusinessFromParams(params); businessId = getBusinessFromParams(params);
} }
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messagePlayerError("Business not found!"); messagePlayerError("Business not found!");
return false; return false;
} }
let tempBusinessLocationData = createBusinessLocation(locationType, businessId); let tempBusinessLocationData = createBusinessLocation(locationType, businessId);
getServerData().businesses[businessId].push(tempBusinessLocationData); getServerData().businesses[businessId].push(tempBusinessLocationData);
@@ -152,7 +154,7 @@ function createBusiness(name, entrancePosition, exitPosition, entrancePickupMode
tempBusinessData.exitPickupModel = exitPickupModel; tempBusinessData.exitPickupModel = exitPickupModel;
tempBusinessData.exitBlipModel = exitBlipModel; tempBusinessData.exitBlipModel = exitBlipModel;
tempBusinessData.exitInterior = exitInteriorId; tempBusinessData.exitInterior = exitInteriorId;
tempBusinessData.exitDimension = exitVirtualWorld; tempBusinessData.exitDimension = exitVirtualWorld;
return tempBusinessData; return tempBusinessData;
} }
@@ -169,7 +171,7 @@ function deleteBusinessCommand(command, params, client) {
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messagePlayerError("Business not found!"); messagePlayerError("Business not found!");
return false; return false;
} }
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]deleted business [#0099FF]${getBusinessData(businessId).name}`); messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]deleted business [#0099FF]${getBusinessData(businessId).name}`);
deleteBusiness(businessId, getPlayerData(client).accountData.databaseId); deleteBusiness(businessId, getPlayerData(client).accountData.databaseId);
@@ -193,7 +195,7 @@ function setBusinessNameCommand(command, params, client) {
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messagePlayerError("Business not found!"); messagePlayerError("Business not found!");
return false; return false;
} }
let oldBusinessName = getBusinessData(businessId).name; let oldBusinessName = getBusinessData(businessId).name;
getBusinessData(businessId).name = newBusinessName; getBusinessData(businessId).name = newBusinessName;
@@ -251,7 +253,7 @@ function setBusinessJobCommand(command, params, client) {
if(!areParamsEmpty(params)) { if(!areParamsEmpty(params)) {
businessId = getBusinessFromParams(params); businessId = getBusinessFromParams(params);
} }
let closestJobLocation = getClosestJobLocation(getVehiclePosition(vehicle)); let closestJobLocation = getClosestJobLocation(getVehiclePosition(vehicle));
let jobId = closestJobLocation.job; let jobId = closestJobLocation.job;
@@ -281,7 +283,7 @@ function setBusinessPublicCommand(command, params, client) {
if(!areParamsEmpty(params)) { if(!areParamsEmpty(params)) {
businessId = getBusinessFromParams(params); businessId = getBusinessFromParams(params);
} }
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messagePlayerError("Business not found!"); messagePlayerError("Business not found!");
@@ -301,11 +303,11 @@ function lockBusinessCommand(command, params, client) {
if(!areParamsEmpty(params)) { if(!areParamsEmpty(params)) {
businessId = getBusinessFromParams(params); businessId = getBusinessFromParams(params);
} }
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messagePlayerError("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);
@@ -363,8 +365,8 @@ function getBusinessInfoCommand(command, params, client) {
case AG_BIZOWNER_PUBLIC: case AG_BIZOWNER_PUBLIC:
ownerName = "Public"; ownerName = "Public";
break; break;
} }
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}`); 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}`);
} }
@@ -403,6 +405,55 @@ function setBusinessPickupCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function setBusinessInteriorTypeCommand(command, params, client) {
let splitParams = params.split(" ");
let typeParam = splitParams[0] || "business";
let businessId = getBusinessFromParams(splitParams[1]) || (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
if(!getBusinessData(businessId)) {
messagePlayerError(client, "Business not found!");
return false;
}
if(isNaN(typeParam)) {
if(toLowerCase(typeParam) == "none") {
getBusinessData(businessId).exitPosition = toVector3(0.0, 0.0, 0.0);
getBusinessData(businessId).exitInterior = 0;
getBusinessData(businessId).hasInterior = false;
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]remove business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]interior`);
return false;
}
if(isNull(getGameConfig().interiorTemplates[getServerGame()][typeParam])) {
messagePlayerError(client, "Invalid interior type! Use an interior type name or an existing business database ID");
messagePlayerInfo(client, `Interior Types: [#AAAAAA]${Object.keys(getGameConfig().interiorTemplates[getServerGame()]).join(", ")}`)
return false;
}
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]interior type to [#AAAAAA]${toLowerCase(typeParam)}`);
getBusinessData(businessId).exitPosition = getGameConfig().interiorTemplates[getServerGame()][typeParam].exitPosition;
getBusinessData(businessId).exitInterior = getGameConfig().interiorTemplates[getServerGame()][typeParam].exitInterior;
getBusinessData(businessId).exitDimension = getBusinessData(businessId).databaseId+getGlobalConfig().businessDimensionStart;
getBusinessData(businessId).hasInterior = true;
} else {
if(!getBusinessData(businessId)) {
messagePlayerError(client, "Business ID not found!");
return false;
}
getBusinessData(businessId).exitPosition = getBusinessData(businessId).exitPosition;
getBusinessData(businessId).exitInterior = getBusinessData(businessId).exitInterior;
getBusinessData(businessId).exitDimension = getBusinessData(businessId).databaseId+getGlobalConfig().businessDimensionStart;
getBusinessData(businessId).hasInterior = true;
}
deleteBusinessEntrancePickup(businessId);
deleteBusinessExitPickup(businessId);
createBusinessEntrancePickup(businessId);
createBusinessExitPickup(businessId);
}
// ---------------------------------------------------------------------------
function setBusinessBlipCommand(command, params, client) { function setBusinessBlipCommand(command, params, client) {
let splitParams = params.split(" "); let splitParams = params.split(" ");
@@ -453,7 +504,7 @@ function withdrawFromBusinessCommand(command, params, client) {
} }
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) {
messagePlayerError(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;
@@ -481,8 +532,8 @@ function depositIntoBusinessCommand(command, params, client) {
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messagePlayerError(client, "Business not found!"); messagePlayerError(client, "Business not found!");
return false; return false;
} }
if(getPlayerCurrentSubAccount(client).cash < amount) { if(getPlayerCurrentSubAccount(client).cash < amount) {
messagePlayerError(client, `You don't have that much money! You only have $${getPlayerCurrentSubAccount(client).cash}`); messagePlayerError(client, `You don't have that much money! You only have $${getPlayerCurrentSubAccount(client).cash}`);
return false; return false;
@@ -506,7 +557,7 @@ function viewBusinessTillAmountCommand(command, params, client) {
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messagePlayerError(client, "Business not found!"); messagePlayerError(client, "Business not found!");
return false; return false;
} }
messagePlayerSuccess(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}'!`);
} }
@@ -523,12 +574,12 @@ function moveBusinessEntranceCommand(command, params, client) {
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
messagePlayerError(client, "Business not found!"); messagePlayerError(client, "Business not found!");
return false; return false;
} }
getBusinessData(businessId).entrancePosition = getPlayerPosition(client); getBusinessData(businessId).entrancePosition = getPlayerPosition(client);
getBusinessData(businessId).entranceDimension = getPlayerVirtualWorld(client); getBusinessData(businessId).entranceDimension = getPlayerVirtualWorld(client);
getBusinessData(businessId).entranceInterior = getPlayerInterior(client); getBusinessData(businessId).entranceInterior = getPlayerInterior(client);
deleteBusinessEntranceBlip(businessId); deleteBusinessEntranceBlip(businessId);
deleteBusinessEntrancePickup(businessId); deleteBusinessEntrancePickup(businessId);
@@ -551,14 +602,14 @@ function moveBusinessExitCommand(command, params, client) {
messagePlayerError(client, "Business not found!"); messagePlayerError(client, "Business not found!");
return false; return false;
} }
getBusinessData(businessId).exitPosition = getPlayerPosition(client); getBusinessData(businessId).exitPosition = getPlayerPosition(client);
getBusinessData(businessId).exitDimension = getPlayerVirtualWorld(client); getBusinessData(businessId).exitDimension = getPlayerVirtualWorld(client);
getBusinessData(businessId).exitInterior = getPlayerInterior(client); getBusinessData(businessId).exitInterior = getPlayerInterior(client);
deleteBusinessExitBlip(businessId); deleteBusinessExitBlip(businessId);
deleteBusinessExitPickup(businessId); deleteBusinessExitPickup(businessId);
createBusinessExitBlip(businessId); createBusinessExitBlip(businessId);
createBusinessExitPickup(businessId); createBusinessExitPickup(businessId);
@@ -625,11 +676,11 @@ function saveBusinessToDatabase(businessId) {
if(dbConnection) { if(dbConnection) {
let safeBusinessName = escapeDatabaseString(dbConnection, tempBusinessData.name); let safeBusinessName = escapeDatabaseString(dbConnection, tempBusinessData.name);
if(tempBusinessData.databaseId == 0) { if(tempBusinessData.databaseId == 0) {
let dbQueryString = `INSERT INTO biz_main (biz_server, biz_name, biz_owner_type, biz_owner_id, biz_locked, biz_entrance_fee, biz_till, biz_entrance_pos_x, biz_entrance_pos_y, biz_entrance_pos_z, biz_entrance_rot_z, biz_entrance_int, biz_entrance_vw, biz_exit_pos_x, biz_exit_pos_y, biz_exit_pos_z, biz_exit_rot_z, biz_exit_int, biz_exit_vw) VALUES (${getServerId()}, '${safeBusinessName}', ${tempBusinessData.ownerType}, ${tempBusinessData.ownerId}, ${boolToInt(tempBusinessData.locked)}, ${tempBusinessData.entranceFee}, ${tempBusinessData.till}, ${tempBusinessData.entrancePosition.x}, ${tempBusinessData.entrancePosition.y}, ${tempBusinessData.entrancePosition.z}, ${tempBusinessData.entranceRotation}, ${tempBusinessData.entranceInterior}, ${tempBusinessData.entranceDimension}, ${tempBusinessData.exitPosition.x}, ${tempBusinessData.exitPosition.y}, ${tempBusinessData.exitPosition.z}, ${tempBusinessData.exitRotation}, ${tempBusinessData.exitInterior}, ${tempBusinessData.exitDimension})`; let dbQueryString = `INSERT INTO biz_main (biz_server, biz_name, biz_owner_type, biz_owner_id, biz_locked, biz_entrance_fee, biz_till, biz_entrance_pos_x, biz_entrance_pos_y, biz_entrance_pos_z, biz_entrance_rot_z, biz_entrance_int, biz_entrance_vw, biz_exit_pos_x, biz_exit_pos_y, biz_exit_pos_z, biz_exit_rot_z, biz_exit_int, biz_exit_vw) VALUES (${getServerId()}, '${safeBusinessName}', ${tempBusinessData.ownerType}, ${tempBusinessData.ownerId}, ${boolToInt(tempBusinessData.locked)}, ${tempBusinessData.entranceFee}, ${tempBusinessData.till}, ${tempBusinessData.entrancePosition.x}, ${tempBusinessData.entrancePosition.y}, ${tempBusinessData.entrancePosition.z}, ${tempBusinessData.entranceRotation}, ${tempBusinessData.entranceInterior}, ${tempBusinessData.entranceDimension}, ${tempBusinessData.exitPosition.x}, ${tempBusinessData.exitPosition.y}, ${tempBusinessData.exitPosition.z}, ${tempBusinessData.exitRotation}, ${tempBusinessData.exitInterior}, ${tempBusinessData.databaseId+getGlobalConfig().businessDimensionStart}, ${boolToInt(tempBusinessData.hasInterior)})`;
queryDatabase(dbConnection, dbQueryString); queryDatabase(dbConnection, dbQueryString);
getServerData().businesses[businessId].databaseId = getDatabaseInsertId(dbConnection); getServerData().businesses[businessId].databaseId = getDatabaseInsertId(dbConnection);
} else { } else {
let dbQueryString = `UPDATE biz_main SET biz_name='${safeBusinessName}', biz_owner_type=${tempBusinessData.ownerType}, biz_owner_id=${tempBusinessData.ownerId}, biz_locked=${boolToInt(tempBusinessData.locked)}, biz_entrance_fee=${tempBusinessData.entranceFee}, biz_till=${tempBusinessData.till}, biz_entrance_pos_x=${tempBusinessData.entrancePosition.x}, biz_entrance_pos_y=${tempBusinessData.entrancePosition.y}, biz_entrance_pos_z=${tempBusinessData.entrancePosition.z}, biz_entrance_rot_z=${tempBusinessData.entranceRotation}, biz_entrance_int=${tempBusinessData.entranceInterior}, biz_entrance_vw=${tempBusinessData.entranceDimension}, biz_exit_pos_x=${tempBusinessData.exitPosition.x}, biz_exit_pos_y=${tempBusinessData.exitPosition.y}, biz_exit_pos_z=${tempBusinessData.exitPosition.z}, biz_exit_rot_z=${tempBusinessData.exitRotation}, biz_exit_int=${tempBusinessData.exitInterior}, biz_exit_vw=${tempBusinessData.exitDimension} WHERE biz_id=${tempBusinessData.databaseId}`; let dbQueryString = `UPDATE biz_main SET biz_name='${safeBusinessName}', biz_owner_type=${tempBusinessData.ownerType}, biz_owner_id=${tempBusinessData.ownerId}, biz_locked=${boolToInt(tempBusinessData.locked)}, biz_entrance_fee=${tempBusinessData.entranceFee}, biz_till=${tempBusinessData.till}, biz_entrance_pos_x=${tempBusinessData.entrancePosition.x}, biz_entrance_pos_y=${tempBusinessData.entrancePosition.y}, biz_entrance_pos_z=${tempBusinessData.entrancePosition.z}, biz_entrance_rot_z=${tempBusinessData.entranceRotation}, biz_entrance_int=${tempBusinessData.entranceInterior}, biz_entrance_vw=${tempBusinessData.entranceDimension}, biz_exit_pos_x=${tempBusinessData.exitPosition.x}, biz_exit_pos_y=${tempBusinessData.exitPosition.y}, biz_exit_pos_z=${tempBusinessData.exitPosition.z}, biz_exit_rot_z=${tempBusinessData.exitRotation}, biz_exit_int=${tempBusinessData.exitInterior}, biz_exit_vw=${tempBusinessData.exitDimension}, biz_has_interior=${boolToInt(tempBusinessData.hasInterior)} WHERE biz_id=${tempBusinessData.databaseId}`;
queryDatabase(dbConnection, dbQueryString); queryDatabase(dbConnection, dbQueryString);
} }
disconnectFromDatabase(dbConnection); disconnectFromDatabase(dbConnection);
@@ -637,7 +688,7 @@ function saveBusinessToDatabase(businessId) {
} }
console.log(`[Asshat.Business]: Saved business '${tempBusinessData.name}' to database!`); console.log(`[Asshat.Business]: Saved business '${tempBusinessData.name}' to database!`);
return false; return false;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -720,7 +771,7 @@ function createBusinessExitPickup(businessId) {
getBusinessData(businessId).exitPickup.dimension = getBusinessData(businessId).exitDimension; getBusinessData(businessId).exitPickup.dimension = getBusinessData(businessId).exitDimension;
//getBusinessData(businessId).exitPickup.interior = getBusinessData(businessId).exitInterior; //getBusinessData(businessId).exitPickup.interior = getBusinessData(businessId).exitInterior;
getBusinessData(businessId).exitPickup.setData("ag.owner.type", AG_PICKUP_BUSINESS_EXIT, false); getBusinessData(businessId).exitPickup.setData("ag.owner.type", AG_PICKUP_BUSINESS_EXIT, false);
getBusinessData(businessId).exitPickup.setData("ag.owner.id", businessId, false); getBusinessData(businessId).exitPickup.setData("ag.owner.id", businessId, false);
getBusinessData(businessId).exitPickup.setData("ag.label.type", AG_LABEL_EXIT, true); getBusinessData(businessId).exitPickup.setData("ag.label.type", AG_LABEL_EXIT, true);
addToWorld(getBusinessData(businessId).exitPickup); addToWorld(getBusinessData(businessId).exitPickup);
} }
@@ -756,7 +807,7 @@ function deleteBusiness(businessId, deletedBy = 0) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let dbQuery = null; let dbQuery = null;
if(dbConnection) { if(dbConnection) {
dbQuery = queryDatabase(dbConnection, `DELETE FROM biz_main WHERE biz_id = ${tempBusinessData.databaseId}`); dbQuery = queryDatabase(dbConnection, `DELETE FROM biz_main WHERE biz_id = ${tempBusinessData.databaseId}`);
if(dbQuery) { if(dbQuery) {
@@ -769,7 +820,7 @@ function deleteBusiness(businessId, deletedBy = 0) {
deleteBusinessExitPickup(businessId); deleteBusinessExitPickup(businessId);
deleteBusinessEntranceBlip(businessId); deleteBusinessEntranceBlip(businessId);
deleteBusinessExitBlip(businessId); deleteBusinessExitBlip(businessId);
removePlayersFromBusiness(businessId); removePlayersFromBusiness(businessId);
@@ -821,12 +872,12 @@ function getBusinessOwnerTypeText(ownerType) {
return "job"; return "job";
case AG_BIZOWNER_PLAYER: case AG_BIZOWNER_PLAYER:
return "player"; return "player";
case AG_BIZOWNER_NONE: case AG_BIZOWNER_NONE:
case AG_BIZOWNER_PUBLIC: case AG_BIZOWNER_PUBLIC:
return "not owned"; return "not owned";
default: default:
return "unknown"; return "unknown";
} }
@@ -849,34 +900,9 @@ function doesBusinessHaveInterior(businessId) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function sendAllBusinessLabelsToPlayer(client) {
let tempBusinessLabels = [];
let totalBusinesses = getServerData().businesses.length;
let businessesPerNetworkEvent = 100;
let totalNetworkEvents = Math.ceil(totalBusinesses/businessesPerNetworkEvent);
for(let i = 0 ; i < totalNetworkEvents ; i++) {
for(let j = 0 ; j < businessesPerNetworkEvent ; j++) {
let tempBusinessId = (i*businessesPerNetworkEvent)+j;
if(typeof getServerData().businesses[tempBusinessId] != "undefined") {
let tempBusinessLabels = [];
tempBusinessLabels.push([tempBusinessId, getServerData().businesses[tempBusinessId].entrancePosition, getGameConfig().propertyLabelHeight[getServerGame()], getServerData().businesses[tempBusinessId].description, getServerData().businesses[tempBusinessId].locked, false]);
}
}
triggerNetworkEvent("ag.bizlabel.all", client, tempBusinessLabels);
tempBusinessLabels = [];
}
}
// ---------------------------------------------------------------------------
function sendBusinessLabelToPlayers(businessId) {
triggerNetworkEvent("ag.bizlabel.add", null, businessId, getServerData().businesses[businessId].entrancePosition, getGameConfig().propertyLabelHeight[getServerGame()], getServerData().businesses[businessId].name, getServerData().businesses[businessId].locked, false);
}
// ---------------------------------------------------------------------------
function deleteBusinessEntrancePickup(businessId) { function deleteBusinessEntrancePickup(businessId) {
if(getBusinessData(businessId).entrancePickup) { if(getBusinessData(businessId).entrancePickup != null) {
removeFromWorld(getBusinessData(businessId).entrancePickup);
destroyElement(getBusinessData(businessId).entrancePickup); destroyElement(getBusinessData(businessId).entrancePickup);
getBusinessData(businessId).entrancePickup = false; getBusinessData(businessId).entrancePickup = false;
} }
@@ -885,16 +911,18 @@ function deleteBusinessEntrancePickup(businessId) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function deleteBusinessExitPickup(businessId) { function deleteBusinessExitPickup(businessId) {
if(getBusinessData(businessId).exitPickup) { if(getBusinessData(businessId).exitPickup != null) {
removeFromWorld(getBusinessData(businessId).exitPickup);
destroyElement(getBusinessData(businessId).exitPickup); destroyElement(getBusinessData(businessId).exitPickup);
getBusinessData(businessId).exitPickup = false; getBusinessData(businessId).exitPickup = false;
} }
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function deleteBusinessEntranceBlip(businessId) { function deleteBusinessEntranceBlip(businessId) {
if(getBusinessData(businessId).entranceBlip) { if(getBusinessData(businessId).entranceBlip != null) {
removeFromWorld(getBusinessData(businessId).entranceBlip);
destroyElement(getBusinessData(businessId).entranceBlip); destroyElement(getBusinessData(businessId).entranceBlip);
getBusinessData(businessId).entranceBlip = false; getBusinessData(businessId).entranceBlip = false;
} }
@@ -903,10 +931,11 @@ function deleteBusinessEntranceBlip(businessId) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function deleteBusinessExitBlip(businessId) { function deleteBusinessExitBlip(businessId) {
if(getBusinessData(businessId).exitBlip) { if(getBusinessData(businessId).exitBlip != null) {
removeFromWorld(getBusinessData(businessId).exitBlip);
destroyElement(getBusinessData(businessId).exitBlip); destroyElement(getBusinessData(businessId).exitBlip);
getBusinessData(businessId).exitBlip = false; getBusinessData(businessId).exitBlip = false;
} }
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -925,17 +954,13 @@ function reloadAllBusinessesCommand(command, params, client) {
deleteBusinessExitPickup(i); deleteBusinessExitPickup(i);
deleteBusinessEntrancePickup(i); deleteBusinessEntrancePickup(i);
} }
//forceAllPlayersToStopWorking(); //forceAllPlayersToStopWorking();
getServerData().businesses = null; getServerData().businesses = null;
getServerData().businesses = loadBusinessesFromDatabase(); getServerData().businesses = loadBusinessesFromDatabase();
createAllBusinessPickups(); createAllBusinessPickups();
createAllBusinessBlips(); createAllBusinessBlips();
for(let i in clients) {
sendAllBusinessLabelsToPlayer(clients[i]);
}
messageAdminAction(`All businesses have been reloaded by an admin!`); messageAdminAction(`All businesses have been reloaded by an admin!`);
} }

View File

@@ -68,7 +68,7 @@ function whisperCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
whisperToNearbyPlayers(client, params); whisperToNearbyPlayers(client, params);
return true; return true;
@@ -76,7 +76,7 @@ function whisperCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function adminChatCommand(command, params, client) { function adminChatCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
@@ -87,7 +87,7 @@ function adminChatCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function clanChatCommand(command, params, client) { function clanChatCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
@@ -115,7 +115,7 @@ function whisperToNearbyPlayers(client, messageText) {
//if(clients[i] != client) { //if(clients[i] != client) {
messagePlayerWhisper(getClientFromPlayerElement(clients[i]), client, messageText); messagePlayerWhisper(getClientFromPlayerElement(clients[i]), client, messageText);
//} //}
} }
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -23,7 +23,7 @@ function loadClansFromDatabase() {
let tempClans = []; let tempClans = [];
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let dbAssoc; let dbAssoc;
if(dbConnection) { if(dbConnection) {
let dbQuery = queryDatabase(dbConnection, `SELECT * FROM clan_main WHERE clan_deleted = 0 AND clan_server = ${getServerId()}`); let dbQuery = queryDatabase(dbConnection, `SELECT * FROM clan_main WHERE clan_deleted = 0 AND clan_server = ${getServerId()}`);
if(dbQuery) { if(dbQuery) {
@@ -88,7 +88,7 @@ function setClanOwnerCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("owner"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("owner"))) {
messagePlayerError(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)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
@@ -102,7 +102,7 @@ function setClanTagCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("clanTag"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("clanTag"))) {
messagePlayerError(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)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
@@ -116,7 +116,7 @@ function setClanNameCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("clanName"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("clanName"))) {
messagePlayerError(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)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
@@ -130,7 +130,7 @@ function setClanMemberTagCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("memberTag"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("memberTag"))) {
messagePlayerError(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)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
@@ -144,7 +144,7 @@ function setClanRankTagCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("rankTag"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("rankTag"))) {
messagePlayerError(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)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
@@ -174,7 +174,7 @@ function addClanMemberFlagCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("memberFlags"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("memberFlags"))) {
messagePlayerError(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)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
@@ -200,9 +200,9 @@ function addClanMemberFlagCommand(command, params, client) {
return false; return false;
} }
let flagValue = getClanFlagValue(splitParams[1]); let flagValue = getClanFlagValue(splitParams[1]);
getPlayerCurrentSubAccount(client).clanFlags = getPlayerCurrentSubAccount(client).clanFlags | flagValue; getPlayerCurrentSubAccount(client).clanFlags = getPlayerCurrentSubAccount(client).clanFlags | flagValue;
messagePlayerSuccess(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)}`);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -211,7 +211,7 @@ function removeClanMemberFlagCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("memberFlags"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("memberFlags"))) {
messagePlayerError(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)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
@@ -237,9 +237,9 @@ function removeClanMemberFlagCommand(command, params, client) {
return false; return false;
} }
let flagValue = getClanFlagValue(splitParams[1]); let flagValue = getClanFlagValue(splitParams[1]);
getPlayerCurrentSubAccount(client).clanFlags = getPlayerCurrentSubAccount(client).clanFlags & ~flagValue; getPlayerCurrentSubAccount(client).clanFlags = getPlayerCurrentSubAccount(client).clanFlags & ~flagValue;
messagePlayerSuccess(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)}`);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -248,7 +248,7 @@ function addClanRankFlagCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("rankFlags"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("rankFlags"))) {
messagePlayerError(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)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
@@ -272,12 +272,12 @@ function addClanRankFlagCommand(command, params, client) {
if(!getClanFlagValue(splitParams[1])) { if(!getClanFlagValue(splitParams[1])) {
messagePlayerError(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;
messagePlayerSuccess(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}`);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -286,7 +286,7 @@ function removeClanRankFlagCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("rankFlags"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("rankFlags"))) {
messagePlayerError(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)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
@@ -315,7 +315,7 @@ function removeClanRankFlagCommand(command, params, client) {
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;
messagePlayerSuccess(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}`);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -324,7 +324,7 @@ function setClanMemberTitleCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("memberTitle"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("memberTitle"))) {
messagePlayerError(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)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
@@ -347,7 +347,7 @@ function setClanMemberTitleCommand(command, params, client) {
let oldMemberTitle = getPlayerCurrentSubAccount(client).clanTitle; let oldMemberTitle = getPlayerCurrentSubAccount(client).clanTitle;
getPlayerCurrentSubAccount(client).clanTitle = params; getPlayerCurrentSubAccount(client).clanTitle = params;
messagePlayerSuccess(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}`);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -356,7 +356,7 @@ function setClanRankTitleCommand(command, params, client) {
if(!doesClientHaveClanPermission(client, getClanFlagValue("rankTitle"))) { if(!doesClientHaveClanPermission(client, getClanFlagValue("rankTitle"))) {
messagePlayerError(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)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
@@ -387,7 +387,7 @@ function setClanRankTitleCommand(command, params, client) {
function createClan(name) { function createClan(name) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let escapedName = name; let escapedName = name;
if(dbConnection) { if(dbConnection) {
escapedName = escapeDatabaseString(dbConnection, escapedName) escapedName = escapeDatabaseString(dbConnection, escapedName)
let dbQuery = queryDatabase(dbConnection, `INSERT INTO clan_main (clan_server, clan_name) VALUES (${getServerId()}, '${escapedName}')`); let dbQuery = queryDatabase(dbConnection, `INSERT INTO clan_main (clan_server, clan_name) VALUES (${getServerId()}, '${escapedName}')`);

View File

@@ -65,7 +65,7 @@ function initClassTable() {
bank: dbAssoc["svr_newchar_bank"], bank: dbAssoc["svr_newchar_bank"],
skin: dbAssoc["svr_newchar_skin"], skin: dbAssoc["svr_newchar_skin"],
}, },
this.connectCameraPosition = toVector3(dbAssoc["svr_connectcam_pos_x"], dbAssoc["svr_connectcam_pos_y"], dbAssoc["svr_connectcam_pos_z"]); this.connectCameraPosition = toVector3(dbAssoc["svr_connectcam_pos_x"], dbAssoc["svr_connectcam_pos_y"], dbAssoc["svr_connectcam_pos_z"]);
this.connectCameraLookAt = toVector3(dbAssoc["svr_connectcam_lookat_x"], dbAssoc["svr_connectcam_lookat_y"], dbAssoc["svr_connectcam_lookat_z"]); this.connectCameraLookAt = toVector3(dbAssoc["svr_connectcam_lookat_x"], dbAssoc["svr_connectcam_lookat_y"], dbAssoc["svr_connectcam_lookat_z"]);
this.hour = toInteger(dbAssoc["svr_start_time_hour"]); this.hour = toInteger(dbAssoc["svr_start_time_hour"]);
@@ -76,7 +76,7 @@ function initClassTable() {
this.useGUI = intToBool(dbAssoc["svr_gui"]); this.useGUI = intToBool(dbAssoc["svr_gui"]);
this.guiColour = [toInteger(dbAssoc["svr_gui_col1_r"]), toInteger(dbAssoc["svr_gui_col1_g"]), toInteger(dbAssoc["svr_gui_col1_b"])]; this.guiColour = [toInteger(dbAssoc["svr_gui_col1_r"]), toInteger(dbAssoc["svr_gui_col1_g"]), toInteger(dbAssoc["svr_gui_col1_b"])];
this.showLogo = intToBool(dbAssoc["svr_logo"]); this.showLogo = intToBool(dbAssoc["svr_logo"]);
this.antiCheat = { this.antiCheat = {
enabled: intToBool(dbAssoc["svr_ac_enabled"]), enabled: intToBool(dbAssoc["svr_ac_enabled"]),
checkGameScripts: intToBool(dbAssoc["svr_ac_check_scripts"]), checkGameScripts: intToBool(dbAssoc["svr_ac_check_scripts"]),
@@ -104,7 +104,7 @@ function initClassTable() {
this.garbageRoute = null; this.garbageRoute = null;
this.garbageRouteStop = null; this.garbageRouteStop = null;
this.garbageRouteIsland = null; this.garbageRouteIsland = null;
this.spawned = false; this.spawned = false;
this.rentingVehicle = false; this.rentingVehicle = false;
@@ -114,38 +114,59 @@ function initClassTable() {
this.returnToJobVehicleTick = 0; this.returnToJobVehicleTick = 0;
this.returnToJobVehicleTimer = null; this.returnToJobVehicleTimer = null;
this.switchingCharacter = false; this.switchingCharacter = false;
} }
}, },
accountData: class { accountData: class {
constructor(accountAssoc) { constructor(accountAssoc) {
if(!accountAssoc) { this.databaseId = 0;
return; this.name = "";
} this.password = "";
this.registerDate = 0;
this.databaseId = accountAssoc["acct_id"];
this.name = accountAssoc["acct_name"];
this.password = accountAssoc["acct_pass"];
this.registerDate = accountAssoc["acct_when_made"];
this.flags = { this.flags = {
moderation: accountAssoc["acct_mod_flags"], moderation: 0,
settings: accountAssoc["acct_settings"], settings: 0,
admin: accountAssoc["acct_staff_flags"], admin: 0,
}; };
this.staffTitle = accountAssoc["acct_staff_title"]; this.staffTitle = "";
this.ircAccount = accountAssoc["acct_irc"] || "None"; this.ircAccount = "";
this.discordAccount = accountAssoc["acct_discord"]; this.discordAccount = 0,
this.settings = accountAssoc["acct_settings"]; this.settings = 0,
this.emailAddress = accountAssoc["acct_email"]; this.emailAddress = "";
this.ipAddress = accountAssoc["ip"]; this.ipAddress = 0,
this.notes = []; this.notes = [];
this.messages = []; this.messages = [];
this.keyBinds = []; this.keyBinds = [];
this.contacts = []; this.contacts = [];
this.subAccounts = []; this.subAccounts = [];
this.loggedIn = false; this.loggedIn = false;
if(accountAssoc) {
this.databaseId = accountAssoc["acct_id"];
this.name = accountAssoc["acct_name"];
this.password = accountAssoc["acct_pass"];
this.registerDate = accountAssoc["acct_when_made"];
this.flags = {
moderation: accountAssoc["acct_mod_flags"],
settings: accountAssoc["acct_settings"],
admin: accountAssoc["acct_staff_flags"],
};
this.staffTitle = accountAssoc["acct_staff_title"];
this.ircAccount = accountAssoc["acct_irc"] || "None";
this.discordAccount = accountAssoc["acct_discord"];
this.settings = accountAssoc["acct_settings"];
this.emailAddress = accountAssoc["acct_email"];
this.ipAddress = accountAssoc["ipstring"];
this.notes = [];
this.messages = [];
this.keyBinds = [];
this.contacts = [];
this.subAccounts = [];
this.loggedIn = false;
}
} }
}, },
accountContactData: class { accountContactData: class {
@@ -153,7 +174,7 @@ function initClassTable() {
if(!accountContactAssoc) { if(!accountContactAssoc) {
return; return;
} }
this.databaseId = accountContactAssoc["acct_contact_id"]; this.databaseId = accountContactAssoc["acct_contact_id"];
this.accountId = accountContactAssoc["acct_contact_acct"]; this.accountId = accountContactAssoc["acct_contact_acct"];
this.contactAccountId = accountContactAssoc["acct_contact_contact"]; this.contactAccountId = accountContactAssoc["acct_contact_contact"];
@@ -166,7 +187,7 @@ function initClassTable() {
if(!accountMessageAssoc) { if(!accountMessageAssoc) {
return; return;
} }
this.databaseId = accountMessageAssoc["acct_msg_id"]; this.databaseId = accountMessageAssoc["acct_msg_id"];
this.account = accountMessageAssoc["acct_msg_acct"]; this.account = accountMessageAssoc["acct_msg_acct"];
this.whoSent = accountMessageAssoc["acct_msg_who_sent"]; this.whoSent = accountMessageAssoc["acct_msg_who_sent"];
@@ -177,13 +198,13 @@ function initClassTable() {
this.folder = accountMessageAssoc["acct_msg_folder"]; this.folder = accountMessageAssoc["acct_msg_folder"];
this.message = accountMessageAssoc["acct_msg_message"]; this.message = accountMessageAssoc["acct_msg_message"];
} }
}, },
accountStaffNoteData: class { accountStaffNoteData: class {
constructor(accountStaffNoteAssoc) { constructor(accountStaffNoteAssoc) {
if(!accountStaffNoteAssoc) { if(!accountStaffNoteAssoc) {
return; return;
} }
this.databaseId = accountStaffNoteAssoc["acct_note_id"]; this.databaseId = accountStaffNoteAssoc["acct_note_id"];
this.account = accountStaffNoteAssoc["acct_note_acct"]; this.account = accountStaffNoteAssoc["acct_note_acct"];
this.whoAdded = accountStaffNoteAssoc["acct_note_who_added"]; this.whoAdded = accountStaffNoteAssoc["acct_note_who_added"];
@@ -193,13 +214,13 @@ function initClassTable() {
this.server = accountMessageAssoc["acct_note_server"]; this.server = accountMessageAssoc["acct_note_server"];
this.note = accountMessageAssoc["acct_note_message"]; this.note = accountMessageAssoc["acct_note_message"];
} }
}, },
subAccountData: class { subAccountData: class {
constructor(subAccountAssoc) { constructor(subAccountAssoc) {
if(!subAccountAssoc) { if(!subAccountAssoc) {
return; return;
} }
this.databaseId = subAccountAssoc["sacct_id"]; this.databaseId = subAccountAssoc["sacct_id"];
this.server = subAccountAssoc["sacct_server"]; this.server = subAccountAssoc["sacct_server"];
this.firstName = subAccountAssoc["sacct_name_first"]; this.firstName = subAccountAssoc["sacct_name_first"];
@@ -225,11 +246,11 @@ function initClassTable() {
this.weapons = []; this.weapons = [];
this.inJail = false; this.inJail = false;
this.interior = 0; this.interior = 0;
this.dimension = 0; this.dimension = 0;
} }
}, },
businessData: class { businessData: class {
constructor(businessAssoc) { constructor(businessAssoc) {
this.databaseId = 0; this.databaseId = 0;
@@ -248,7 +269,7 @@ function initClassTable() {
this.entranceBlipModel = -1; this.entranceBlipModel = -1;
this.entrancePickup = null; this.entrancePickup = null;
this.entranceBlip = null; this.entranceBlip = null;
this.exitPosition = false; this.exitPosition = false;
this.exitRotation = 0.0; this.exitRotation = 0.0;
this.exitInterior = 0; this.exitInterior = 0;
@@ -269,25 +290,21 @@ function initClassTable() {
this.buyPrice = toInteger(businessAssoc["biz_buy_price"]); this.buyPrice = toInteger(businessAssoc["biz_buy_price"]);
this.locked = intToBool(toInteger(businessAssoc["biz_locked"])); this.locked = intToBool(toInteger(businessAssoc["biz_locked"]));
this.hasInterior = intToBool(toInteger(businessAssoc["biz_has_interior"])); this.hasInterior = intToBool(toInteger(businessAssoc["biz_has_interior"]));
this.entrancePosition = toVector3(toFloat(businessAssoc["biz_entrance_pos_x"]), toFloat(businessAssoc["biz_entrance_pos_y"]), toFloat(businessAssoc["biz_entrance_pos_z"])); this.entrancePosition = toVector3(toFloat(businessAssoc["biz_entrance_pos_x"]), toFloat(businessAssoc["biz_entrance_pos_y"]), toFloat(businessAssoc["biz_entrance_pos_z"]));
this.entranceRotation = toInteger(businessAssoc["biz_entrance_rot_z"]); this.entranceRotation = toInteger(businessAssoc["biz_entrance_rot_z"]);
this.entranceInterior = toInteger(businessAssoc["biz_entrance_int"]); this.entranceInterior = toInteger(businessAssoc["biz_entrance_int"]);
this.entranceDimension = toInteger(businessAssoc["biz_entrance_vw"]); this.entranceDimension = toInteger(businessAssoc["biz_entrance_vw"]);
this.entrancePickupModel = toInteger(businessAssoc["biz_entrance_pickup"]); this.entrancePickupModel = toInteger(businessAssoc["biz_entrance_pickup"]);
this.entranceBlipModel = toInteger(businessAssoc["biz_entrance_blip"]); this.entranceBlipModel = toInteger(businessAssoc["biz_entrance_blip"]);
this.entrancePickup = null;
this.entrancePickup = null;
this.exitPosition = toVector3(businessAssoc["biz_exit_pos_x"], businessAssoc["biz_exit_pos_y"], businessAssoc["biz_exit_pos_z"]); this.exitPosition = toVector3(businessAssoc["biz_exit_pos_x"], businessAssoc["biz_exit_pos_y"], businessAssoc["biz_exit_pos_z"]);
this.exitRotation = toInteger(businessAssoc["biz_exit_rot_z"]); this.exitRotation = toInteger(businessAssoc["biz_exit_rot_z"]);
this.exitInterior = toInteger(businessAssoc["biz_exit_int"]); this.exitInterior = toInteger(businessAssoc["biz_exit_int"]);
this.exitDimension = toInteger(businessAssoc["biz_exit_vw"]); this.exitDimension = toInteger(businessAssoc["biz_exit_vw"]);
this.exitPickupModel = toInteger(businessAssoc["biz_exit_pickup"]); this.exitPickupModel = toInteger(businessAssoc["biz_exit_pickup"]);
this.exitBlipModel = toInteger(businessAssoc["biz_exit_blip"]); this.exitBlipModel = toInteger(businessAssoc["biz_exit_blip"]);
this.exitPickup = null;
this.exitBlip = null;
this.entranceFee = toInteger(businessAssoc["biz_entrance_fee"]); this.entranceFee = toInteger(businessAssoc["biz_entrance_fee"]);
this.till = toInteger(businessAssoc["biz_till"]); this.till = toInteger(businessAssoc["biz_till"]);
} }
@@ -319,7 +336,7 @@ function initClassTable() {
this.buyPrice = 0; this.buyPrice = 0;
this.locked = false; this.locked = false;
this.hasInterior = false; this.hasInterior = false;
this.entrancePosition = false; this.entrancePosition = false;
this.entranceRotation = 0.0; this.entranceRotation = 0.0;
this.entranceInterior = 0; this.entranceInterior = 0;
@@ -328,7 +345,7 @@ function initClassTable() {
this.entranceBlipModel = -1; this.entranceBlipModel = -1;
this.entrancePickup = null; this.entrancePickup = null;
this.entranceBlip = null; this.entranceBlip = null;
this.exitPosition = false; this.exitPosition = false;
this.exitRotation = 0.0; this.exitRotation = 0.0;
this.exitInterior = 0; this.exitInterior = 0;
@@ -346,24 +363,20 @@ function initClassTable() {
this.buyPrice = toInteger(houseAssoc["house_buy_price"]); this.buyPrice = toInteger(houseAssoc["house_buy_price"]);
this.locked = intToBool(toInteger(houseAssoc["house_locked"])); this.locked = intToBool(toInteger(houseAssoc["house_locked"]));
this.hasInterior = intToBool(toInteger(houseAssoc["house_has_interior"])); this.hasInterior = intToBool(toInteger(houseAssoc["house_has_interior"]));
this.entrancePosition = toVector3(toFloat(houseAssoc["house_entrance_pos_x"]), toFloat(houseAssoc["house_entrance_pos_y"]), toFloat(houseAssoc["house_entrance_pos_z"])); this.entrancePosition = toVector3(toFloat(houseAssoc["house_entrance_pos_x"]), toFloat(houseAssoc["house_entrance_pos_y"]), toFloat(houseAssoc["house_entrance_pos_z"]));
this.entranceRotation = toFloat(houseAssoc["house_entrance_rot_z"]); this.entranceRotation = toFloat(houseAssoc["house_entrance_rot_z"]);
this.entranceInterior = toInteger(houseAssoc["house_entrance_int"]); this.entranceInterior = toInteger(houseAssoc["house_entrance_int"]);
this.entranceDimension = toInteger(houseAssoc["house_entrance_vw"]); this.entranceDimension = toInteger(houseAssoc["house_entrance_vw"]);
this.entrancePickupModel = toInteger(houseAssoc["house_entrance_pickup"]); this.entrancePickupModel = toInteger(houseAssoc["house_entrance_pickup"]);
this.entranceBlipModel = toInteger(houseAssoc["house_entrance_blip"]); this.entranceBlipModel = toInteger(houseAssoc["house_entrance_blip"]);
this.entrancePickup = null;
this.entranceBlip = null;
this.exitPosition = toVector3(toFloat(houseAssoc["house_exit_pos_x"]), toFloat(houseAssoc["house_exit_pos_y"]), toFloat(houseAssoc["house_exit_pos_z"])); this.exitPosition = toVector3(toFloat(houseAssoc["house_exit_pos_x"]), toFloat(houseAssoc["house_exit_pos_y"]), toFloat(houseAssoc["house_exit_pos_z"]));
this.exitRotation = toFloat(houseAssoc["house_exit_rot_z"]); this.exitRotation = toFloat(houseAssoc["house_exit_rot_z"]);
this.exitInterior = toInteger(houseAssoc["house_exit_int"]); this.exitInterior = toInteger(houseAssoc["house_exit_int"]);
this.exitDimension = toInteger(houseAssoc["house_exit_vw"]); this.exitDimension = toInteger(houseAssoc["house_exit_vw"]);
this.exitPickupModel = toInteger(houseAssoc["house_exit_pickup"]); this.exitPickupModel = toInteger(houseAssoc["house_exit_pickup"]);
this.exitBlipModel = toInteger(houseAssoc["house_exit_blip"]); this.exitBlipModel = toInteger(houseAssoc["house_exit_blip"]);
this.exitPickup = null;
this.exitBlip = null;
} }
} }
}, },
@@ -380,32 +393,32 @@ function initClassTable() {
this.server = getServerId(); this.server = getServerId();
this.model = (vehicle != false) ? vehicle.modelIndex : 0; this.model = (vehicle != false) ? vehicle.modelIndex : 0;
this.vehicle = vehicle; this.vehicle = vehicle;
// Ownership // Ownership
this.ownerType = AG_VEHOWNER_NONE; this.ownerType = AG_VEHOWNER_NONE;
this.ownerId = 0; this.ownerId = 0;
this.buyPrice = 0; this.buyPrice = 0;
this.rentPrice = 0; this.rentPrice = 0;
this.rentedBy = false; this.rentedBy = false;
this.rentStart = 0; this.rentStart = 0;
// Position and Rotation // Position and Rotation
this.spawnPosition = (vehicle) ? vehicle.position : toVector3(0.0, 0.0, 0.0); this.spawnPosition = (vehicle) ? vehicle.position : toVector3(0.0, 0.0, 0.0);
this.spawnRotation = (vehicle) ? vehicle.heading : 0.0; this.spawnRotation = (vehicle) ? vehicle.heading : 0.0;
this.spawnLocked = false; this.spawnLocked = false;
// Colour Info // Colour Info
this.colour1IsRGBA = 0; this.colour1IsRGBA = 0;
this.colour2IsRGBA = 0; this.colour2IsRGBA = 0;
this.colour3IsRGBA = 0; this.colour3IsRGBA = 0;
this.colour4IsRGBA = 0; this.colour4IsRGBA = 0;
this.colour1RGBA = toColour(255, 255, 255, 255); this.colour1RGBA = toColour(255, 255, 255, 255);
this.colour2RGBA = toColour(255, 255, 255, 255); this.colour2RGBA = toColour(255, 255, 255, 255);
this.colour3RGBA = toColour(255, 255, 255, 255); this.colour3RGBA = toColour(255, 255, 255, 255);
this.colour4RGBA = toColour(255, 255, 255, 255); this.colour4RGBA = toColour(255, 255, 255, 255);
this.colour1 = (vehicle) ? vehicle.colour1 : 1; this.colour1 = (vehicle) ? vehicle.colour1 : 1;
this.colour2 = (vehicle) ? vehicle.colour2 : 1; this.colour2 = (vehicle) ? vehicle.colour2 : 1;
this.colour3 = (vehicle) ? vehicle.colour3 : 1; this.colour3 = (vehicle) ? vehicle.colour3 : 1;
this.colour4 = (vehicle) ? vehicle.colour4 : 1; this.colour4 = (vehicle) ? vehicle.colour4 : 1;
// Vehicle Attributes // Vehicle Attributes
@@ -416,37 +429,37 @@ function initClassTable() {
this.engineDamage = 0; this.engineDamage = 0;
this.visualDamage = 0; this.visualDamage = 0;
this.dirtLevel = 0; this.dirtLevel = 0;
if(vehicleAssoc) { if(vehicleAssoc) {
// General Info // General Info
this.databaseId = toInteger(vehicleAssoc["veh_id"]); this.databaseId = toInteger(vehicleAssoc["veh_id"]);
this.server = toInteger(vehicleAssoc["veh_server"]); this.server = toInteger(vehicleAssoc["veh_server"]);
this.model = toInteger(vehicleAssoc["veh_model"]); this.model = toInteger(vehicleAssoc["veh_model"]);
// Ownership // Ownership
this.ownerType = toInteger(vehicleAssoc["veh_owner_type"]); this.ownerType = toInteger(vehicleAssoc["veh_owner_type"]);
this.ownerId = toInteger(vehicleAssoc["veh_owner_id"]); this.ownerId = toInteger(vehicleAssoc["veh_owner_id"]);
this.buyPrice = toInteger(vehicleAssoc["veh_buy_price"]); this.buyPrice = toInteger(vehicleAssoc["veh_buy_price"]);
this.rentPrice = toInteger(vehicleAssoc["veh_buy_price"]); this.rentPrice = toInteger(vehicleAssoc["veh_buy_price"]);
// Position and Rotation // Position and Rotation
this.spawnPosition = toVector3(vehicleAssoc["veh_pos_x"], vehicleAssoc["veh_pos_y"], vehicleAssoc["veh_pos_z"]); this.spawnPosition = toVector3(vehicleAssoc["veh_pos_x"], vehicleAssoc["veh_pos_y"], vehicleAssoc["veh_pos_z"]);
this.spawnRotation = toInteger(vehicleAssoc["veh_rot_z"]); this.spawnRotation = toInteger(vehicleAssoc["veh_rot_z"]);
this.spawnLocked = intToBool(toInteger(vehicleAssoc["veh_spawn_lock"])); this.spawnLocked = intToBool(toInteger(vehicleAssoc["veh_spawn_lock"]));
// Colour Info // Colour Info
this.colour1IsRGBA = intToBool(toInteger(vehicleAssoc["veh_col1_isrgba"])); this.colour1IsRGBA = intToBool(toInteger(vehicleAssoc["veh_col1_isrgba"]));
this.colour2IsRGBA = intToBool(toInteger(vehicleAssoc["veh_col2_isrgba"])); this.colour2IsRGBA = intToBool(toInteger(vehicleAssoc["veh_col2_isrgba"]));
this.colour3IsRGBA = intToBool(toInteger(vehicleAssoc["veh_col3_isrgba"])); this.colour3IsRGBA = intToBool(toInteger(vehicleAssoc["veh_col3_isrgba"]));
this.colour4IsRGBA = intToBool(toInteger(vehicleAssoc["veh_col4_isrgba"])); this.colour4IsRGBA = intToBool(toInteger(vehicleAssoc["veh_col4_isrgba"]));
this.colour1RGBA = toColour(toInteger(vehicleAssoc["veh_col1_r"]), toInteger(vehicleAssoc["veh_col1_g"]), toInteger(vehicleAssoc["veh_col1_b"]), toInteger(vehicleAssoc["veh_col1_a"])); this.colour1RGBA = toColour(toInteger(vehicleAssoc["veh_col1_r"]), toInteger(vehicleAssoc["veh_col1_g"]), toInteger(vehicleAssoc["veh_col1_b"]), toInteger(vehicleAssoc["veh_col1_a"]));
this.colour2RGBA = toColour(toInteger(vehicleAssoc["veh_col2_r"]), toInteger(vehicleAssoc["veh_col2_g"]), toInteger(vehicleAssoc["veh_col2_b"]), toInteger(vehicleAssoc["veh_col2_a"])); this.colour2RGBA = toColour(toInteger(vehicleAssoc["veh_col2_r"]), toInteger(vehicleAssoc["veh_col2_g"]), toInteger(vehicleAssoc["veh_col2_b"]), toInteger(vehicleAssoc["veh_col2_a"]));
this.colour3RGBA = toColour(toInteger(vehicleAssoc["veh_col3_r"]), toInteger(vehicleAssoc["veh_col3_g"]), toInteger(vehicleAssoc["veh_col3_b"]), toInteger(vehicleAssoc["veh_col3_a"])); this.colour3RGBA = toColour(toInteger(vehicleAssoc["veh_col3_r"]), toInteger(vehicleAssoc["veh_col3_g"]), toInteger(vehicleAssoc["veh_col3_b"]), toInteger(vehicleAssoc["veh_col3_a"]));
this.colour4RGBA = toColour(toInteger(vehicleAssoc["veh_col4_r"]), toInteger(vehicleAssoc["veh_col4_g"]), toInteger(vehicleAssoc["veh_col4_b"]), toInteger(vehicleAssoc["veh_col4_a"])); this.colour4RGBA = toColour(toInteger(vehicleAssoc["veh_col4_r"]), toInteger(vehicleAssoc["veh_col4_g"]), toInteger(vehicleAssoc["veh_col4_b"]), toInteger(vehicleAssoc["veh_col4_a"]));
this.colour1 = toInteger(vehicleAssoc["veh_col1"]); this.colour1 = toInteger(vehicleAssoc["veh_col1"]);
this.colour2 = toInteger(vehicleAssoc["veh_col2"]); this.colour2 = toInteger(vehicleAssoc["veh_col2"]);
this.colour3 = toInteger(vehicleAssoc["veh_col3"]); this.colour3 = toInteger(vehicleAssoc["veh_col3"]);
this.colour4 = toInteger(vehicleAssoc["veh_col4"]); this.colour4 = toInteger(vehicleAssoc["veh_col4"]);
// Vehicle Attributes // Vehicle Attributes
this.locked = intToBool(toInteger(vehicleAssoc["veh_locked"])); this.locked = intToBool(toInteger(vehicleAssoc["veh_locked"]));
@@ -526,7 +539,7 @@ function initClassTable() {
this.colour = toColour(jobAssoc["job_colour_r"], jobAssoc["job_colour_g"], jobAssoc["job_colour_b"], 255); this.colour = toColour(jobAssoc["job_colour_r"], jobAssoc["job_colour_g"], jobAssoc["job_colour_b"], 255);
this.whiteListEnabled = jobAssoc["job_whitelist"]; this.whiteListEnabled = jobAssoc["job_whitelist"];
this.blackListEnabled = jobAssoc["job_blacklist"]; this.blackListEnabled = jobAssoc["job_blacklist"];
this.equipment = []; this.equipment = [];
this.uniforms = []; this.uniforms = [];
this.locations = []; this.locations = [];
@@ -584,8 +597,8 @@ function initClassTable() {
this.name = jobUniformAssoc["job_uniform_name"]; this.name = jobUniformAssoc["job_uniform_name"];
this.requiredRank = jobUniformAssoc["job_uniform_minrank"]; this.requiredRank = jobUniformAssoc["job_uniform_minrank"];
this.skin = jobUniformAssoc["job_uniform_skin"]; this.skin = jobUniformAssoc["job_uniform_skin"];
this.enabled = jobUniformAssoc["job_uniform_skin"]; this.enabled = jobUniformAssoc["job_uniform_skin"];
} }
} }
}, },
jobLocationData: class { jobLocationData: class {
@@ -640,7 +653,7 @@ function initClassTable() {
this.enabled = jobBlackListAssoc["job_bl_enabled"]; this.enabled = jobBlackListAssoc["job_bl_enabled"];
} }
} }
}, },
keyBindData: class { keyBindData: class {
constructor(keyBindAssoc, key = 0, commandString = "") { constructor(keyBindAssoc, key = 0, commandString = "") {
this.databaseId = 0; this.databaseId = 0;
@@ -678,7 +691,7 @@ function initClassTable() {
if(!dbAssoc) { if(!dbAssoc) {
return; return;
} }
this.databaseId = dbAssoc["ac_script_wl_id"]; this.databaseId = dbAssoc["ac_script_wl_id"];
this.enabled = intToBool(dbAssoc["ac_script_wl_enabled"]); this.enabled = intToBool(dbAssoc["ac_script_wl_enabled"]);
this.server = dbAssoc["ac_script_wl_server"]; this.server = dbAssoc["ac_script_wl_server"];
@@ -692,21 +705,27 @@ function initClassTable() {
this.range = range; this.range = range;
} }
}, },
interiorTemplateData: class {
constructor(exitPosition, interior) {
this.exitPosition = exitPosition;
this.interior = interior;
}
},
} }
return tempClasses; return tempClasses;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function getClasses() { function getClasses() {
return serverClasses; return serverClasses;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function getClass(className) { function getClass(className) {
return serverClasses[className]; return serverClasses[className];
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -17,10 +17,10 @@ addNetworkHandler("ag.promptAnswerNo", function(client) {
switch(getEntityData(client, "ag.prompt")) { switch(getEntityData(client, "ag.prompt")) {
case AG_PROMPT_CREATEFIRSTCHAR: case AG_PROMPT_CREATEFIRSTCHAR:
triggerNetworkEvent("ag.showError", client, "You don't have a character to play. Goodbye!", "No Characters"); triggerNetworkEvent("ag.showError", client, "You don't have a character to play. Goodbye!", "No Characters");
setTimeout(function() { client.disconnect(); }, 5000); setTimeout(function() { client.disconnect(); }, 5000);
break; break;
default: default:
break; break;
} }
@@ -38,8 +38,8 @@ addNetworkHandler("ag.promptAnswerYes", function(client) {
switch(getEntityData(client, "ag.prompt")) { switch(getEntityData(client, "ag.prompt")) {
case AG_PROMPT_CREATEFIRSTCHAR: case AG_PROMPT_CREATEFIRSTCHAR:
triggerNetworkEvent("ag.showNewCharacter", client); triggerNetworkEvent("ag.showNewCharacter", client);
break; break;
default: default:
break; break;
} }
@@ -79,28 +79,28 @@ addNetworkHandler("ag.afk", function(client, afkState) {
// Not implemented yet // Not implemented yet
addNetworkHandler("ag.heldKey", function(client, key) { addNetworkHandler("ag.heldKey", function(client, key) {
switch(key) { switch(key) {
case getGlobalConfig().keybinds.actionKey: case getGlobalConfig().keybinds.actionKey:
processHoldActionKey(client); processHoldActionKey(client);
break; break;
case getGlobalConfig().keybinds.vehicleLightsKey: case getGlobalConfig().keybinds.vehicleLightsKey:
processHoldVehicleLightsKey(client); processHoldVehicleLightsKey(client);
break; break;
case getGlobalConfig().keybinds.vehicleLockKey: case getGlobalConfig().keybinds.vehicleLockKey:
processHoldVehicleLockKey(client); processHoldVehicleLockKey(client);
break; break;
case getGlobalConfig().keybinds.vehicleEngineKey: case getGlobalConfig().keybinds.vehicleEngineKey:
processHoldVehicleEngineKey(client); processHoldVehicleEngineKey(client);
break; break;
} }
}); });
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
addNetworkHandler("ag.player.death", function(client, position, heading) { addNetworkHandler("ag.player.death", function(client, position) {
processPlayerDeath(client); processPlayerDeath(client, position);
}); });
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -143,6 +143,13 @@ addNetworkHandler("ag.clientReady", function(client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
addNetworkHandler("ag.guiReady", function(client) {
client.setData("ag.guiReady", true, false);
console.log(`${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
});
// ---------------------------------------------------------------------------
addNetworkHandler("ag.clientStarted", function(client) { addNetworkHandler("ag.clientStarted", function(client) {
client.setData("ag.isStarted", true, false); client.setData("ag.isStarted", true, false);
console.log(`${getPlayerDisplayForConsole(client)}'s client resources are started and running!`); console.log(`${getPlayerDisplayForConsole(client)}'s client resources are started and running!`);

View File

@@ -37,7 +37,7 @@ function loadCommandData() {
ban: [ ban: [
commandData("aban", accountBanCommand, "<player name/id> <reason>", getStaffFlagValue("manageBans"), true, true), commandData("aban", accountBanCommand, "<player name/id> <reason>", getStaffFlagValue("manageBans"), true, true),
commandData("saban", subAccountBanCommand, "<player name/id> <reason>", getStaffFlagValue("manageBans"), true, true), commandData("saban", subAccountBanCommand, "<player name/id> <reason>", getStaffFlagValue("manageBans"), true, true),
commandData("ipban", ipBanCommand, "<player name/id> <reason>", getStaffFlagValue("manageBans"), true, true), commandData("ipban", ipBanCommand, "<player name/id> <reason>", getStaffFlagValue("manageBans"), true, true),
], ],
bitFlag: [], bitFlag: [],
business: [ business: [
@@ -59,6 +59,7 @@ function loadCommandData() {
commandData("bizinfo", getBusinessInfoCommand, "[id]", getStaffFlagValue("none"), true, true), commandData("bizinfo", getBusinessInfoCommand, "[id]", getStaffFlagValue("none"), true, true),
commandData("bizentrance", moveBusinessEntranceCommand, "", getStaffFlagValue("manageBusinesses"), true, true), commandData("bizentrance", moveBusinessEntranceCommand, "", getStaffFlagValue("manageBusinesses"), true, true),
commandData("bizexit", moveBusinessExitCommand, "", getStaffFlagValue("manageBusinesses"), true, true), commandData("bizexit", moveBusinessExitCommand, "", getStaffFlagValue("manageBusinesses"), true, true),
commandData("bizinttype", setBusinessInteriorTypeCommand, "<interior template name/business id>", getStaffFlagValue("manageBusinesses"), true, true),
], ],
chat: [ chat: [
commandData("me", meActionCommand, "<message>", getStaffFlagValue("none"), true, false), commandData("me", meActionCommand, "<message>", getStaffFlagValue("none"), true, false),
@@ -69,19 +70,19 @@ function loadCommandData() {
commandData("local", talkCommand, "<message>", getStaffFlagValue("none"), true, false), commandData("local", talkCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("l", talkCommand, "<message>", getStaffFlagValue("none"), true, false), commandData("l", talkCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("w", whisperCommand, "<message>", getStaffFlagValue("none"), true, false), commandData("w", whisperCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("whisper", whisperCommand, "<message>", getStaffFlagValue("none"), true, false), commandData("whisper", whisperCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("clanchat", clanChatCommand, "<message>", getStaffFlagValue("none"), true, false), commandData("clanchat", clanChatCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("clan", clanChatCommand, "<message>", getStaffFlagValue("none"), true, false), commandData("clan", clanChatCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("c", clanChatCommand, "<message>", getStaffFlagValue("none"), true, false), commandData("c", clanChatCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("adminchat", adminChatCommand, "<message>", getStaffFlagValue("basicModeration"), true, true), commandData("adminchat", adminChatCommand, "<message>", getStaffFlagValue("basicModeration"), true, true),
commandData("a", adminChatCommand, "<message>", getStaffFlagValue("basicModeration"), true, true), commandData("a", adminChatCommand, "<message>", getStaffFlagValue("basicModeration"), true, true),
commandData("achat", adminChatCommand, "<message>", getStaffFlagValue("basicModeration"), true, true), commandData("achat", adminChatCommand, "<message>", getStaffFlagValue("basicModeration"), true, true),
], ],
clan: [ clan: [
commandData("addclan", createClanCommand, "<name>", getStaffFlagValue("manageClans"), true, true), commandData("addclan", createClanCommand, "<name>", getStaffFlagValue("manageClans"), true, true),
commandData("delclan", deleteClanCommand, "<clan id>", getStaffFlagValue("manageClans"), true, true), commandData("delclan", deleteClanCommand, "<clan id>", getStaffFlagValue("manageClans"), true, true),
commandData("clanowner", setClanOwnerCommand, "<clan id> <player name/id>", getStaffFlagValue("none"), true, true), commandData("clanowner", setClanOwnerCommand, "<clan id> <player name/id>", getStaffFlagValue("none"), true, true),
commandData("clantag", setClanTagCommand, "<tag>", getStaffFlagValue("none"), true, true), commandData("clantag", setClanTagCommand, "<tag>", getStaffFlagValue("none"), true, true),
commandData("clanranktag", setClanRankTagCommand, "<rank id> <tag>", getStaffFlagValue("none"), true, true), commandData("clanranktag", setClanRankTagCommand, "<rank id> <tag>", getStaffFlagValue("none"), true, true),
commandData("clanmembertag", setClanMemberTagCommand, "<player name/id> <tag>", getStaffFlagValue("none"), true, true), commandData("clanmembertag", setClanMemberTagCommand, "<player name/id> <tag>", getStaffFlagValue("none"), true, true),
@@ -89,8 +90,8 @@ function loadCommandData() {
commandData("clanmembertitle", setClanMemberTitleCommand, "<player name/id> <title>", getStaffFlagValue("none"), true, true), commandData("clanmembertitle", setClanMemberTitleCommand, "<player name/id> <title>", getStaffFlagValue("none"), true, true),
commandData("addrankflag", addClanRankFlagCommand, "<rank name/id> <flag name>", getStaffFlagValue("none"), true, true), commandData("addrankflag", addClanRankFlagCommand, "<rank name/id> <flag name>", getStaffFlagValue("none"), true, true),
commandData("delrankflag", removeClanRankFlagCommand, "<rank name/id> <flag name>", getStaffFlagValue("none"), true, true), commandData("delrankflag", removeClanRankFlagCommand, "<rank name/id> <flag name>", getStaffFlagValue("none"), true, true),
commandData("addmemberflag", addClanMemberFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("none"), true, true), commandData("addmemberflag", addClanMemberFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("none"), true, true),
commandData("delmemberflag", removeClanMemberFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("none"), true, true), commandData("delmemberflag", removeClanMemberFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("none"), true, true),
], ],
class: [], class: [],
client: [], client: [],
@@ -105,18 +106,18 @@ function loadCommandData() {
commandData("settime", setTimeCommand, "<hour> [minute]", getStaffFlagValue("manageServer"), true, true), commandData("settime", setTimeCommand, "<hour> [minute]", getStaffFlagValue("manageServer"), true, true),
commandData("setweather", setWeatherCommand, "<weather id/name>", getStaffFlagValue("manageServer"), true, true), commandData("setweather", setWeatherCommand, "<weather id/name>", getStaffFlagValue("manageServer"), true, true),
commandData("setsnow", setSnowingCommand, "<falling snow> <ground snow>", getStaffFlagValue("manageServer"), true, true), commandData("setsnow", setSnowingCommand, "<falling snow> <ground snow>", getStaffFlagValue("manageServer"), true, true),
commandData("setlogo", toggleServerLogoCommand, "<0/1 state>", getStaffFlagValue("manageServer"), true, true), commandData("setlogo", toggleServerLogoCommand, "<0/1 state>", getStaffFlagValue("manageServer"), true, true),
commandData("setgui", toggleServerGUICommand, "<0/1 state>", getStaffFlagValue("manageServer"), true, true), commandData("setgui", toggleServerGUICommand, "<0/1 state>", getStaffFlagValue("manageServer"), true, true),
commandData("newcharspawn", setNewCharacterSpawnPositionCommand, "", getStaffFlagValue("manageServer"), true, true), commandData("newcharspawn", setNewCharacterSpawnPositionCommand, "", getStaffFlagValue("manageServer"), true, true),
commandData("newcharcash", setNewCharacterMoneyCommand, "<amount>", getStaffFlagValue("manageServer"), true, true), commandData("newcharcash", setNewCharacterMoneyCommand, "<amount>", getStaffFlagValue("manageServer"), true, true),
commandData("newcharskin", setNewCharacterSkinCommand, "[skin id]", getStaffFlagValue("manageServer"), true, true), commandData("newcharskin", setNewCharacterSkinCommand, "[skin id]", getStaffFlagValue("manageServer"), true, true),
commandData("jobinfo", getJobInfoCommand, "", getStaffFlagValue("none"), true, true), commandData("jobinfo", getJobInfoCommand, "", getStaffFlagValue("none"), true, true),
commandData("joblocinfo", getJobLocationInfoCommand, "", getStaffFlagValue("none"), true, true), commandData("joblocinfo", getJobLocationInfoCommand, "", getStaffFlagValue("none"), true, true),
], ],
core: [], core: [],
database: [], database: [],
developer: [ developer: [
commandData("scode", executeServerCodeCommand, "<code>", getStaffFlagValue("developer"), true, true), commandData("scode", executeServerCodeCommand, "<code>", getStaffFlagValue("developer"), true, true),
commandData("ccode", executeClientCodeCommand, "<code>", getStaffFlagValue("developer"), true, true), commandData("ccode", executeClientCodeCommand, "<code>", getStaffFlagValue("developer"), true, true),
commandData("gmx", restartGameModeCommand, "", getStaffFlagValue("developer"), true, true), commandData("gmx", restartGameModeCommand, "", getStaffFlagValue("developer"), true, true),
commandData("saveall", saveAllServerDataCommand, "", getStaffFlagValue("developer"), true, true), commandData("saveall", saveAllServerDataCommand, "", getStaffFlagValue("developer"), true, true),
@@ -141,7 +142,8 @@ function loadCommandData() {
commandData("housepickup", setHousePickupCommand, "<type name/model id>", getStaffFlagValue("manageHouses"), true, true), commandData("housepickup", setHousePickupCommand, "<type name/model id>", getStaffFlagValue("manageHouses"), true, true),
commandData("houseinfo", getHouseInfoCommand, "[id]", getStaffFlagValue("none"), true, true), commandData("houseinfo", getHouseInfoCommand, "[id]", getStaffFlagValue("none"), true, true),
commandData("houseentrance", moveHouseEntranceCommand, "", getStaffFlagValue("manageHouses"), true, true), commandData("houseentrance", moveHouseEntranceCommand, "", getStaffFlagValue("manageHouses"), true, true),
commandData("houseexit", moveHouseExitCommand, "", getStaffFlagValue("manageHouses"), true, true), commandData("houseexit", moveHouseExitCommand, "", getStaffFlagValue("manageHouses"), true, true),
commandData("houseinttype", setHouseInteriorTypeCommand, "<interior template name/business id>", getStaffFlagValue("manageHouses"), true, true),
], ],
item: [], item: [],
job: [ job: [
@@ -149,7 +151,7 @@ function loadCommandData() {
commandData("startwork", startWorkingCommand, "", getStaffFlagValue("none"), true, false), commandData("startwork", startWorkingCommand, "", getStaffFlagValue("none"), true, false),
commandData("stopwork", stopWorkingCommand, "", getStaffFlagValue("none"), true, false), commandData("stopwork", stopWorkingCommand, "", getStaffFlagValue("none"), true, false),
commandData("startjob", startWorkingCommand, "", getStaffFlagValue("none"), true, false), commandData("startjob", startWorkingCommand, "", getStaffFlagValue("none"), true, false),
commandData("stopjob", stopWorkingCommand, "", getStaffFlagValue("none"), true, false), commandData("stopjob", stopWorkingCommand, "", getStaffFlagValue("none"), true, false),
commandData("quitjob", quitJobCommand, "", getStaffFlagValue("none"), true, false), commandData("quitjob", quitJobCommand, "", getStaffFlagValue("none"), true, false),
commandData("uniform", jobUniformCommand, "[uniform]", getStaffFlagValue("none"), true, false), commandData("uniform", jobUniformCommand, "[uniform]", getStaffFlagValue("none"), true, false),
commandData("equip", jobEquipmentCommand, "[equipment]", getStaffFlagValue("none"), true, false), commandData("equip", jobEquipmentCommand, "[equipment]", getStaffFlagValue("none"), true, false),
@@ -168,7 +170,7 @@ function loadCommandData() {
commandData("detain", policeDetainCommand, "", getStaffFlagValue("none"), true, false), commandData("detain", policeDetainCommand, "", getStaffFlagValue("none"), true, false),
commandData("drag", policeDragCommand, "", getStaffFlagValue("none"), true, false), commandData("drag", policeDragCommand, "", getStaffFlagValue("none"), true, false),
commandData("search", policeSearchCommand, "", getStaffFlagValue("none"), true, false), commandData("search", policeSearchCommand, "", getStaffFlagValue("none"), true, false),
// Bus/Garbage // Bus/Garbage
commandData("startroute", jobStartRouteCommand, "", getStaffFlagValue("none"), true, false), commandData("startroute", jobStartRouteCommand, "", getStaffFlagValue("none"), true, false),
commandData("stoproute", jobStopRouteCommand, "", getStaffFlagValue("none"), true, false), commandData("stoproute", jobStopRouteCommand, "", getStaffFlagValue("none"), true, false),
@@ -207,24 +209,24 @@ function loadCommandData() {
commandData("mute", muteClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true), commandData("mute", muteClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
commandData("freeze", freezeClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true), commandData("freeze", freezeClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
commandData("unmute", unMuteClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true), commandData("unmute", unMuteClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
commandData("unfreeze", unFreezeClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true), commandData("unfreeze", unFreezeClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
commandData("goto", gotoPlayerCommand, "<player name/id>", getStaffFlagValue("basicModeration"), true, true), commandData("goto", gotoPlayerCommand, "<player name/id>", getStaffFlagValue("basicModeration"), true, true),
commandData("gethere", getPlayerCommand, "<player name/id>", getStaffFlagValue("basicModeration"), true, true), commandData("gethere", getPlayerCommand, "<player name/id>", getStaffFlagValue("basicModeration"), true, true),
commandData("gotopos", gotoPositionCommand, "<x> <y> <z> [int] [vw]", getStaffFlagValue("basicModeration"), true, true), commandData("gotopos", gotoPositionCommand, "<x> <y> <z> [int] [vw]", getStaffFlagValue("basicModeration"), true, true),
commandData("gotoveh", gotoVehicleCommand, "<vehicle id>", getStaffFlagValue("basicModeration"), true, true), commandData("gotoveh", gotoVehicleCommand, "<vehicle id>", getStaffFlagValue("basicModeration"), true, true),
commandData("gotobiz", gotoBusinessCommand, "<business id/name>", getStaffFlagValue("basicModeration"), true, true), commandData("gotobiz", gotoBusinessCommand, "<business id/name>", getStaffFlagValue("basicModeration"), true, true),
commandData("gotohouse", gotoHouseCommand, "<house id/name>", getStaffFlagValue("basicModeration"), true, true), commandData("gotohouse", gotoHouseCommand, "<house id/name>", getStaffFlagValue("basicModeration"), true, true),
commandData("gotojob", gotoJobLocationCommand, "<job id/name> <location id>", getStaffFlagValue("basicModeration"), true, true), commandData("gotojob", gotoJobLocationCommand, "<job id/name> <location id>", getStaffFlagValue("basicModeration"), true, true),
//commandData("gotoloc", gotoLocationCommand, "<location name>", getStaffFlagValue("basicModeration"), true, true), //commandData("gotoloc", gotoLocationCommand, "<location name>", getStaffFlagValue("basicModeration"), true, true),
commandData("fr", teleportForwardCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true), commandData("fr", teleportForwardCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("ba", teleportBackwardCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true), commandData("ba", teleportBackwardCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("lt", teleportLeftCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true), commandData("lt", teleportLeftCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("rt", teleportRightCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true), commandData("rt", teleportRightCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("up", teleportUpCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true), commandData("up", teleportUpCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("dn", teleportDownCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true), commandData("dn", teleportDownCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("int", playerInteriorCommand, "<interior id>", getStaffFlagValue("basicModeration"), true, true), commandData("int", playerInteriorCommand, "<interior id>", getStaffFlagValue("basicModeration"), true, true),
commandData("vw", playerVirtualWorldCommand, "<virtual world id>", getStaffFlagValue("basicModeration"), true, true), commandData("vw", playerVirtualWorldCommand, "<virtual world id>", getStaffFlagValue("basicModeration"), true, true),
commandData("addstaffflag", addStaffFlagCommand, "<player name/id> [flag name]", getStaffFlagValue("manageAdmins"), true, true), commandData("addstaffflag", addStaffFlagCommand, "<player name/id> [flag name]", getStaffFlagValue("manageAdmins"), true, true),
commandData("delstaffflag", takeStaffFlagCommand, "<player name/id> [flag name]", getStaffFlagValue("manageAdmins"), true, true), commandData("delstaffflag", takeStaffFlagCommand, "<player name/id> [flag name]", getStaffFlagValue("manageAdmins"), true, true),
commandData("getstaffflags", getStaffFlagsCommand, "<player name/id>", getStaffFlagValue("manageAdmins"), true, true), commandData("getstaffflags", getStaffFlagsCommand, "<player name/id>", getStaffFlagValue("manageAdmins"), true, true),
@@ -238,20 +240,20 @@ function loadCommandData() {
subAccount: [ subAccount: [
commandData("switchchar", switchCharacterCommand, "", getStaffFlagValue("none"), true, false), commandData("switchchar", switchCharacterCommand, "", getStaffFlagValue("none"), true, false),
commandData("newchar", newCharacterCommand, "<first name> <last name>", getStaffFlagValue("none"), true, false), commandData("newchar", newCharacterCommand, "<first name> <last name>", getStaffFlagValue("none"), true, false),
commandData("usechar", useCharacterCommand, "<character id>", getStaffFlagValue("none"), true, false), commandData("usechar", useCharacterCommand, "<character id>", getStaffFlagValue("none"), true, false),
], ],
translate: [], translate: [],
utilities: [], utilities: [],
vehicle: [ vehicle: [
commandData("addveh", createVehicleCommand, "<model id/name>", getStaffFlagValue("manageVehicles"), true, false), commandData("addveh", createVehicleCommand, "<model id/name>", getStaffFlagValue("manageVehicles"), true, false),
commandData("tempveh", createTemporaryVehicleCommand, "<model id/name>", getStaffFlagValue("manageVehicles"), true, false), commandData("tempveh", createTemporaryVehicleCommand, "<model id/name>", getStaffFlagValue("manageVehicles"), true, false),
commandData("delveh", deleteVehicleCommand, "", getStaffFlagValue("manageVehicles"), true, false), commandData("delveh", deleteVehicleCommand, "", getStaffFlagValue("manageVehicles"), true, false),
commandData("lock", vehicleLockCommand, "", getStaffFlagValue("none"), true, false), commandData("lock", vehicleLockCommand, "", getStaffFlagValue("none"), true, false),
commandData("unlock", vehicleLockCommand, "", getStaffFlagValue("none"), true, false), commandData("unlock", vehicleLockCommand, "", getStaffFlagValue("none"), true, false),
commandData("engine", vehicleEngineCommand, "", getStaffFlagValue("none"), true, false), commandData("engine", vehicleEngineCommand, "", getStaffFlagValue("none"), true, false),
commandData("siren", vehicleSirenCommand, "", getStaffFlagValue("none"), true, false), commandData("siren", vehicleSirenCommand, "", getStaffFlagValue("none"), true, false),
commandData("lights", vehicleLightsCommand, "", getStaffFlagValue("none"), true, false), commandData("lights", vehicleLightsCommand, "", getStaffFlagValue("none"), true, false),
commandData("vehowner", setVehicleOwnerCommand, "<player id/name>", getStaffFlagValue("manageVehicles"), true, true), commandData("vehowner", setVehicleOwnerCommand, "<player id/name>", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehclan", setVehicleClanCommand, "<clan id/name>", getStaffFlagValue("manageVehicles"), true, true), commandData("vehclan", setVehicleClanCommand, "<clan id/name>", getStaffFlagValue("manageVehicles"), true, true),
@@ -338,13 +340,13 @@ function disableCommand(command, params, client) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
params = toLowerCase(params); params = toLowerCase(params);
if(!getCommand(params)) { if(!getCommand(params)) {
messagePlayerError(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;
messagePlayerSuccess(client, `Command [#AAAAAA]/${params} [#FFFFFF]has been disabled!`); messagePlayerSuccess(client, `Command [#AAAAAA]/${params} [#FFFFFF]has been disabled!`);
@@ -358,13 +360,13 @@ function enableCommand(command, params, client) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
params = toLowerCase(params); params = toLowerCase(params);
if(!getCommand(params)) { if(!getCommand(params)) {
messagePlayerError(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;
messagePlayerSuccess(client, `Command [#AAAAAA]/${params} [#FFFFFF]has been enabled!`); messagePlayerSuccess(client, `Command [#AAAAAA]/${params} [#FFFFFF]has been enabled!`);
@@ -380,11 +382,11 @@ function disableAllCommandsByType(command, params, client) {
} }
params = toLowerCase(params); params = toLowerCase(params);
if(isNull(getServerData().commands[params])) { if(isNull(getServerData().commands[params])) {
messagePlayerError(client, `Command type [#AAAAAA]${params} [#FFFFFF]does not exist!`); messagePlayerError(client, `Command type [#AAAAAA]${params} [#FFFFFF]does not exist!`);
return false; return false;
} }
for(let i in getServerData().commands[params]) { for(let i in getServerData().commands[params]) {
getServerData().commands[params][i].enabled = false; getServerData().commands[params][i].enabled = false;
@@ -401,9 +403,9 @@ function enableAllCommandsByType(command, params, client) {
messagePlayerSyntax(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])) {
messagePlayerError(client, `Command type [#AAAAAA]${params} [#FFFFFF]does not exist!`); messagePlayerError(client, `Command type [#AAAAAA]${params} [#FFFFFF]does not exist!`);
return false; return false;
@@ -452,7 +454,7 @@ function onPlayerCommand(event, client, command, params) {
// console.warn(`[Asshat.Command] ${getPlayerDisplayForConsole(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}`);
// messagePlayerError(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(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) { if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
@@ -460,7 +462,7 @@ function onPlayerCommand(event, client, command, params) {
messagePlayerError(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] ${getPlayerDisplayForConsole(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);
} }

View File

@@ -26,7 +26,7 @@ let globalConfig = {
takeJobDistance: 5, takeJobDistance: 5,
stopWorkingDistance: 10, stopWorkingDistance: 10,
spawnCarDistance: 5, spawnCarDistance: 5,
payAndSprayDistance: 5, payAndSprayDistance: 5,
defaultKeybinds: [ defaultKeybinds: [
new serverClasses.keyBindData(false, toInteger(SDLK_i), "engine"), new serverClasses.keyBindData(false, toInteger(SDLK_i), "engine"),
new serverClasses.keyBindData(false, toInteger(SDLK_k), "lights"), new serverClasses.keyBindData(false, toInteger(SDLK_k), "lights"),
@@ -37,8 +37,8 @@ let globalConfig = {
], ],
exitPropertyDistance: 3.0, exitPropertyDistance: 3.0,
enterPropertyDistance: 3.0, enterPropertyDistance: 3.0,
businessDimensionStart: 1000, businessDimensionStart: 5000,
houseDimensionStart: 3000, houseDimensionStart: 100,
buyVehicleDriveAwayDistance: 25.0, buyVehicleDriveAwayDistance: 25.0,
returnToJobVehicleTime: 30, returnToJobVehicleTime: 30,
}; };
@@ -49,7 +49,7 @@ let gameConfig = {
{ // GTA III { // GTA III
policeStation: 8, policeStation: 8,
fireStation: 9, fireStation: 9,
hospital: 12, hospital: 12,
ammunation: 20, ammunation: 20,
payAndSpray: 18, payAndSpray: 18,
vehicleDealership: 6, vehicleDealership: 6,
@@ -63,7 +63,7 @@ let gameConfig = {
{ // GTA VC { // GTA VC
policeStation: 0, policeStation: 0,
fireStation: 0, fireStation: 0,
hospital: 0, hospital: 0,
ammunation: 16, ammunation: 16,
payAndSpray: 27, payAndSpray: 27,
vehicleDealership: 7, vehicleDealership: 7,
@@ -72,12 +72,12 @@ let gameConfig = {
bank: 0, bank: 0,
fuelStation: -1, fuelStation: -1,
business: -1, business: -1,
house: -1, house: -1,
}, },
{ // GTA SA { // GTA SA
policeStation: 30, policeStation: 30,
fireStation: 20, fireStation: 20,
hospital: 22, hospital: 22,
ammunation: 6, ammunation: 6,
payAndSpray: 63, payAndSpray: 63,
vehicleDealership: 55, vehicleDealership: 55,
@@ -92,12 +92,12 @@ let gameConfig = {
bank: 52, bank: 52,
fuelStation: 0, fuelStation: 0,
business: -1, business: -1,
house: 31, house: 31,
}, },
{ // GTA UG { // GTA UG
policeStation: 8, policeStation: 8,
fireStation: 9, fireStation: 9,
hospital: 12, hospital: 12,
ammunation: 20, ammunation: 20,
payAndSpray: 18, payAndSpray: 18,
vehicleDealership: 6, vehicleDealership: 6,
@@ -106,12 +106,12 @@ let gameConfig = {
bank: 52, bank: 52,
fuelStation: 0, fuelStation: 0,
business: -1, business: -1,
house: -1, house: -1,
}, },
{ // GTA IV { // GTA IV
policeStation: 8, policeStation: 8,
fireStation: 9, fireStation: 9,
hospital: 12, hospital: 12,
ammunation: 20, ammunation: 20,
payAndSpray: 18, payAndSpray: 18,
vehicleDealership: 6, vehicleDealership: 6,
@@ -120,8 +120,8 @@ let gameConfig = {
bank: 52, bank: 52,
fuelStation: 0, fuelStation: 0,
business: -1, business: -1,
house: -1, house: -1,
}, },
], ],
pickupModels: [ pickupModels: [
{}, {},
@@ -129,7 +129,7 @@ let gameConfig = {
{ // GTA 3 { // GTA 3
policeStation: 1361, policeStation: 1361,
fireStation: 1361, fireStation: 1361,
hospital: 1361, hospital: 1361,
ammunation: 1361, ammunation: 1361,
payAndSpray: 1361, payAndSpray: 1361,
vehicleDealership: 1361, vehicleDealership: 1361,
@@ -143,11 +143,11 @@ let gameConfig = {
misc: 1361, misc: 1361,
exit: 1361 exit: 1361
}, },
{ // GTA Vice City { // GTA Vice City
policeStation: 375, policeStation: 375,
fireStation: 406, fireStation: 406,
hospital: 366, hospital: 366,
ammunation: 406, ammunation: 406,
payAndSpray: 406, payAndSpray: 406,
vehicleDealership: 406, vehicleDealership: 406,
@@ -165,7 +165,7 @@ let gameConfig = {
{ // GTA San Andreas { // GTA San Andreas
policeStation: 1247, policeStation: 1247,
fireStation: 1318, fireStation: 1318,
hospital: 1240, hospital: 1240,
ammunation: 1239, ammunation: 1239,
payAndSpray: 1239, payAndSpray: 1239,
vehicleDealership: 1239, vehicleDealership: 1239,
@@ -190,7 +190,7 @@ let gameConfig = {
clothes: 0, clothes: 0,
info: 0, info: 0,
}, },
{ // GTA Vice City { // GTA Vice City
business: 0, business: 0,
house: 0, house: 0,
@@ -205,7 +205,7 @@ let gameConfig = {
bank: 1, bank: 1,
clothes: 1, clothes: 1,
info: 1, info: 1,
} }
], ],
// THIS IS SCREEN HEIGHT, NOT ACTUAL DOOR POSITION IN THE WORLD // THIS IS SCREEN HEIGHT, NOT ACTUAL DOOR POSITION IN THE WORLD
@@ -222,21 +222,48 @@ let gameConfig = {
removedWorldObjects: [ removedWorldObjects: [
false, false,
[ [
new serverClasses.removedWorldObjectData("fraightback04", new Vec3(1229.88, -84.8012, 13.4004), 50.0), // Truck trailer in Easy Credit Autos dealership parking lot new serverClasses.removedWorldObjectData("fraightback04", toVector3(1229.88, -84.8012, 13.4004), 50.0), // Truck trailer in Easy Credit Autos dealership parking lot
new serverClasses.removedWorldObjectData("fraightback03", new Vec3(1239.49, -68.0529, 11.6914), 50.0), // Truck trailer in Easy Credit Autos dealership parking lot new serverClasses.removedWorldObjectData("fraightback03", toVector3(1239.49, -68.0529, 11.6914), 50.0), // Truck trailer in Easy Credit Autos dealership parking lot
], ],
[], [],
[], [],
[], [],
[], [],
[], [],
] ],
interiorTemplates: [
false,
{ // GTA 3
},
{ // GTA VC
mall: new serverClasses.interiorTemplateData(toVector3(379.62, 1007.00, 19.22), 4),
malibuClub: new serverClasses.interiorTemplateData(toVector3(489.83, -76.49, 11.48), 17),
policeStation: new serverClasses.interiorTemplateData(toVector3(396.38, -472.96, 12.34), 12),
apartment: new serverClasses.interiorTemplateData(toVector3(26.67, -1328.89, 13.00), 11),
hotel: new serverClasses.interiorTemplateData(toVector3(228.53, -1277.12, 12.07), 1),
bikerBar: new serverClasses.interiorTemplateData(toVector3(-597.41, 651.84, 11.30), 11),
mansion: new serverClasses.interiorTemplateData(toVector3(-379.14, -551.65, 19.32), 2),
ammunationRange: new serverClasses.interiorTemplateData(toVector3(-667.79, 1217.51, 11.10), 10),
bank: new serverClasses.interiorTemplateData(toVector3(-894.52, -341.16, 13.45), 3),
stripClub: new serverClasses.interiorTemplateData(toVector3(97.53, -1472.06, 10.43), 5),
office: new serverClasses.interiorTemplateData(toVector3(120.82, -827.98, 10.62), 6),
arena: new serverClasses.interiorTemplateData(toVector3(-1080.49, 1331.16, 13.91), 15),
ghettoShack: new serverClasses.interiorTemplateData(toVector3(-962.72, 146.11, 9.395), 12),
},
{ // GTA SA
}
],
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function initConfigScript() { function initConfigScript() {
console.log("[Asshat.Config]: Initializing config script ..."); console.log("[Asshat.Config]: Initializing config script ...");
serverConfig = loadServerConfigFromGameAndPort(server.game, server.port);
applyConfigToServer(serverConfig);
console.log("[Asshat.Config]: Config script initialized!"); console.log("[Asshat.Config]: Config script initialized!");
} }
@@ -256,7 +283,7 @@ function loadServerConfigFromGameAndPort(gameId, port) {
} }
} }
disconnectFromDatabase(dbConnection); disconnectFromDatabase(dbConnection);
} }
return false; return false;
} }
@@ -297,7 +324,7 @@ function applyConfigToServer(tempServerConfig) {
function saveServerConfigToDatabase(serverConfigData) { function saveServerConfigToDatabase(serverConfigData) {
console.log(`[Asshat.Config]: Saving server ${serverConfigData.databaseId} configuration to database ...`); console.log(`[Asshat.Config]: Saving server ${serverConfigData.databaseId} configuration to database ...`);
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
if(dbConnection) { if(dbConnection) {
let safeServerName = escapeDatabaseString(dbConnection, serverConfigData.name); let safeServerName = escapeDatabaseString(dbConnection, serverConfigData.name);
let safePassword = escapeDatabaseString(dbConnection, serverConfigData.password); let safePassword = escapeDatabaseString(dbConnection, serverConfigData.password);
@@ -358,14 +385,14 @@ function setTimeCommand(command, params, client) {
if(hour > 23 || hour < 0) { if(hour > 23 || hour < 0) {
messagePlayerError(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) {
messagePlayerError(client, "The minute must be between 0 and 59!"); messagePlayerError(client, "The minute must be between 0 and 59!");
return false; return false;
} }
gta.time.hour = hour; gta.time.hour = hour;
gta.time.minute = minute; gta.time.minute = minute;
@@ -399,8 +426,8 @@ function setWeatherCommand(command, params, client) {
if(!weatherId) { if(!weatherId) {
messagePlayerError(client, `That weather ID or name is invalid!`); messagePlayerError(client, `That weather ID or name is invalid!`);
return false; return false;
} }
gta.forceWeather(toInteger(weatherId)); gta.forceWeather(toInteger(weatherId));
messageAdminAction(`${client.name} set the weather to [#AAAAAA]${weatherNames[getServerGame()][toInteger(weatherId)]}`); messageAdminAction(`${client.name} set the weather to [#AAAAAA]${weatherNames[getServerGame()][toInteger(weatherId)]}`);
@@ -431,7 +458,7 @@ function setSnowingCommand(command, params, client) {
let splitParams = params.split(); let splitParams = params.split();
let fallingSnow = Number(splitParams[0]) || !getServerConfig().fallingSnow; let fallingSnow = Number(splitParams[0]) || !getServerConfig().fallingSnow;
let groundSnow = Number(splitParams[1]) || !getServerConfig().groundSnow; let groundSnow = Number(splitParams[1]) || !getServerConfig().groundSnow;
fallingSnow = intToBool(toInteger(fallingSnow)); fallingSnow = intToBool(toInteger(fallingSnow));
groundSnow = intToBool(toInteger(groundSnow)); groundSnow = intToBool(toInteger(groundSnow));
@@ -461,7 +488,7 @@ function toggleServerLogoCommand(command, params, client) {
} }
getServerConfig().useLogo = !getServerConfig().useLogo; getServerConfig().useLogo = !getServerConfig().useLogo;
triggerNetworkEvent("ag.logo", null, intToBool(getServerConfig().useLogo)); triggerNetworkEvent("ag.logo", null, intToBool(getServerConfig().useLogo));
messageAdminAction(`${client.name} turned the server logo image ${getBoolRedGreenInlineColour(getServerConfig().useLogo)}${toUpperCase(getOnOffFromBool(getServerConfig().useLogo))}`); messageAdminAction(`${client.name} turned the server logo image ${getBoolRedGreenInlineColour(getServerConfig().useLogo)}${toUpperCase(getOnOffFromBool(getServerConfig().useLogo))}`);

View File

@@ -24,28 +24,28 @@ let serverData = {
translation: { translation: {
translationBaseURL: "http://api.mymemory.translated.net/get?de=example@example.com&q={0}&langpair={1}|{2}", translationBaseURL: "http://api.mymemory.translated.net/get?de=example@example.com&q={0}&langpair={1}|{2}",
languages: [ languages: [
["Abkhazian", "AB"], ["Abkhazian", "AB"],
["Afar", "AA"], ["Afar", "AA"],
["Afrikaans", "AF"], ["Afrikaans", "AF"],
["Albanian", "SQ"], ["Albanian", "SQ"],
["Amharic", "AM"], ["Amharic", "AM"],
["Arabic", "AR"], ["Arabic", "AR"],
["Armenian", "HY"], ["Armenian", "HY"],
["Assamese", "AS"], ["Assamese", "AS"],
["Aymara", "AY"], ["Aymara", "AY"],
["Azerbaijani", "AZ"], ["Azerbaijani", "AZ"],
["Bashkir", "BA"], ["Bashkir", "BA"],
["Basque", "EU"], ["Basque", "EU"],
["Bengali, Bangla", "BN"], ["Bengali, Bangla", "BN"],
["Bhutani", "DZ"], ["Bhutani", "DZ"],
["Bihari", "BH"], ["Bihari", "BH"],
["Bislama", "BI"], ["Bislama", "BI"],
["Breton", "BR"], ["Breton", "BR"],
["Bulgarian", "BG"], ["Bulgarian", "BG"],
["Burmese", "MY"], ["Burmese", "MY"],
["Byelorussian", "BE"], ["Byelorussian", "BE"],
["Cambodian", "KM"], ["Cambodian", "KM"],
["Catalan", "CA"], ["Catalan", "CA"],
["Chinese", "ZH"], ["Chinese", "ZH"],
["Corsican", "CO"], ["Corsican", "CO"],
["Croatian", "HR"], ["Croatian", "HR"],
@@ -167,19 +167,19 @@ let serverData = {
policeStations: [ policeStations: [
false, false,
[ // GTA 3 [ // GTA 3
{ {
position: toVector3(1143.875, -675.1875, 14.97), position: toVector3(1143.875, -675.1875, 14.97),
heading: 1.5, heading: 1.5,
blip: false, blip: false,
name: "Portland", name: "Portland",
}, },
{ {
position: toVector3(340.25, -1123.375, 25.98), position: toVector3(340.25, -1123.375, 25.98),
heading: 3.14, heading: 3.14,
blip: false, blip: false,
name: "Staunton Island", name: "Staunton Island",
}, },
{ {
position: toVector3(-1253.0, -138.1875, 58.75), position: toVector3(-1253.0, -138.1875, 58.75),
heading: 1.5, heading: 1.5,
blip: false, blip: false,
@@ -187,25 +187,25 @@ let serverData = {
}, },
], ],
[ // GTA VC [ // GTA VC
{ {
position: toVector3(399.77, -468.90, 11.73), position: toVector3(399.77, -468.90, 11.73),
heading: 0.0, heading: 0.0,
blip: false, blip: false,
name: "Washington Beach", name: "Washington Beach",
}, },
{ {
position: toVector3(508.96, 512.07, 12.10), position: toVector3(508.96, 512.07, 12.10),
heading: 0.0, heading: 0.0,
blip: false, blip: false,
name: "Vice Point", name: "Vice Point",
}, },
{ {
position: toVector3(-657.43, 762.31, 11.59), position: toVector3(-657.43, 762.31, 11.59),
heading: 0.0, heading: 0.0,
blip: false, blip: false,
name: "Downtown", name: "Downtown",
}, },
{ {
position: toVector3(-885.08, -470.44, 13.11), position: toVector3(-885.08, -470.44, 13.11),
heading: 0.0, heading: 0.0,
blip: false, blip: false,
@@ -213,103 +213,103 @@ let serverData = {
}, },
], ],
[ // GTA SA [ // GTA SA
{ {
position: toVector3(1545.53, -1675.64, 13.561), position: toVector3(1545.53, -1675.64, 13.561),
heading: -1.575, heading: -1.575,
blip: false, blip: false,
name: "Los Santos", name: "Los Santos",
}, },
], ],
[ // GTA UG [ // GTA UG
], ],
[ // GTA IV [ // GTA IV
{ {
position: toVector3(894.99, -357.39, 18.185), position: toVector3(894.99, -357.39, 18.185),
heading: 2.923, heading: 2.923,
blip: false, blip: false,
name: "Broker", name: "Broker",
}, },
{ {
position: toVector3(435.40, 1592.29, 17.353), position: toVector3(435.40, 1592.29, 17.353),
heading: 3.087, heading: 3.087,
blip: false, blip: false,
name: "South Bohan", name: "South Bohan",
}, },
{ {
position: toVector3(974.93, 1870.45, 23.073), position: toVector3(974.93, 1870.45, 23.073),
heading: -1.621, heading: -1.621,
blip: false, blip: false,
name: "Northern Gardens", name: "Northern Gardens",
}, },
{ {
position: toVector3(1233.25, -89.13, 28.034), position: toVector3(1233.25, -89.13, 28.034),
heading: 1.568, heading: 1.568,
blip: false, blip: false,
name: "South Slopes", name: "South Slopes",
}, },
{ {
position: toVector3(50.12, 679.88, 15.316), position: toVector3(50.12, 679.88, 15.316),
heading: 1.569, heading: 1.569,
blip: false, blip: false,
name: "Middle Park East", name: "Middle Park East",
}, },
{ {
position: toVector3(85.21, 1189.82, 14.755), position: toVector3(85.21, 1189.82, 14.755),
heading: 3.127, heading: 3.127,
blip: false, blip: false,
name: "East Holland", name: "East Holland",
}, },
{ {
position: toVector3(2170.87, 448.87, 6.085), position: toVector3(2170.87, 448.87, 6.085),
heading: 1.501, heading: 1.501,
blip: false, blip: false,
name: "Francis International Airport", name: "Francis International Airport",
}, },
{ {
position: toVector3(213.12, -211.70, 10.752), position: toVector3(213.12, -211.70, 10.752),
heading: 0.200, heading: 0.200,
blip: false, blip: false,
name: "Chinatown", name: "Chinatown",
}, },
{ {
position: toVector3(-1714.95, 276.31, 22.134), position: toVector3(-1714.95, 276.31, 22.134),
heading: 1.127, heading: 1.127,
blip: false, blip: false,
name: "Acter", name: "Acter",
}, },
{ {
position: toVector3(-1220.73, -231.53, 3.024), position: toVector3(-1220.73, -231.53, 3.024),
heading: 2.210, heading: 2.210,
blip: false, blip: false,
name: "Port Tudor", name: "Port Tudor",
}, },
{ {
position: toVector3(-927.66, 1263.63, 24.587), position: toVector3(-927.66, 1263.63, 24.587),
heading: -0.913, heading: -0.913,
blip: false, blip: false,
name: "Leftwood", name: "Leftwood",
}, },
] ]
], ],
fireStations: [ fireStations: [
false, false,
[ // GTA 3 [ // GTA 3
{ {
position: toVector3(1103.70, -52.45, 7.49), position: toVector3(1103.70, -52.45, 7.49),
heading: 1.5, heading: 1.5,
blip: false, blip: false,
name: "Portland", name: "Portland",
}, },
{ {
position: toVector3(-78.48, -436.80, 16.17), position: toVector3(-78.48, -436.80, 16.17),
heading: 3.14, heading: 3.14,
blip: false, blip: false,
name: "Staunton Island", name: "Staunton Island",
}, },
{ {
position: toVector3(-1202.10, -14.67, 53.20), position: toVector3(-1202.10, -14.67, 53.20),
heading: 1.5, heading: 1.5,
blip: false, blip: false,
@@ -323,34 +323,34 @@ let serverData = {
], ],
[ // GTA UG [ // GTA UG
], ],
[ // GTA IV [ // GTA IV
{ {
position: toVector3(953.13, 95.90, 35.004), position: toVector3(953.13, 95.90, 35.004),
heading: 1.595, heading: 1.595,
blip: false, blip: false,
name: "Broker", name: "Broker",
}, },
{ {
position: toVector3(-271.02, 1542.15, 20.420), position: toVector3(-271.02, 1542.15, 20.420),
heading: -1.160, heading: -1.160,
blip: false, blip: false,
name: "Northwood", name: "Northwood",
}, },
{ {
position: toVector3(1120.47, 1712.36, 10.534), position: toVector3(1120.47, 1712.36, 10.534),
heading: -0.682, heading: -0.682,
blip: false, blip: false,
name: "Northern Gardens", name: "Northern Gardens",
}, },
{ {
position: toVector3(2364.87, 166.83, 5.813), position: toVector3(2364.87, 166.83, 5.813),
heading: 0.156, heading: 0.156,
blip: false, blip: false,
name: "Francis International Airport", name: "Francis International Airport",
}, },
{ {
position: toVector3(295.40, -336.88, 4.963), position: toVector3(295.40, -336.88, 4.963),
heading: 2.887, heading: 2.887,
blip: false, blip: false,
@@ -361,19 +361,19 @@ let serverData = {
hospitals: [ hospitals: [
false, false,
[ // GTA 3 [ // GTA 3
{ {
position: toVector3(1144.25, -596.875, 14.97), position: toVector3(1144.25, -596.875, 14.97),
heading: 1.5, heading: 1.5,
blip: false, blip: false,
name: "Portland", name: "Portland",
}, },
{ {
position: toVector3(183.5, -17.75, 16.21), position: toVector3(183.5, -17.75, 16.21),
heading: 3.14, heading: 3.14,
blip: false, blip: false,
name: "Staunton Island", name: "Staunton Island",
}, },
{ {
position: toVector3(-1259.5, -44.5, 58.89), position: toVector3(-1259.5, -44.5, 58.89),
heading: 1.5, heading: 1.5,
blip: false, blip: false,
@@ -381,13 +381,13 @@ let serverData = {
}, },
], ],
[ // GTA VC [ // GTA VC
{ {
position: toVector3(493.14, 709.31, 11.80), position: toVector3(493.14, 709.31, 11.80),
heading: 1.5, heading: 1.5,
blip: false, blip: false,
name: "Unknown", name: "Unknown",
}, },
{ {
position: toVector3(-826.06, 1144.41, 12.41), position: toVector3(-826.06, 1144.41, 12.41),
heading: 1.5, heading: 1.5,
blip: false, blip: false,
@@ -395,13 +395,13 @@ let serverData = {
}, },
], ],
[ // GTA SA [ // GTA SA
{ {
position: toVector3(1172.96, -1323.42, 15.40), position: toVector3(1172.96, -1323.42, 15.40),
heading: 1.5, heading: 1.5,
blip: false, blip: false,
name: "All Saints", name: "All Saints",
}, },
{ {
position: toVector3(2034.04, -1405.07, 17.24), position: toVector3(2034.04, -1405.07, 17.24),
heading: 1.5, heading: 1.5,
blip: false, blip: false,
@@ -409,49 +409,49 @@ let serverData = {
}, },
], ],
[ // GTA UG [ // GTA UG
], ],
[ // GTA IV [ // GTA IV
{ {
position: toVector3(1199.59, 196.78, 33.554), position: toVector3(1199.59, 196.78, 33.554),
heading: 1.633, heading: 1.633,
blip: false, blip: false,
name: "Schottler", name: "Schottler",
}, },
{ {
position: toVector3(980.71, 1831.61, 23.898), position: toVector3(980.71, 1831.61, 23.898),
heading: -0.049, heading: -0.049,
blip: false, blip: false,
name: "Northern Gardens", name: "Northern Gardens",
}, },
{ {
position: toVector3(-1317.27, 1277.20, 22.370), position: toVector3(-1317.27, 1277.20, 22.370),
heading: 2.246, heading: 2.246,
blip: false, blip: false,
name: "Leftwood", name: "Leftwood",
}, },
{ {
position: toVector3(-1538.43, 344.58, 20.943), position: toVector3(-1538.43, 344.58, 20.943),
heading: -0.156, heading: -0.156,
blip: false, blip: false,
name: "Acter", name: "Acter",
}, },
] ]
], ],
payAndSprays: [ payAndSprays: [
false, false,
[ // GTA 3 [ // GTA 3
{ {
position: toVector3(925.4, -360.3, 10.83), position: toVector3(925.4, -360.3, 10.83),
blip: false, blip: false,
name: "Portland", name: "Portland",
}, },
{ {
position: toVector3(381.8, -493.8, 25.95), position: toVector3(381.8, -493.8, 25.95),
blip: false, blip: false,
name: "Staunton Island", name: "Staunton Island",
}, },
{ {
position: toVector3(-1142.4, 35.01, 58.61), position: toVector3(-1142.4, 35.01, 58.61),
blip: false, blip: false,
name: "Shoreside Vale", name: "Shoreside Vale",
@@ -464,22 +464,22 @@ let serverData = {
], ],
[ // GTA UG [ // GTA UG
], ],
[ // GTA IV [ // GTA IV
] ]
], ],
ammunations: [ ammunations: [
false, false,
[ // GTA 3 [ // GTA 3
{ {
position: toVector3(1068.3, -400.9, 15.24), position: toVector3(1068.3, -400.9, 15.24),
blip: false, blip: false,
name: "Portland", name: "Portland",
}, },
{ {
position: toVector3(348.2, -717.9, 26.43), position: toVector3(348.2, -717.9, 26.43),
blip: false, blip: false,
name: "Staunton Island", name: "Staunton Island",
@@ -492,7 +492,7 @@ let serverData = {
], ],
[ // GTA UG [ // GTA UG
], ],
[ // GTA IV [ // GTA IV
@@ -501,8 +501,8 @@ let serverData = {
fuelStations: [ fuelStations: [
false, false,
[ // GTA 3 [ // GTA 3
{ {
position: toVector3(1161.9, -76.73, 7.27), position: toVector3(1161.9, -76.73, 7.27),
blip: false, blip: false,
name: "Portland", name: "Portland",
@@ -515,11 +515,11 @@ let serverData = {
], ],
[ // GTA UG [ // GTA UG
], ],
[ // GTA IV [ // GTA IV
] ]
], ],
}; };

View File

@@ -11,10 +11,10 @@
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
let databaseConfig = { let databaseConfig = {
host: "158.69.238.64", host: "127.0.0.1",
user: "db24053", user: "gtac-main",
pass: "G3At3d7BsA", pass: "QaH2rOP7BOBAkuX5V74EsOFi4uh5XO",
name: "db24053", name: "gtac_main",
port: 3306, port: 3306,
usePersistentConnection: true, usePersistentConnection: true,
} }
@@ -41,7 +41,7 @@ function connectToDatabase() {
} }
console.log("[Asshat.Database] Database connection successful!"); console.log("[Asshat.Database] Database connection successful!");
return persistentDatabaseConnection; return persistentDatabaseConnection;
} else { } else {
//console.log("[Asshat.Database] Using existing database connection."); //console.log("[Asshat.Database] Using existing database connection.");
return persistentDatabaseConnection; return persistentDatabaseConnection;

View File

@@ -155,12 +155,12 @@ function executeClientCodeCommand(command, params, client) {
if(!targetClient) { if(!targetClient) {
messagePlayerError(client, "That player was not found!"); messagePlayerError(client, "That player was not found!");
return false; return false;
} }
if(targetCode == "") { if(targetCode == "") {
messagePlayerError(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);
@@ -226,7 +226,7 @@ function submitIdea(client, ideaText) {
} else { } else {
databaseId = getPlayerData(client).accountData.databaseId; databaseId = getPlayerData(client).accountData.databaseId;
} }
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
if(dbConnection) { if(dbConnection) {
let safeIdeaMessage = escapeDatabaseString(dbConnection, ideaText); let safeIdeaMessage = escapeDatabaseString(dbConnection, ideaText);

View File

@@ -33,13 +33,13 @@ addEventHandler("OnDiscordCommand", function(command, params, discordUser) {
function messageDiscordUser(discordUser, messageText) { function messageDiscordUser(discordUser, messageText) {
let socketData = JSON.stringify({ let socketData = JSON.stringify({
type: "chat.message.text", type: "chat.message.text",
payload: { payload: {
author: discordUser.name, author: discordUser.name,
text: messageText, text: messageText,
} }
}); });
sendDiscordSocketData(socketData); sendDiscordSocketData(socketData);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -48,7 +48,7 @@ function sendDiscordSocketData(socketData) {
if(!getDiscordSocket()) { if(!getDiscordSocket()) {
return false; return false;
} }
getDiscordSocket().send(module.hash.encodeBase64(socketData) + "\r\n"); getDiscordSocket().send(module.hash.encodeBase64(socketData) + "\r\n");
} }

View File

@@ -11,7 +11,7 @@
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function initEventScript() { function initEventScript() {
console.log("[Asshat.Event]: Initializing event script ..."); console.log("[Asshat.Event]: Initializing event script ...");
addNetworkHandler("ag.onPlayerEnterVehicle", playerEnteredVehicle); addNetworkHandler("ag.onPlayerEnterVehicle", playerEnteredVehicle);
addNetworkHandler("ag.onPlayerExitVehicle", playerExitedVehicle); addNetworkHandler("ag.onPlayerExitVehicle", playerExitedVehicle);
console.log("[Asshat.Event]: Event script initialized!"); console.log("[Asshat.Event]: Event script initialized!");
@@ -82,7 +82,7 @@ addEventHandler("OnProcess", function(event, deltaTime) {
for(let i in clients) { for(let i in clients) {
if(getPlayerData(clients[i])) { if(getPlayerData(clients[i])) {
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(getPlayerCurrentSubAccount(clients[i]).cash < getVehicleData(getPlayerData(clients[i]).buyingVehicle).buyPrice) { if(getPlayerCurrentSubAccount(clients[i]).cash < getVehicleData(getPlayerData(clients[i]).buyingVehicle).buyPrice) {
messagePlayerError(client, "You don't have enough money to buy this vehicle!"); messagePlayerError(client, "You don't have enough money to buy this vehicle!");
@@ -104,7 +104,7 @@ addEventHandler("OnProcess", function(event, deltaTime) {
} }
} else { } else {
messagePlayerError(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;
} }
} }
@@ -138,9 +138,9 @@ addEventHandler("OnPedEnterVehicle", function(event, ped, vehicle, seat) {
} }
} else { } else {
messagePlayerNormal(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`);
} }
} }
} }
}); });
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -160,7 +160,7 @@ async function playerEnteredVehicle(client) {
console.log(`[Asshat.Event] ${getPlayerDisplayForConsole(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;
if(getPlayerVehicleSeat(client) == AG_VEHSEAT_DRIVER) { if(getPlayerVehicleSeat(client) == AG_VEHSEAT_DRIVER) {
vehicle.engine = getVehicleData(vehicle).engine; vehicle.engine = getVehicleData(vehicle).engine;
@@ -186,7 +186,7 @@ async function playerEnteredVehicle(client) {
} }
let currentSubAccount = getPlayerCurrentSubAccount(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 == getPlayerCurrentSubAccount(client).job) { if(getVehicleData(vehicle).ownerId == getPlayerCurrentSubAccount(client).job) {
@@ -203,7 +203,7 @@ async function playerEnteredVehicle(client) {
stopReturnToJobVehicleCountdown(client); stopReturnToJobVehicleCountdown(client);
} }
} }
} }
} }
} }
@@ -229,28 +229,75 @@ function playerExitedVehicle(client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function processPlayerDeath(client) { function processPlayerDeath(client, position) {
removeEntityData(client.player, "ag.spawned", true); removeEntityData(client.player, "ag.spawned");
let closestHospital = getClosestHospital(getPlayerPosition(client));
triggerNetworkEvent("ag.control", client, false); triggerNetworkEvent("ag.control", client, false);
setTimeout(function() { setTimeout(function() {
triggerNetworkEvent("ag.fadeCamera", client, false, 1.0); triggerNetworkEvent("ag.fadeCamera", client, false, 1.0);
setTimeout(function() { setTimeout(function() {
client.despawnPlayer(); client.despawnPlayer();
if(getPlayerCurrentSubAccount(client).inJail) { if(getPlayerCurrentSubAccount(client).inJail) {
let closestJail = getClosestJail(getPlayerPosition(client)); let closestJail = getClosestJail(position);
spawnPlayer(client, closestJail.position, closestJail.heading, getPlayerCurrentSubAccount(client).skin); spawnPlayer(client, closestJail.position, closestJail.heading, getPlayerCurrentSubAccount(client).skin);
} else { } else {
getPlayerCurrentSubAccount(client).inHospital = true;
let closestHospital = getClosestHospital(position);
spawnPlayer(client, closestHospital.position, closestHospital.heading, getPlayerCurrentSubAccount(client).skin); spawnPlayer(client, closestHospital.position, closestHospital.heading, getPlayerCurrentSubAccount(client).skin);
} }
setTimeout(function() { }, 2000);
setEntityData(client.player, "ag.spawned", true, true);
triggerNetworkEvent("ag.fadeCamera", client, true, 1.0);
triggerNetworkEvent("ag.control", client, true);
}, 1000);
}, 2000);
}, 1000); }, 1000);
} }
// ---------------------------------------------------------------------------
function processPedSpawn(ped) {
if(ped.type == ELEMENT_PLAYER) {
setTimeout(processPlayerSpawn, 1000, ped);
}
}
// ---------------------------------------------------------------------------
function processPlayerSpawn(ped) {
if(getClientFromPlayerElement(ped) == null) {
setTimeout(processPlayerSpawn, ped, 500);
return false;
}
let client = getClientFromPlayerElement(ped);
if(!getPlayerData(client)) {
client.disconnect();
return false;
}
if(!getPlayerData(client).switchingCharacter) {
return false;
}
messagePlayerAlert(client, `You are now playing as: [#0099FF]${tempSubAccount.firstName} ${tempSubAccount.lastName}`, getColourByName("white"));
messagePlayerNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange"));
messagePlayerNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
triggerNetworkEvent("ag.restoreCamera", client);
setEntityData(client, "ag.spawned", true, true);
setTimeout(function() {
setEntityData(ped, "ag.spawned", true, true);
setPlayerPosition(client, tempSubAccount.spawnPosition);
setPlayerHeading(client, tempSubAccount.spawnHeading);
setPlayerInterior(client, tempSubAccount.interior);
setPlayerVirtualWorld(client, tempSubAccount.dimension);
setTimeout(function() {
updatePlayerCash(client);
}, 1000);
}, 500);
updateAllPlayerNameTags();
getPlayerData(client).switchingCharacter = false;
triggerNetworkEvent("ag.jobType", client, tempSubAccount.job);
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -34,35 +34,35 @@ let fishingLocations = [
[ [
// GTA IV // GTA IV
], ],
]; ];
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
let fishingCatchables = [ let fishingCatchables = [
// Fish // Fish
["Salmon", 0, 500, 1, 15], ["Salmon", 0, 500, 1, 15],
["Tuna", 0, 700, 1, 15], ["Tuna", 0, 700, 1, 15],
["Crab", 0, 200, 1, 5], ["Crab", 0, 200, 1, 5],
["Trout", 0, 250, 1, 15], ["Trout", 0, 250, 1, 15],
["Sea Bass", 0, 550, 1, 8], ["Sea Bass", 0, 550, 1, 8],
["Shark", 0, 150, 1, 15], ["Shark", 0, 150, 1, 15],
["Turtle", 0, 50, 1, 25], ["Turtle", 0, 50, 1, 25],
["Manta Ray", 0, 250, 1, 25], ["Manta Ray", 0, 250, 1, 25],
["Cat Fish", 0, 350, 1, 5], ["Cat Fish", 0, 350, 1, 5],
["Blue Marlin", 0, 450, 1, 5], ["Blue Marlin", 0, 450, 1, 5],
// Junk // Junk
["Can", 0, 0, 0, 0], ["Can", 0, 0, 0, 0],
["Pants", 0, 0, 0, 0], ["Pants", 0, 0, 0, 0],
["Shoes", 0, 0, 0, 0], ["Shoes", 0, 0, 0, 0],
["Garbage", 0, 0, 0, 0], ["Garbage", 0, 0, 0, 0],
["Baby Diaper", 0, 0, 0, 0], ["Baby Diaper", 0, 0, 0, 0],
["Tire", 0, 0, 0, 0], ["Tire", 0, 0, 0, 0],
["Car Battery", 0, 0, 0, 0], ["Car Battery", 0, 0, 0, 0],
["Horse Hoove", 0, 0, 0, 0], ["Horse Hoove", 0, 0, 0, 0],
["Log", 0, 0, 0, 0], ["Log", 0, 0, 0, 0],
["Soggy Dildo", 0, 0, 0, 0], ["Soggy Dildo", 0, 0, 0, 0],
]; ];
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -41,37 +41,37 @@ function helpCommand(command, params, client) {
case "vehicle": case "vehicle":
showVehicleHelpMessage(client); showVehicleHelpMessage(client);
break; break;
case "dealership": case "dealership":
showVehicleDealershipHelpMessage(client); showVehicleDealershipHelpMessage(client);
break; break;
case "job": case "job":
showJobHelpMessage(client); showJobHelpMessage(client);
break; break;
case "chat": case "chat":
showChatHelpMessage(client); showChatHelpMessage(client);
break; break;
case "rules": case "rules":
showRulesHelpMessage(client); showRulesHelpMessage(client);
break; break;
case "website": case "website":
showWebsiteHelpMessage(client); showWebsiteHelpMessage(client);
break; break;
case "discord": case "discord":
showDiscordHelpMessage(client); showDiscordHelpMessage(client);
break; break;
case "anim": case "anim":
case "animation": case "animation":
showAnimationHelpMessage(client); showAnimationHelpMessage(client);
break; break;
case "ammunation": case "ammunation":
case "ammu": case "ammu":
showAmmunationHelpMessage(client); showAmmunationHelpMessage(client);
@@ -81,8 +81,8 @@ function helpCommand(command, params, client) {
case "clothes": case "clothes":
showClothesHelpMessage(client); showClothesHelpMessage(client);
break; break;
case "key": case "key":
case "keys": case "keys":
case "keybinds": case "keybinds":
case "bindkey": case "bindkey":
@@ -133,7 +133,7 @@ function showAccountHelpMessage(client) {
function showVehicleHelpMessage(client) { function showVehicleHelpMessage(client) {
messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Vehicle Help [#FF9900]============================="); messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Vehicle Help [#FF9900]=============================");
messagePlayerNormal(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.)");
messagePlayerNormal(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");
messagePlayerNormal(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!");
messagePlayerNormal(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");
@@ -179,7 +179,7 @@ function showRulesHelpMessage(client) {
messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]No terrorist or terrorism roleplay is allowed."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]No terrorist or terrorism roleplay is allowed.");
messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Always follow instructions given by moderators and admins."); messagePlayerNormal(client, "[#FF9900]• [#FFFFFF]Always follow instructions given by moderators and admins.");
messagePlayerNormal(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");
messagePlayerNormal(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 language");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -246,7 +246,7 @@ function showApproachJobWhileUnemployedTip(client) {
if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachJobWhileUnemployed) { if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachJobWhileUnemployed) {
messagePlayerTip(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;
} }
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -255,7 +255,7 @@ function showTakeNearbyJobTip(client) {
if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.takeJobWhileUnemployed) { if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.takeJobWhileUnemployed) {
messagePlayerTip(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;
} }
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -24,7 +24,7 @@ function loadHousesFromDatabase() {
let tempHouses = []; let tempHouses = [];
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let dbAssoc; let dbAssoc;
if(dbConnection) { if(dbConnection) {
let dbQuery = queryDatabase(dbConnection, `SELECT * FROM house_main WHERE house_server = ${getServerId()}`); let dbQuery = queryDatabase(dbConnection, `SELECT * FROM house_main WHERE house_server = ${getServerId()}`);
if(dbQuery) { if(dbQuery) {
@@ -52,7 +52,7 @@ function createHouseCommand(command, params, client) {
createHouseEntrancePickup(getServerData().houses.length-1); createHouseEntrancePickup(getServerData().houses.length-1);
createHouseExitPickup(getServerData().houses.length-1); createHouseExitPickup(getServerData().houses.length-1);
createHouseEntranceBlip(getServerData().houses.length-1); createHouseEntranceBlip(getServerData().houses.length-1);
createHouseExitBlip(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}`);
} }
@@ -61,11 +61,11 @@ function createHouseCommand(command, params, client) {
function lockUnlockHouseCommand(command, params, client) { 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)) {
messagePlayerError("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);
@@ -82,7 +82,7 @@ function setHouseDescriptionCommand(command, params, client) {
if(!getHouseData(houseId)) { if(!getHouseData(houseId)) {
messagePlayerError("House not found!"); messagePlayerError("House not found!");
return false; return false;
} }
let oldDescription = getHouseData(houseId).description; let oldDescription = getHouseData(houseId).description;
getHouseData(houseId).description = newHouseDescription; getHouseData(houseId).description = newHouseDescription;
@@ -162,13 +162,63 @@ function setHousePickupCommand(command, params, client) {
} }
createHouseEntrancePickup(houseId); createHouseEntrancePickup(houseId);
} }
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]pickup display to [#AAAAAA]${toLowerCase(typeParam)}`); messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]pickup display to [#AAAAAA]${toLowerCase(typeParam)}`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function setHouseInteriorTypeCommand(command, params, client) {
let splitParams = params.split(" ");
let typeParam = splitParams[0] || "none";
let houseId = getHouseFromParams(splitParams[1]) || (isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client));
if(!getHouseData(houseId)) {
messagePlayerError(client, "Business not found!");
return false;
}
if(isNaN(typeParam)) {
if(toLowerCase(typeParam) == "none") {
getHouseData(houseId).exitPosition = toVector3(0.0, 0.0, 0.0);
getHouseData(houseId).exitInterior = -1;
getHouseData(houseId).hasInterior = false;
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]remove house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]interior`);
return false;
}
if(isNull(getGameConfig().interiorTemplates[getServerGame()][typeParam])) {
messagePlayerError(client, "Invalid interior type! Use an interior type name or an existing house database ID");
messagePlayerInfo(client, `Interior Types: [#AAAAAA]${Object.keys(getGameConfig().interiorTemplates[getServerGame()]).join(", ")}`)
return false;
}
getHouseData(houseId).exitPosition = getGameConfig().interiorTemplates[getServerGame()][typeParam].exitPosition;
getHouseData(houseId).exitInterior = getGameConfig().interiorTemplates[getServerGame()][typeParam].exitInterior;
getHouseData(houseId).exitDimension = getHouseData(houseId).databaseId+getGlobalConfig().houseDimensionStart;
getHouseData(houseId).hasInterior = true;
} else {
if(!getHouseData(houseId)) {
messagePlayerError(client, "Business ID not found!");
return false;
}
getHouseData(houseId).exitPosition = getHouseData(houseId).exitPosition;
getHouseData(houseId).exitInterior = getHouseData(houseId).exitInterior;
getHouseData(houseId).exitDimension = getHouseData(houseId).databaseId+getGlobalConfig().houseDimensionStart;
getHouseData(houseId).hasInterior = true;
}
deleteHouseEntrancePickup(houseId);
deleteHouseExitPickup(houseId);
createHouseEntrancePickup(houseId);
createHouseExitPickup(houseId);
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]interior type to [#AAAAAA]${toLowerCase(typeParam)}`);
}
// ---------------------------------------------------------------------------
function setHouseBlipCommand(command, params, client) { function setHouseBlipCommand(command, params, client) {
let typeParam = params || "house"; let typeParam = params || "house";
let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client))); let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)));
@@ -196,7 +246,7 @@ function setHouseBlipCommand(command, params, client) {
} }
createHouseEntranceBlip(houseId); createHouseEntranceBlip(houseId);
} }
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]blip display to [#AAAAAA]${toLowerCase(typeParam)}`); messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]blip display to [#AAAAAA]${toLowerCase(typeParam)}`);
} }
@@ -205,16 +255,16 @@ function setHouseBlipCommand(command, params, client) {
function moveHouseEntranceCommand(command, params, client) { function moveHouseEntranceCommand(command, params, client) {
let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client))); let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)));
getHouseData(houseId).entrancePosition = getPlayerPosition(client); getHouseData(houseId).entrancePosition = getPlayerPosition(client);
getHouseData(houseId).entranceDimension = getPlayerVirtualWorld(client); getHouseData(houseId).entranceDimension = getPlayerVirtualWorld(client);
getHouseData(houseId).entranceInterior = getPlayerInterior(client); getHouseData(houseId).entranceInterior = getPlayerInterior(client);
deleteHouseEntranceBlip(houseId); deleteHouseEntranceBlip(houseId);
deleteHouseEntrancePickup(houseId); deleteHouseEntrancePickup(houseId);
createHouseEntranceBlip(houseId); createHouseEntranceBlip(houseId);
createHouseEntrancePickup(houseId); createHouseEntrancePickup(houseId);
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]moved house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]entrance to their position`); messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]moved house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]entrance to their position`);
} }
@@ -223,14 +273,14 @@ function moveHouseEntranceCommand(command, params, client) {
function moveHouseExitCommand(command, params, client) { function moveHouseExitCommand(command, params, client) {
let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client))); let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)));
getHouseData(houseId).entrancePosition = getPlayerPosition(client); getHouseData(houseId).entrancePosition = getPlayerPosition(client);
getHouseData(houseId).entranceDimension = getPlayerVirtualWorld(client); getHouseData(houseId).entranceDimension = getPlayerVirtualWorld(client);
getHouseData(houseId).entranceInterior = getPlayerInterior(client); getHouseData(houseId).entranceInterior = getPlayerInterior(client);
deleteHouseExitBlip(houseId); deleteHouseExitBlip(houseId);
deleteHouseExitPickup(houseId); deleteHouseExitPickup(houseId);
createHouseExitBlip(houseId); createHouseExitBlip(houseId);
createHouseExitPickup(houseId); createHouseExitPickup(houseId);
@@ -259,7 +309,7 @@ function deleteHouse(houseId, whoDeleted = 0) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let dbQuery = null; let dbQuery = null;
if(dbConnection) { if(dbConnection) {
dbQuery = queryDatabase(dbConnection, `DELETE FROM house_main WHERE house_id = ${tempHouseData.databaseId}`); dbQuery = queryDatabase(dbConnection, `DELETE FROM house_main WHERE house_id = ${tempHouseData.databaseId}`);
if(dbQuery) { if(dbQuery) {
@@ -272,7 +322,7 @@ function deleteHouse(houseId, whoDeleted = 0) {
deleteHouseExitPickup(houseId); deleteHouseExitPickup(houseId);
deleteHouseEntranceBlip(houseId); deleteHouseEntranceBlip(houseId);
deleteHouseExitBlip(houseId); deleteHouseExitBlip(houseId);
removePlayersFromHouse(houseId); removePlayersFromHouse(houseId);
@@ -305,7 +355,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;
return tempHouseData; return tempHouseData;
} }
@@ -361,11 +411,11 @@ function saveHouseToDatabase(houseId) {
if(dbConnection) { if(dbConnection) {
let safeHouseDescription = escapeDatabaseString(dbConnection, tempHouseData.description); let safeHouseDescription = escapeDatabaseString(dbConnection, tempHouseData.description);
if(tempHouseData.databaseId == 0) { if(tempHouseData.databaseId == 0) {
let dbQueryString = `INSERT INTO house_main (house_server, house_description, house_owner_type, house_owner_id, house_locked, house_entrance_pos_x, house_entrance_pos_y, house_entrance_pos_z, house_entrance_rot_z, house_entrance_int, house_entrance_vw, house_exit_pos_x, house_exit_pos_y, house_exit_pos_z, house_exit_rot_z, house_exit_int, house_exit_vw) VALUES (${getServerId()}, '${safeHouseDescription}', ${tempHouseData.ownerType}, ${tempHouseData.ownerId}, ${boolToInt(tempHouseData.locked)}, ${tempHouseData.entrancePosition.x}, ${tempHouseData.entrancePosition.y}, ${tempHouseData.entrancePosition.z}, ${tempHouseData.entranceRotation}, ${tempHouseData.entranceInterior}, ${tempHouseData.entranceDimension}, ${tempHouseData.exitPosition.x}, ${tempHouseData.exitPosition.y}, ${tempHouseData.exitPosition.z}, ${tempHouseData.exitRotation}, ${tempHouseData.exitInterior}, ${tempHouseData.exitDimension})`; let dbQueryString = `INSERT INTO house_main (house_server, house_description, house_owner_type, house_owner_id, house_locked, house_entrance_pos_x, house_entrance_pos_y, house_entrance_pos_z, house_entrance_rot_z, house_entrance_int, house_entrance_vw, house_exit_pos_x, house_exit_pos_y, house_exit_pos_z, house_exit_rot_z, house_exit_int, house_exit_vw, house_has_interior) VALUES (${getServerId()}, '${safeHouseDescription}', ${tempHouseData.ownerType}, ${tempHouseData.ownerId}, ${boolToInt(tempHouseData.locked)}, ${tempHouseData.entrancePosition.x}, ${tempHouseData.entrancePosition.y}, ${tempHouseData.entrancePosition.z}, ${tempHouseData.entranceRotation}, ${tempHouseData.entranceInterior}, ${tempHouseData.entranceDimension}, ${tempHouseData.exitPosition.x}, ${tempHouseData.exitPosition.y}, ${tempHouseData.exitPosition.z}, ${tempHouseData.exitRotation}, ${tempHouseData.exitInterior}, ${tempHouseData.exitDimension}, ${boolToInt(tempHouseData.hasInterior)})`;
queryDatabase(dbConnection, dbQueryString); queryDatabase(dbConnection, dbQueryString);
getServerData().houses[houseId].databaseId = getDatabaseInsertId(dbConnection); getServerData().houses[houseId].databaseId = getDatabaseInsertId(dbConnection);
} else { } else {
let dbQueryString = `UPDATE house_main SET house_description='${safeHouseDescription}', house_owner_type=${tempHouseData.ownerType}, house_owner_id=${tempHouseData.ownerId}, house_locked=${boolToInt(tempHouseData.locked)}, house_entrance_pos_x=${tempHouseData.entrancePosition.x}, house_entrance_pos_y=${tempHouseData.entrancePosition.y}, house_entrance_pos_z=${tempHouseData.entrancePosition.z}, house_entrance_rot_z=${tempHouseData.entranceRotation}, house_entrance_int=${tempHouseData.entranceInterior}, house_entrance_vw=${tempHouseData.entranceDimension}, house_exit_pos_x=${tempHouseData.exitPosition.x}, house_exit_pos_y=${tempHouseData.exitPosition.y}, house_exit_pos_z=${tempHouseData.exitPosition.z}, house_exit_rot_z=${tempHouseData.exitRotation}, house_exit_int=${tempHouseData.exitInterior}, house_exit_vw=${tempHouseData.exitDimension} WHERE house_id=${tempHouseData.databaseId}`; let dbQueryString = `UPDATE house_main SET house_description='${safeHouseDescription}', house_owner_type=${tempHouseData.ownerType}, house_owner_id=${tempHouseData.ownerId}, house_locked=${boolToInt(tempHouseData.locked)}, house_entrance_pos_x=${tempHouseData.entrancePosition.x}, house_entrance_pos_y=${tempHouseData.entrancePosition.y}, house_entrance_pos_z=${tempHouseData.entrancePosition.z}, house_entrance_rot_z=${tempHouseData.entranceRotation}, house_entrance_int=${tempHouseData.entranceInterior}, house_entrance_vw=${tempHouseData.entranceDimension}, house_exit_pos_x=${tempHouseData.exitPosition.x}, house_exit_pos_y=${tempHouseData.exitPosition.y}, house_exit_pos_z=${tempHouseData.exitPosition.z}, house_exit_rot_z=${tempHouseData.exitRotation}, house_exit_int=${tempHouseData.exitInterior}, house_exit_vw=${tempHouseData.exitDimension}, house_has_interior=${boolToInt(tempHouseData.hasInterior)} WHERE house_id=${tempHouseData.databaseId}`;
queryDatabase(dbConnection, dbQueryString); queryDatabase(dbConnection, dbQueryString);
} }
disconnectFromDatabase(dbConnection); disconnectFromDatabase(dbConnection);
@@ -373,7 +423,7 @@ function saveHouseToDatabase(houseId) {
} }
console.log(`[Asshat.house]: Saved house '${tempHouseData.description}' to database!`); console.log(`[Asshat.house]: Saved house '${tempHouseData.description}' to database!`);
return false; return false;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -456,7 +506,7 @@ function createHouseExitPickup(houseId) {
getHouseData(houseId).exitPickup.dimension = getHouseData(houseId).exitDimension; getHouseData(houseId).exitPickup.dimension = getHouseData(houseId).exitDimension;
//getHouseData(houseId).exitPickup.interior = getHouseData(houseId).exitInterior; //getHouseData(houseId).exitPickup.interior = getHouseData(houseId).exitInterior;
getHouseData(houseId).exitPickup.setData("ag.owner.type", AG_PICKUP_HOUSE_EXIT, false); getHouseData(houseId).exitPickup.setData("ag.owner.type", AG_PICKUP_HOUSE_EXIT, false);
getHouseData(houseId).exitPickup.setData("ag.owner.id", houseId, false); getHouseData(houseId).exitPickup.setData("ag.owner.id", houseId, false);
getHouseData(houseId).exitPickup.setData("ag.label.type", AG_LABEL_EXIT, true); getHouseData(houseId).exitPickup.setData("ag.label.type", AG_LABEL_EXIT, true);
addToWorld(getHouseData(houseId).exitPickup); addToWorld(getHouseData(houseId).exitPickup);
} }
@@ -493,17 +543,17 @@ function getHouseOwnerTypeText(ownerType) {
return "clan"; return "clan";
case AG_HOUSEOWNER_PLAYER: case AG_HOUSEOWNER_PLAYER:
return "player"; return "player";
case AG_BIZOWNER_NONE: case AG_BIZOWNER_NONE:
return "not owned"; return "not owned";
case AG_BIZOWNER_PUBLIC: case AG_BIZOWNER_PUBLIC:
return "not owned"; return "not owned";
case AG_BIZOWNER_JOB: case AG_BIZOWNER_JOB:
return "job"; return "job";
default: default:
return "unknown"; return "unknown";
} }
@@ -544,8 +594,8 @@ function getHouseInfoCommand(command, params, client) {
case AG_HOUSEOWNER_JOB: case AG_HOUSEOWNER_JOB:
ownerName = getJobData(getHouseData(houseId).ownerId).name; ownerName = getJobData(getHouseData(houseId).ownerId).name;
break; break;
} }
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}`); 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}`);
} }
@@ -572,33 +622,9 @@ function doesHouseHaveInterior(houseId) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function sendAllHouseLabelsToPlayer(client) {
let tempHouseLabels = [];
let totalHouses = getServerData().houses.length;
let housesPerNetworkEvent = 100;
let totalNetworkEvents = Math.ceil(totalHouses/housesPerNetworkEvent);
for(let i = 0 ; i < totalNetworkEvents ; i++) {
for(let j = 0 ; j < housesPerNetworkEvent ; j++) {
let tempHouseId = (i*housesPerNetworkEvent)+j;
if(typeof getServerData().houses[tempHouseId] != "undefined") {
tempHouseLabels.push([tempHouseId, getServerData().houses[tempHouseId].entrancePosition, getGameConfig().propertyLabelHeight[getServerGame()], getServerData().houses[tempHouseId].description, getServerData().houses[tempHouseId].locked, false]);
}
}
triggerNetworkEvent("ag.houselabel.all", client, tempHouseLabels);
tempHouseLabels = [];
}
}
// ---------------------------------------------------------------------------
function sendHouseLabelToPlayers(houseId) {
triggerNetworkEvent("ag.houselabel.add", null, houseId, getServerData().houses[houseId].entrancePosition, getGameConfig().propertyLabelHeight[getServerGame()], getServerData().houses[houseId].description, getServerData().houses[houseId].locked, false);
}
// ---------------------------------------------------------------------------
function deleteHouseEntrancePickup(houseId) { function deleteHouseEntrancePickup(houseId) {
if(getHouseData(houseId).entrancePickup != null) { if(getHouseData(houseId).entrancePickup != null) {
removeFromWorld(getHouseData(houseId).entrancePickup);
destroyElement(getHouseData(houseId).entrancePickup); destroyElement(getHouseData(houseId).entrancePickup);
getHouseData(houseId).entrancePickup = null; getHouseData(houseId).entrancePickup = null;
} }
@@ -608,15 +634,17 @@ function deleteHouseEntrancePickup(houseId) {
function deleteHouseExitPickup(houseId) { function deleteHouseExitPickup(houseId) {
if(getHouseData(houseId).exitPickup != null) { if(getHouseData(houseId).exitPickup != null) {
removeFromWorld(getHouseData(houseId).exitPickup);
destroyElement(getHouseData(houseId).exitPickup); destroyElement(getHouseData(houseId).exitPickup);
getHouseData(houseId).exitPickup = null; getHouseData(houseId).exitPickup = null;
} }
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function deleteHouseEntranceBlip(houseId) { function deleteHouseEntranceBlip(houseId) {
if(getHouseData(houseId).entranceBlip != null) { if(getHouseData(houseId).entranceBlip != null) {
removeFromWorld(getHouseData(houseId).entranceBlip);
destroyElement(getHouseData(houseId).entranceBlip); destroyElement(getHouseData(houseId).entranceBlip);
getHouseData(houseId).entranceBlip = null; getHouseData(houseId).entranceBlip = null;
} }
@@ -626,9 +654,10 @@ function deleteHouseEntranceBlip(houseId) {
function deleteHouseExitBlip(houseId) { function deleteHouseExitBlip(houseId) {
if(getHouseData(houseId).exitBlip != null) { if(getHouseData(houseId).exitBlip != null) {
removeFromWorld(getHouseData(houseId).exitBlip);
destroyElement(getHouseData(houseId).exitBlip); destroyElement(getHouseData(houseId).exitBlip);
getHouseData(houseId).exitBlip = null; getHouseData(houseId).exitBlip = null;
} }
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -647,16 +676,12 @@ function reloadAllHousesCommand(command, params, client) {
deleteHouseExitPickup(i); deleteHouseExitPickup(i);
deleteHouseEntrancePickup(i); deleteHouseEntrancePickup(i);
} }
getServerData().houses = null; getServerData().houses = null;
getServerData().houses = loadHouseFromDatabase(); getServerData().houses = loadHouseFromDatabase();
createAllHousePickups(); createAllHousePickups();
createAllHouseBlips(); createAllHouseBlips();
for(let i in clients) {
sendAllHouseLabelsToPlayer(clients[i]);
}
messageAdminAction(`All houses have been reloaded by an admin!`); messageAdminAction(`All houses have been reloaded by an admin!`);
} }

View File

@@ -16,8 +16,6 @@ function initJobScript() {
createAllJobPickups(); createAllJobPickups();
createAllJobBlips(); createAllJobBlips();
//addEvent("onJobPickupCollected", null, 2);
console.log("[Asshat.Job]: Job script initialized successfully!"); console.log("[Asshat.Job]: Job script initialized successfully!");
return true; return true;
} }
@@ -31,7 +29,7 @@ function loadJobsFromDatabase() {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let dbQuery = null; let dbQuery = null;
let dbAssoc; let dbAssoc;
if(dbConnection) { if(dbConnection) {
dbQuery = queryDatabase(dbConnection, `SELECT * FROM job_main WHERE job_enabled = 1 AND job_server = ${getServerId()}`); dbQuery = queryDatabase(dbConnection, `SELECT * FROM job_main WHERE job_enabled = 1 AND job_server = ${getServerId()}`);
if(dbQuery) { if(dbQuery) {
@@ -87,7 +85,7 @@ function loadJobEquipmentsFromDatabase(jobDatabaseId) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let dbQuery = null; let dbQuery = null;
let dbAssoc; let dbAssoc;
if(dbConnection) { if(dbConnection) {
dbQuery = queryDatabase(dbConnection, "SELECT * FROM `job_equip` WHERE `job_equip_enabled` = 1 AND `job_equip_job` = " + toString(jobDatabaseId)); dbQuery = queryDatabase(dbConnection, "SELECT * FROM `job_equip` WHERE `job_equip_enabled` = 1 AND `job_equip_job` = " + toString(jobDatabaseId));
if(dbQuery) { if(dbQuery) {
@@ -117,7 +115,7 @@ function loadJobLocationsFromDatabase(jobDatabaseId) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let dbQuery = null; let dbQuery = null;
let dbAssoc; let dbAssoc;
if(dbConnection) { if(dbConnection) {
dbQuery = queryDatabase(dbConnection, "SELECT * FROM `job_loc` WHERE `job_loc_enabled` = 1 AND `job_loc_job` = " + toString(jobDatabaseId)); dbQuery = queryDatabase(dbConnection, "SELECT * FROM `job_loc` WHERE `job_loc_enabled` = 1 AND `job_loc_job` = " + toString(jobDatabaseId));
if(dbQuery) { if(dbQuery) {
@@ -146,7 +144,7 @@ function loadJobUniformsFromDatabase(jobDatabaseId) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let dbQuery = null; let dbQuery = null;
let dbAssoc; let dbAssoc;
if(dbConnection) { if(dbConnection) {
dbQuery = queryDatabase(dbConnection, "SELECT * FROM `job_uniform` WHERE `job_uniform_enabled` = 1 AND `job_uniform_job` = " + toString(jobDatabaseId)); dbQuery = queryDatabase(dbConnection, "SELECT * FROM `job_uniform` WHERE `job_uniform_enabled` = 1 AND `job_uniform_job` = " + toString(jobDatabaseId));
if(dbQuery) { if(dbQuery) {
@@ -175,7 +173,7 @@ function loadJobEquipmentWeaponsFromDatabase(jobEquipmentDatabaseId) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
let dbQuery = null; let dbQuery = null;
let dbAssoc; let dbAssoc;
if(dbConnection) { if(dbConnection) {
dbQuery = queryDatabase(dbConnection, "SELECT * FROM `job_equip_wep` WHERE `job_equip_wep_enabled` = 1 AND `job_equip_wep_equip` = " + toString(jobEquipmentDatabaseId)); dbQuery = queryDatabase(dbConnection, "SELECT * FROM `job_equip_wep` WHERE `job_equip_wep_enabled` = 1 AND `job_equip_wep_equip` = " + toString(jobEquipmentDatabaseId));
if(dbQuery) { if(dbQuery) {
@@ -239,7 +237,7 @@ function createAllJobPickups() {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function showJobInformationToPlayer(client, jobType) { function showJobInformationToPlayer(client, jobType) {
if(!canPlayerUseJobs(client)){ if(!canPlayerUseJobs(client)){
return false; return false;
} }
@@ -250,16 +248,16 @@ function showJobInformationToPlayer(client, jobType) {
switch(jobType) { switch(jobType) {
case AG_JOB_POLICE: case AG_JOB_POLICE:
if(!canPlayerUsePoliceJob(client)) { if(!canPlayerUsePoliceJob(client)) {
return false; return false;
} }
messagePlayerInfo(client, "== Job Help ================================="); messagePlayerInfo(client, "== Job Help =================================");
messagePlayerInfo(client, "- Police Officers are enforcers of the law."); messagePlayerInfo(client, "- Police Officers are enforcers of the law.");
messagePlayerInfo(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.");
messagePlayerInfo(client, "- Use /laws to see a list of laws."); messagePlayerInfo(client, "- Use /laws to see a list of laws.");
messagePlayerInfo(client, "- Commands are: /cuff, /drag, /detain, /arrest, /search /tazer /radio"); messagePlayerInfo(client, "- Commands are: /cuff, /drag, /detain, /arrest, /search /tazer /radio");
messagePlayerInfo(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:
@@ -272,10 +270,10 @@ function showJobInformationToPlayer(client, jobType) {
break; break;
case AG_JOB_FIRE: case AG_JOB_FIRE:
if(!canClientUseFireJob(client)){ if(!canClientUseFireJob(client)){
return false; return false;
} }
messagePlayerInfo(client, "== Job Help ================================="); messagePlayerInfo(client, "== Job Help =================================");
messagePlayerInfo(client, "- Firefighters put out vehicle and building fires."); messagePlayerInfo(client, "- Firefighters put out vehicle and building fires.");
messagePlayerInfo(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.");
messagePlayerInfo(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.");
@@ -299,7 +297,7 @@ function showJobInformationToPlayer(client, jobType) {
messagePlayerInfo(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.");
messagePlayerInfo(client, "- The meter will run until the player exits the vehicle."); messagePlayerInfo(client, "- The meter will run until the player exits the vehicle.");
messagePlayerInfo(client, "- You will automatically receive the fare money"); messagePlayerInfo(client, "- You will automatically receive the fare money");
messagePlayerInfo(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:
@@ -328,7 +326,7 @@ function showJobInformationToPlayer(client, jobType) {
function takeJobCommand(command, params, client) { function takeJobCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messagePlayerError(client, "You are not allowed to use any jobs!"); messagePlayerError(client, "You are not allowed to use any jobs!");
return false; return false;
} }
@@ -342,14 +340,14 @@ function takeJobCommand(command, params, client) {
if(getPlayerCurrentSubAccount(client).job > AG_JOB_NONE) { if(getPlayerCurrentSubAccount(client).job > AG_JOB_NONE) {
messagePlayerError(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)) {
messagePlayerError(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);
messagePlayerSuccess(client, "You now have the " + toString(jobData.name) + " job"); messagePlayerSuccess(client, "You now have the " + toString(jobData.name) + " job");
return true; return true;
@@ -358,7 +356,7 @@ function takeJobCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function startWorkingCommand(command, params, client) { function startWorkingCommand(command, params, client) {
if(!canPlayerUseJobs(client)){ if(!canPlayerUseJobs(client)){
return false; return false;
} }
@@ -367,7 +365,7 @@ function startWorkingCommand(command, params, client) {
if(closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) { if(closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) {
messagePlayerError(client, "There are no job points close enough!"); messagePlayerError(client, "There are no job points close enough!");
return false; return false;
} }
if(getPlayerCurrentSubAccount(client).job == AG_JOB_NONE) { if(getPlayerCurrentSubAccount(client).job == AG_JOB_NONE) {
@@ -381,7 +379,7 @@ function startWorkingCommand(command, params, client) {
messagePlayerInfo(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;
} }
messagePlayerSuccess(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);
@@ -391,7 +389,7 @@ function startWorkingCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function stopWorkingCommand(command, params, client) { function stopWorkingCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
return false; return false;
} }
@@ -415,7 +413,7 @@ function stopWorkingCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function startWorking(client) { function startWorking(client) {
if(!canPlayerUseJobs(client)){ if(!canPlayerUseJobs(client)){
return false; return false;
} }
@@ -478,7 +476,7 @@ function getJobLocationInfoCommand(command, params, client) {
//if(!getJobData(getJobIdFromDatabaseId(closestJobLocation.job))) { //if(!getJobData(getJobIdFromDatabaseId(closestJobLocation.job))) {
// messagePlayerError(client, "Job not found!"); // messagePlayerError(client, "Job not found!");
// return false; // return false;
//} //}
messagePlayerInfo(client, `[#FFFF00][Job Location Info] [#FFFFFF]Job: [#AAAAAA]${getJobData(closestJobLocation.job).name} (${getJobData(closestJobLocation.job).id}/${closestJobLocation.job}), [#FFFFFF]Enabled: [#AAAAAA]${getYesNoFromBool(closestJobLocation.enabled)}, [#FFFFFF]Database ID: [#AAAAAA]${closestJobLocation.databaseId}`); messagePlayerInfo(client, `[#FFFF00][Job Location Info] [#FFFFFF]Job: [#AAAAAA]${getJobData(closestJobLocation.job).name} (${getJobData(closestJobLocation.job).id}/${closestJobLocation.job}), [#FFFFFF]Enabled: [#AAAAAA]${getYesNoFromBool(closestJobLocation.enabled)}, [#FFFFFF]Database ID: [#AAAAAA]${closestJobLocation.databaseId}`);
} }
@@ -501,7 +499,7 @@ function givePlayerJobEquipment(client, equipmentId) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function stopWorking(client) { function stopWorking(client) {
if(!canPlayerUseJobs(client)){ if(!canPlayerUseJobs(client)){
return false; return false;
} }
@@ -531,8 +529,8 @@ function stopWorking(client) {
getPlayerCurrentSubAccount(client).lastJobVehicle = false; getPlayerCurrentSubAccount(client).lastJobVehicle = false;
} }
triggerNetworkEvent("ag.clearWeapons", client); triggerNetworkEvent("ag.clearWeapons", client);
let jobId = getPlayerCurrentSubAccount(client).job; let jobId = getPlayerCurrentSubAccount(client).job;
switch(getJobType(jobId)) { switch(getJobType(jobId)) {
@@ -571,7 +569,7 @@ function stopWorking(client) {
} }
updatePlayerNameTag(client); updatePlayerNameTag(client);
triggerNetworkEvent("ag.working", client, false); triggerNetworkEvent("ag.working", client, false);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -583,7 +581,7 @@ function jobUniformCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
messagePlayerNormal(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) {
messagePlayerNormal(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})`);
} }
@@ -602,8 +600,8 @@ function jobUniformCommand(command, params, client) {
return false; return false;
} }
messagePlayerSuccess(client, `You put on the ${uniforms[uniformId-1].name} uniform`); messagePlayerSuccess(client, `You put on the [#AAAAAA]${uniforms[uniformId-1].name} [#FFFFFF]uniform`);
triggerNetworkEvent("ag.pedSkin", null, client.player, uniforms[uniformId-1].skin); setPlayerSkin(client, uniforms[uniformId-1].skin);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -632,7 +630,7 @@ function jobEquipmentCommand(command, params, client) {
messagePlayerError(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);
messagePlayerSuccess(client, `You have been given the ${equipments[equipmentId-1].name} equipment`); messagePlayerSuccess(client, `You have been given the ${equipments[equipmentId-1].name} equipment`);
} }
@@ -640,7 +638,7 @@ function jobEquipmentCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function quitJobCommand(command, params, client) { function quitJobCommand(command, params, client) {
if(!canPlayerUseJobs(client)){ if(!canPlayerUseJobs(client)){
return false; return false;
} }
@@ -652,7 +650,7 @@ function quitJobCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function jobRadioCommand(command, params, client) { function jobRadioCommand(command, params, client) {
if(!canPlayerUseJobs(client)){ if(!canPlayerUseJobs(client)){
return false; return false;
} }
@@ -662,7 +660,7 @@ function jobRadioCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function jobDepartmentRadioCommand(command, params, client) { function jobDepartmentRadioCommand(command, params, client) {
if(!canPlayerUseJobs(client)){ if(!canPlayerUseJobs(client)){
return false; return false;
} }
@@ -717,18 +715,13 @@ function reloadAllJobsCommand(command, params, client) {
destroyElement(getServerData().jobs[i].locations[j].pickup); destroyElement(getServerData().jobs[i].locations[j].pickup);
} }
} }
//forceAllPlayersToStopWorking(); //forceAllPlayersToStopWorking();
getServerData().jobs = null; getServerData().jobs = null;
getServerData().jobs = loadJobsFromDatabase(); getServerData().jobs = loadJobsFromDatabase();
createAllJobPickups(); createAllJobPickups();
createAllJobBlips(); createAllJobBlips();
let clients = getClients();
for(let i in clients) {
sendAllJobLabelsToPlayer(clients[i]);
}
messageAdminAction(`All server jobs have been reloaded by an admin!`); messageAdminAction(`All server jobs have been reloaded by an admin!`);
} }
@@ -741,7 +734,7 @@ function createJobLocationCommand(command, params, client) {
} }
let jobId = getJobFromParams(params); let jobId = getJobFromParams(params);
if(!getJobData(jobId)) { if(!getJobData(jobId)) {
messagePlayerError(client, "That job was not found!"); messagePlayerError(client, "That job was not found!");
return false; return false;
@@ -758,9 +751,10 @@ function deleteJobLocationCommand(command, params, client) {
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client)); let closestJobLocation = getClosestJobLocation(getPlayerPosition(client));
let jobData = getJobData(closestJobLocation.job); let jobData = getJobData(closestJobLocation.job);
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]${getEnabledDisabledFromBool(closestJobLocation.enabled)} location [#AAAAAA]${closestJobLocation.databaseId} [#FFFFFF]for the [#AAAAAA]${jobData.name} [#FFFFFF]job`); messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]deleted location [#AAAAAA]${closestJobLocation.databaseId} [#FFFFFF]for the [#AAAAAA]${jobData.name} [#FFFFFF]job`);
deleteJobLocation(closestJobLocation); deleteJobLocation(closestJobLocation);
getJobData(closestJobLocation.job).locations.splice(getClosestJobLocation.index, 1);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -954,7 +948,7 @@ function forceAllPlayersToStopWorking() {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function jobStartRouteCommand(command, params, client) { function jobStartRouteCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messagePlayerError(client, "You are not allowed to use jobs."); messagePlayerError(client, "You are not allowed to use jobs.");
return false; return false;
} }
@@ -971,9 +965,9 @@ function jobStartRouteCommand(command, params, client) {
if(!isPlayerInJobVehicle(client)) { if(!isPlayerInJobVehicle(client)) {
messagePlayerError(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;
} }
startJobRoute(client); startJobRoute(client);
return true; return true;
@@ -982,7 +976,7 @@ function jobStartRouteCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function jobStopRouteCommand(command, params, client) { function jobStopRouteCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messagePlayerError(client, "You are not allowed to use jobs."); messagePlayerError(client, "You are not allowed to use jobs.");
return false; return false;
} }
@@ -999,7 +993,7 @@ function jobStopRouteCommand(command, params, client) {
if(!isPlayerOnJobRoute(client)) { if(!isPlayerOnJobRoute(client)) {
messagePlayerError(client, "You aren't on a job route!"); messagePlayerError(client, "You aren't on a job route!");
return false; return false;
} }
stopJobRoute(client); stopJobRoute(client);
@@ -1045,7 +1039,7 @@ function startJobRoute(client) {
let garbageRoute = getRandomBusRoute(getPlayerIsland(client)); let garbageRoute = getRandomBusRoute(getPlayerIsland(client));
getPlayerData(client).jobRoute = garbageRoute; getPlayerData(client).jobRoute = garbageRoute;
getPlayerData(client).jobRouteStop = 0; getPlayerData(client).jobRouteStop = 0;
getPlayerData(client).jobRouteIsland = getPlayerIsland(client); getPlayerData(client).jobRouteIsland = getPlayerIsland(client);
getPlayerData(client).jobRouteVehicle = getPlayerVehicle(client); getPlayerData(client).jobRouteVehicle = getPlayerVehicle(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;
@@ -1103,7 +1097,7 @@ function getPlayerJobRouteVehicle(client) {
return getPlayerData(client).busRouteVehicle; return getPlayerData(client).busRouteVehicle;
} else if(doesPlayerHaveJobType(client, AG_JOB_GARBAGE)) { } else if(doesPlayerHaveJobType(client, AG_JOB_GARBAGE)) {
return getPlayerData(client).garbageRouteVehicle; return getPlayerData(client).garbageRouteVehicle;
} }
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -1132,7 +1126,7 @@ function stopReturnToJobVehicleCountdown(client) {
clearInterval(getPlayerData(client).returnToJobVehicleTimer); clearInterval(getPlayerData(client).returnToJobVehicleTimer);
getPlayerData(client).returnToJobVehicleTimer = null; getPlayerData(client).returnToJobVehicleTimer = null;
} }
//getPlayerData(client).returnToJobVehicleTick = 0; //getPlayerData(client).returnToJobVehicleTick = 0;
} }
@@ -1183,14 +1177,14 @@ function canPlayerUseJob(client, jobId) {
if(!isPlayerOnJobWhiteList(client, jobId)) { if(!isPlayerOnJobWhiteList(client, jobId)) {
return false return false
} }
} }
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function deleteJobLocation(jobLocationData) { function deleteJobLocation(jobLocationData) {
removeFromWorld(jobLocationData.pickup);
destroyElement(jobLocationData.pickup); destroyElement(jobLocationData.pickup);
triggerNetworkEvent("ag.joblabel.del", jobLocationData.databaseId);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -1222,7 +1216,21 @@ function getJobIdFromDatabaseId(databaseId) {
function setAllJobDataIndexes() { function setAllJobDataIndexes() {
for(let i in getServerData().jobs) { for(let i in getServerData().jobs) {
getServerData().jobs[i].id = i; getServerData().jobs[i].index = i;
for(let j in getServerData().jobs[i].locations) {
getServerData().jobs[i].locations[j].index = j;
}
for(let k in getServerData().jobs[i].uniforms) {
getServerData().jobs[i].uniforms[k].index = k;
}
for(let m in getServerData().jobs[i].equipment) {
getServerData().jobs[i].equipment[m].index = m;
for(let n in getServerData().jobs[i].equipment[m].weapons) {
getServerData().jobs[i].equipment[m].weapons[n].index = n;
}
}
} }
} }
@@ -1397,7 +1405,7 @@ function saveAllJobsToDatabase() {
for(let k in getServerData().jobs[i].uniforms) { for(let k in getServerData().jobs[i].uniforms) {
saveJobUniformToDatabase(getServerData().jobs[i].uniforms[k]); saveJobUniformToDatabase(getServerData().jobs[i].uniforms[k]);
} }
for(let m in getServerData().jobs[i].equipment) { for(let m in getServerData().jobs[i].equipment) {
saveJobEquipmentToDatabase(getServerData().jobs[i].equipment[m]); saveJobEquipmentToDatabase(getServerData().jobs[i].equipment[m]);

View File

@@ -14,13 +14,14 @@
let busRoutes = [ let busRoutes = [
false, false,
[ // GTA 3 (1) [ // GTA 3 (1)
[ // PORTLAND ISLAND (0) [ // PORTLAND ISLAND (0)
{ // RED ROUTE (0) { // RED ROUTE (0)
name: "Portland Red Line", name: "Portland Red Line",
island: 0, island: 0,
busColour: 3, busColour: 3,
payout: 175,
positions: [ positions: [
toVector3(1269, -1056.4, 14.75), toVector3(1269, -1056.4, 14.75),
toVector3(1088.7, -968.8, 14.91), toVector3(1088.7, -968.8, 14.91),
@@ -45,135 +46,14 @@ let busRoutes = [
toVector3(1307.5, -995.54, 14.88), toVector3(1307.5, -995.54, 14.88),
], ],
}, },
{ // BLUE ROUTE (1)
name: "Portland Blue Line",
island: 0,
busColour: 2,
positions: [
toVector3(1269, -1056.4, 14.75),
toVector3(1088.7, -968.8, 14.91),
toVector3(1059.1, -870.9, 14.91),
toVector3(917.6, -815.9, 14.91),
toVector3(851.1, -766.1, 14.91),
toVector3(838.8, -598.7, 14.91),
toVector3(959.3, -581.6, 14.91),
toVector3(853.1, -485.9, 14.91),
toVector3(838.8, -312.68, 6.8),
toVector3(913.9, -177.4, 4.91),
toVector3(1123.3, -67.74, 7.41),
toVector3(1043.6, -191.63, 4.91),
toVector3(1213.2, -281.3, 25.76),
toVector3(1193.3, -474.3, 24.98),
toVector3(1335.4, -499.7, 45.28),
toVector3(1220.3, -341.4, 26.38),
toVector3(1122.6, -475.6, 19.91),
toVector3(1309.2, -642.4, 12.3),
toVector3(1350.5, -845, 14.91),
toVector3(1322.2, -1025.3, 14.76),
toVector3(1307.5, -995.54, 14.88),
],
},
{ // YELLOW ROUTE (2)
name: "Portland Yellow Line",
island: 0,
busColour: 6,
positions: [
toVector3(1269, -1056.4, 14.75),
toVector3(1088.7, -968.8, 14.91),
toVector3(1059.1, -870.9, 14.91),
toVector3(917.6, -815.9, 14.91),
toVector3(851.1, -766.1, 14.91),
toVector3(838.8, -598.7, 14.91),
toVector3(959.3, -581.6, 14.91),
toVector3(853.1, -485.9, 14.91),
toVector3(838.8, -312.68, 6.8),
toVector3(913.9, -177.4, 4.91),
toVector3(1123.3, -67.74, 7.41),
toVector3(1043.6, -191.63, 4.91),
toVector3(1213.2, -281.3, 25.76),
toVector3(1193.3, -474.3, 24.98),
toVector3(1335.4, -499.7, 45.28),
toVector3(1220.3, -341.4, 26.38),
toVector3(1122.6, -475.6, 19.91),
toVector3(1309.2, -642.4, 12.3),
toVector3(1350.5, -845, 14.91),
toVector3(1322.2, -1025.3, 14.76),
toVector3(1307.5, -995.54, 14.88),
],
},
], ],
[ // STAUNTON ISLAND (1) [ // STAUNTON ISLAND (1)
{ // RED ROUTE (0) { // RED ROUTE (0)
name: "Staunton Red Line", name: "Staunton Red Line",
island: 1, island: 1,
busColour: 3, busColour: 3,
positions: [ payout: 175,
toVector3(-1.11, -388.4, 16.11),
toVector3(-15.75, -735.3, 26.15),
toVector3(33.63, -1029.4, 26.11),
toVector3(-53.92, -1233.4, 26.11),
toVector3(126.58, -1323.7, 26.11),
toVector3(189.39, -1285.6, 26.11),
toVector3(266.9, -1179.1, 26.11),
toVector3(283.93, -1370.2, 26.11),
toVector3(144.44, -1455.5, 26.11),
toVector3(34.5, -1511.7, 26.11),
toVector3(325.31, -1579, 26.03),
toVector3(302.33, -1417.7, 26.11),
toVector3(309.76, -1290, 26.11),
toVector3(378.5, -1235.1, 26.11),
toVector3(404, -1376.3, 26.11),
toVector3(189.07, -1159.3, 26.11),
toVector3(189.44, -956.9, 26.11),
toVector3(254.18, -722.3, 26.11),
toVector3(383.4, -704.2, 26.11),
toVector3(429.3, -420.6, 22.04),
toVector3(570.9, -336.4, 19.71),
toVector3(267.46, 91.12, 15.96),
toVector3(99.13, -31.96, 16.11),
toVector3(243.94, -187.01, 21.31),
toVector3(99.17, -263.44, 16.11),
toVector3(-26.92, -283.73, 16.11),
],
},
{ // BLUE ROUTE (1)
name: "Staunton Blue Line",
island: 1,
busColour: 2,
positions: [
toVector3(-1.11, -388.4, 16.11),
toVector3(-15.75, -735.3, 26.15),
toVector3(33.63, -1029.4, 26.11),
toVector3(-53.92, -1233.4, 26.11),
toVector3(126.58, -1323.7, 26.11),
toVector3(189.39, -1285.6, 26.11),
toVector3(266.9, -1179.1, 26.11),
toVector3(283.93, -1370.2, 26.11),
toVector3(144.44, -1455.5, 26.11),
toVector3(34.5, -1511.7, 26.11),
toVector3(325.31, -1579, 26.03),
toVector3(302.33, -1417.7, 26.11),
toVector3(309.76, -1290, 26.11),
toVector3(378.5, -1235.1, 26.11),
toVector3(404, -1376.3, 26.11),
toVector3(189.07, -1159.3, 26.11),
toVector3(189.44, -956.9, 26.11),
toVector3(254.18, -722.3, 26.11),
toVector3(383.4, -704.2, 26.11),
toVector3(429.3, -420.6, 22.04),
toVector3(570.9, -336.4, 19.71),
toVector3(267.46, 91.12, 15.96),
toVector3(99.13, -31.96, 16.11),
toVector3(243.94, -187.01, 21.31),
toVector3(99.17, -263.44, 16.11),
toVector3(-26.92, -283.73, 16.11),
],
},
{ // YELLOW ROUTE (2)
name: "Staunton Yellow Line",
island: 1,
busColour: 6,
positions: [ positions: [
toVector3(-1.11, -388.4, 16.11), toVector3(-1.11, -388.4, 16.11),
toVector3(-15.75, -735.3, 26.15), toVector3(-15.75, -735.3, 26.15),
@@ -206,13 +86,14 @@ let busRoutes = [
], ],
], ],
[ // GTA VC [ // GTA VC
[ // WESTERN ISLAND (0) [ // WESTERN ISLAND (0)
{ // RED ROUTE (0) { // RED ROUTE (0)
name: "Vice City Red Line", name: "Vice City Red Line",
island: 0, island: 0,
busColour: 3, busColour: 3,
payout: 100,
positions: [ positions: [
toVector3(-997.698, 175.8, 10.704), toVector3(-997.698, 175.8, 10.704),
toVector3(-607.007, 659.024, 10.9994), toVector3(-607.007, 659.024, 10.9994),
@@ -228,9 +109,10 @@ let busRoutes = [
], ],
}, },
{ // GREEN ROUTE (1) { // GREEN ROUTE (1)
name: "Vice City Green Line", name: "Vice City Green Line",
island: 0, island: 0,
busColour: 46, busColour: 46,
payout: 250,
positions: [ positions: [
toVector3(-1106.57, -300.12, 11.189), toVector3(-1106.57, -300.12, 11.189),
toVector3(-1012.97, -372.445, 10.8688), toVector3(-1012.97, -372.445, 10.8688),
@@ -259,46 +141,13 @@ let busRoutes = [
toVector3(-748.054, 198.243, 11.2455), toVector3(-748.054, 198.243, 11.2455),
toVector3(-850, -110.625, 11.0203), toVector3(-850, -110.625, 11.0203),
toVector3(-898.862, -280.373, 10.6645), toVector3(-898.862, -280.373, 10.6645),
toVector3(-1082.1, -294.416, 11.2065), toVector3(-1082.1, -294.416, 11.2065),
],
},
{ // YELLOW ROUTE (2)
name: "Staunton Yellow Line",
island: 1,
busColour: 6,
positions: [
toVector3(-1.11, -388.4, 16.11),
toVector3(-15.75, -735.3, 26.15),
toVector3(33.63, -1029.4, 26.11),
toVector3(-53.92, -1233.4, 26.11),
toVector3(126.58, -1323.7, 26.11),
toVector3(189.39, -1285.6, 26.11),
toVector3(266.9, -1179.1, 26.11),
toVector3(283.93, -1370.2, 26.11),
toVector3(144.44, -1455.5, 26.11),
toVector3(34.5, -1511.7, 26.11),
toVector3(325.31, -1579, 26.03),
toVector3(302.33, -1417.7, 26.11),
toVector3(309.76, -1290, 26.11),
toVector3(378.5, -1235.1, 26.11),
toVector3(404, -1376.3, 26.11),
toVector3(189.07, -1159.3, 26.11),
toVector3(189.44, -956.9, 26.11),
toVector3(254.18, -722.3, 26.11),
toVector3(383.4, -704.2, 26.11),
toVector3(429.3, -420.6, 22.04),
toVector3(570.9, -336.4, 19.71),
toVector3(267.46, 91.12, 15.96),
toVector3(99.13, -31.96, 16.11),
toVector3(243.94, -187.01, 21.31),
toVector3(99.17, -263.44, 16.11),
toVector3(-26.92, -283.73, 16.11),
], ],
}, },
], ],
], ],
[ // GTA SA [ // GTA SA
[ // LOS SANTOS ISLAND (0) [ // LOS SANTOS ISLAND (0)
{ // RED ROUTE (0) { // RED ROUTE (0)
@@ -310,14 +159,15 @@ let busRoutes = [
* Unity Station (Yellow, Blue, Green) * Unity Station (Yellow, Blue, Green)
* Ganton (Green) * Ganton (Green)
* Airport Gate (Yellow) * Airport Gate (Yellow)
Notable Stops: Notable Stops:
* Docks * Docks
* Airport Gate * Airport Gate
*/ */
name: "Los Santos Yellow Line", name: "Los Santos Yellow Line",
island: 0, island: 0,
busColour: 6, busColour: 6,
payout: 200,
positions: [ positions: [
toVector3(1823.79, -1852.66, 13.5144), toVector3(1823.79, -1852.66, 13.5144),
toVector3(1804.12, -1609.59, 13.4419), toVector3(1804.12, -1609.59, 13.4419),
@@ -340,7 +190,7 @@ let busRoutes = [
toVector3(1963.51, -1969.6, 13.5867), toVector3(1963.51, -1969.6, 13.5867),
toVector3(1824.2, -1886.48, 13.4287), toVector3(1824.2, -1886.48, 13.4287),
] ]
}, },
{ // BLUE ROUTE (1) { // BLUE ROUTE (1)
/* /*
Serves: Serves:
@@ -352,7 +202,7 @@ let busRoutes = [
* Glen Park (Yellow, Green) * Glen Park (Yellow, Green)
* Alhambra Club (Yellow, Green) * Alhambra Club (Yellow, Green)
* All Saints General Hospital (Yellow) * All Saints General Hospital (Yellow)
Notable Stops: Notable Stops:
* Madd Doggs Mansion * Madd Doggs Mansion
* All Saints General Hospital * All Saints General Hospital
@@ -360,11 +210,12 @@ let busRoutes = [
* Vinewood Blvd * Vinewood Blvd
* Vinewood Hills * Vinewood Hills
* Santa Maria Beach/Pier * Santa Maria Beach/Pier
*/ */
name: "Los Santos Blue Line", name: "Los Santos Blue Line",
island: 0, island: 0,
busColour: 2, busColour: 2,
positions: [ payout: 250,
positions: [
toVector3(1824.17, -1851.5, 13.5134), toVector3(1824.17, -1851.5, 13.5134),
toVector3(1853.95, -1395.48, 13.4882), toVector3(1853.95, -1395.48, 13.4882),
toVector3(1659.33, -1158.59, 23.8368), toVector3(1659.33, -1158.59, 23.8368),
@@ -405,17 +256,18 @@ let busRoutes = [
* Glen Park (Blue, Yellow) * Glen Park (Blue, Yellow)
* Ganton (Red) * Ganton (Red)
* Alhambra Club (Yellow, Blue) * Alhambra Club (Yellow, Blue)
Notable Stops: Notable Stops:
* County General Hospital * County General Hospital
* Glen Park * Glen Park
* Skate Park * Skate Park
* Stadium * Stadium
*/ */
name: "Los Santos Green Line", name: "Los Santos Green Line",
island: 0, island: 0,
busColour: 86, busColour: 86,
positions: [ payout: 175,
positions: [
toVector3(1823.94, -1853.88, 13.5103), toVector3(1823.94, -1853.88, 13.5103),
toVector3(1823.97, -1655.31, 13.4738), toVector3(1823.97, -1655.31, 13.4738),
toVector3(1854.81, -1409.54, 13.4829), toVector3(1854.81, -1409.54, 13.4829),
@@ -460,16 +312,17 @@ let busRoutes = [
* All Saints General Hospital (Blue) * All Saints General Hospital (Blue)
* Alhambra Club (Yellow, Blue) * Alhambra Club (Yellow, Blue)
* Airport Gate (Red) * Airport Gate (Red)
Notable Stops: Notable Stops:
* All Saints General Hospital * All Saints General Hospital
* Bank * Bank
* Star Tower * Star Tower
* Airport Gate * Airport Gate
*/ */
name: "Los Santos Red Line", name: "Los Santos Red Line",
island: 0, island: 0,
busColour: 3, busColour: 3,
payout: 150,
positions: [ positions: [
toVector3(1823.79, -1852.66, 13.5144), toVector3(1823.79, -1852.66, 13.5144),
toVector3(1804.12, -1609.59, 13.4419), toVector3(1804.12, -1609.59, 13.4419),
@@ -492,7 +345,7 @@ let busRoutes = [
toVector3(1963.51, -1969.6, 13.5867), toVector3(1963.51, -1969.6, 13.5867),
toVector3(1824.2, -1886.48, 13.4287), toVector3(1824.2, -1886.48, 13.4287),
] ]
} }
], ],
], ],
@@ -504,7 +357,7 @@ let busRoutes = [
// GTA IV // GTA IV
[ [
], ],
]; ];
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -523,7 +376,7 @@ function getNextStopOnBusRoute(island, busRoute, busRouteStop) {
return busRouteStop+1; return busRouteStop+1;
} else { } else {
return busRoutes[getServerGame()][island][busRoute].positions.length-1; return busRoutes[getServerGame()][island][busRoute].positions.length-1;
} }
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -13,8 +13,8 @@ let garbageRoutes = [
[ // GTA 3 [ // GTA 3
[ // PORTLAND ISLAND (0) [ // PORTLAND ISLAND (0)
{ // ROUTE 0 { // ROUTE 0
name: "Portland #1", name: "Portland #1",
island: 0, island: 0,
positions: [ positions: [
toVector3(1169.8, -45.54, 10.4), toVector3(1169.8, -45.54, 10.4),
toVector3(928, -59.1, 8.61), toVector3(928, -59.1, 8.61),
@@ -31,21 +31,21 @@ let garbageRoutes = [
toVector3(1128.9, -446.1, 20.41), toVector3(1128.9, -446.1, 20.41),
toVector3(1226.5, -52.41, 10.42) , toVector3(1226.5, -52.41, 10.42) ,
], ],
}, },
], ],
[ // STAUNTON ISLAND (1) [ // STAUNTON ISLAND (1)
{ // ROUTE 0 { // ROUTE 0
name: "Staunton #1", name: "Staunton #1",
island: 1, island: 1,
positions: [ positions: [
toVector3(49.85, -1539.9, 26.6), toVector3(49.85, -1539.9, 26.6),
toVector3(49.71, -1458.1, 26.6), toVector3(49.71, -1458.1, 26.6),
toVector3(170.78, -1403.8, 26.59), toVector3(170.78, -1403.8, 26.59),
toVector3(183.48, -1485.9, 26.6), toVector3(183.48, -1485.9, 26.6),
toVector3(320.43, -1452.4, 26.6), toVector3(320.43, -1452.4, 26.6),
toVector3(310.13, -1311.8, 26.6), toVector3(310.13, -1311.8, 26.6),
toVector3(134.76, -1097.7, 26.6), toVector3(134.76, -1097.7, 26.6),
toVector3(55.63, -1058.6, 26.6), toVector3(55.63, -1058.6, 26.6),
toVector3(-0.02, -790.9, 26.64), toVector3(-0.02, -790.9, 26.64),
], ],
}, },
@@ -67,7 +67,7 @@ let garbageRoutes = [
// GTA IV // GTA IV
[ [
], ],
]; ];
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -86,7 +86,7 @@ function getNextStopOnGarbageRoute(island, garbageRoute, garbageRouteStop) {
return garbageRouteStop+1; return garbageRouteStop+1;
} else { } else {
return garbageRoutes[getServerGame()][island][garbageRoute].positions.length-1; return garbageRoutes[getServerGame()][island][garbageRoute].positions.length-1;
} }
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -9,12 +9,12 @@
// =========================================================================== // ===========================================================================
function policeTazerCommand(command, params, client) { function policeTazerCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messagePlayerError(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)) {
messagePlayerError(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;
} }
@@ -35,12 +35,12 @@ function policeTazerCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function policeCuffCommand(command, params, client) { function policeCuffCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messagePlayerError(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)) {
messagePlayerError(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;
} }
@@ -53,7 +53,7 @@ function policeCuffCommand(command, params, client) {
if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) { if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) {
messagePlayerError(client, "You don't have a police job."); messagePlayerError(client, "You don't have a police job.");
return false; return false;
} }
return true; return true;
} }
@@ -61,12 +61,12 @@ function policeCuffCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function policeArrestCommand(command, params, client) { function policeArrestCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messagePlayerError(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)) {
messagePlayerError(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;
} }
@@ -79,7 +79,7 @@ function policeArrestCommand(command, params, client) {
if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) { if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) {
messagePlayerError(client, "You don't have a police job."); messagePlayerError(client, "You don't have a police job.");
return false; return false;
} }
return true; return true;
} }
@@ -87,12 +87,12 @@ function policeArrestCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function policeSearchCommand(command, params, client) { function policeSearchCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messagePlayerError(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)) {
messagePlayerError(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;
} }
@@ -105,7 +105,7 @@ function policeSearchCommand(command, params, client) {
if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) { if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) {
messagePlayerError(client, "You don't have a police job."); messagePlayerError(client, "You don't have a police job.");
return false; return false;
} }
return true; return true;
} }
@@ -113,12 +113,12 @@ function policeSearchCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function policeDragCommand(command, params, client) { function policeDragCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messagePlayerError(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)) {
messagePlayerError(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;
} }
@@ -131,7 +131,7 @@ function policeDragCommand(command, params, client) {
if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) { if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) {
messagePlayerError(client, "You don't have a police job."); messagePlayerError(client, "You don't have a police job.");
return false; return false;
} }
return true; return true;
} }
@@ -139,12 +139,12 @@ function policeDragCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function policeDetainCommand(command, params, client) { function policeDetainCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messagePlayerError(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)) {
messagePlayerError(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;
} }
@@ -157,7 +157,7 @@ function policeDetainCommand(command, params, client) {
if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) { if(!doesPlayerHaveJobType(client, AG_JOB_POLICE)) {
messagePlayerError(client, "You don't have a police job."); messagePlayerError(client, "You don't have a police job.");
return false; return false;
} }
return true; return true;
} }

View File

@@ -9,12 +9,12 @@
// =========================================================================== // ===========================================================================
function taxiSetFareCommand(command, params, client) { function taxiSetFareCommand(command, params, client) {
if(!canPlayerUseJobs(client)) { if(!canPlayerUseJobs(client)) {
messagePlayerError(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)) {
messagePlayerError(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;
} }

View File

@@ -263,7 +263,7 @@ function playerUsedKeyBind(client, key) {
if(!isPlayerSpawned(client)) { if(!isPlayerSpawned(client)) {
return false; return false;
} }
console.log(`[Asshat.KeyBind] ${getPlayerDisplayForConsole(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)) {

View File

@@ -115,7 +115,7 @@ function messagePlayerInfo(client, messageText) {
console.log(`[INFO] ${messageText}`); console.log(`[INFO] ${messageText}`);
return true; return true;
} }
if(!isClientFromDiscord(client)) { if(!isClientFromDiscord(client)) {
messagePlayerNormal(client, ` [#FFFFFF] ${messageText}`, getColourByName("white")); messagePlayerNormal(client, ` [#FFFFFF] ${messageText}`, getColourByName("white"));
} else { } else {
@@ -130,7 +130,7 @@ function messagePlayerTip(client, messageText) {
console.log(`[TIP] ${messageText}`); console.log(`[TIP] ${messageText}`);
return true; return true;
} }
if(!isClientFromDiscord(client)) { if(!isClientFromDiscord(client)) {
messagePlayerNormal(client, ` [#FFFFFF] ${messageText}`, getColourByName("white")); messagePlayerNormal(client, ` [#FFFFFF] ${messageText}`, getColourByName("white"));
} else { } else {

View File

@@ -149,7 +149,7 @@ function enterExitPropertyCommand(command, params, client) {
if(inBusiness.locked) { if(inBusiness.locked) {
meActionToNearbyPlayers(client, "tries to open the business door but fails because it's locked"); meActionToNearbyPlayers(client, "tries to open the business door but fails because it's locked");
return false; return false;
} }
meActionToNearbyPlayers(client, "opens the door and exits the business"); meActionToNearbyPlayers(client, "opens the door and exits the business");
fadeCamera(client, false, 1.0); fadeCamera(client, false, 1.0);
setTimeout(function() { setTimeout(function() {
@@ -163,7 +163,7 @@ function enterExitPropertyCommand(command, params, client) {
}, 1100); }, 1100);
removeEntityData(client, "ag.inBusiness"); removeEntityData(client, "ag.inBusiness");
} }
return true; return true;
} }
if(getServerData().businesses.length > 0) { if(getServerData().businesses.length > 0) {
@@ -180,7 +180,7 @@ function enterExitPropertyCommand(command, params, client) {
meActionToNearbyPlayers(client, "tries to open the business door but fails because it's locked"); meActionToNearbyPlayers(client, "tries to open the business door but fails because it's locked");
return false; return false;
} }
meActionToNearbyPlayers(client, "opens the door and enters the business"); meActionToNearbyPlayers(client, "opens the door and enters the business");
fadeCamera(client, false, 1.0); fadeCamera(client, false, 1.0);
@@ -215,7 +215,7 @@ function enterExitPropertyCommand(command, params, client) {
} }
meActionToNearbyPlayers(client, "opens the door and enters the house"); meActionToNearbyPlayers(client, "opens the door and enters the house");
fadeCamera(client, false, 1.0); fadeCamera(client, false, 1.0);
setTimeout(function() { setTimeout(function() {
@@ -234,7 +234,7 @@ function enterExitPropertyCommand(command, params, client) {
} }
//messagePlayerError(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

@@ -13,12 +13,12 @@ function initModerationScript() {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function kickClientCommand(command, params, client) { function kickClientCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messagePlayerError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
@@ -32,19 +32,19 @@ function kickClientCommand(command, params, client) {
return false; return false;
} }
} }
messageAdminAction(`${targetClient.name} has been kicked from the server.`); messageAdminAction(`${targetClient.name} has been kicked from the server.`);
targetClient.disconnect(); targetClient.disconnect();
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function setClientStaffTitleCommand(command, params, client) { function setClientStaffTitleCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let splitParams = params.split(" "); let splitParams = params.split(" ");
let targetClient = getPlayerFromParams(splitParams[0]); let targetClient = getPlayerFromParams(splitParams[0]);
let staffTitle = splitParams.slice(1).join(" "); let staffTitle = splitParams.slice(1).join(" ");
@@ -61,7 +61,7 @@ function setClientStaffTitleCommand(command, params, client) {
return false; return false;
} }
} }
getPlayerData(targetClient).accountData.staffTitle = staffTitle; getPlayerData(targetClient).accountData.staffTitle = staffTitle;
messagePlayerSuccess(client, `You set ${targetClient.name}'s staff title to ${staffTitle}`); messagePlayerSuccess(client, `You set ${targetClient.name}'s staff title to ${staffTitle}`);
messagePlayerAlert(client, `${client.name} set your staff title to ${staffTitle}`); messagePlayerAlert(client, `${client.name} set your staff title to ${staffTitle}`);
@@ -70,12 +70,12 @@ function setClientStaffTitleCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function muteClientCommand(command, params, client) { function muteClientCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messagePlayerError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
@@ -89,7 +89,7 @@ function muteClientCommand(command, params, client) {
return false; return false;
} }
} }
messageAdminAction(`${targetClient.name} has been muted by an admin!`); messageAdminAction(`${targetClient.name} has been muted by an admin!`);
setEntityData(targetClient, "ag.muted", true, false); setEntityData(targetClient, "ag.muted", true, false);
} }
@@ -97,12 +97,12 @@ function muteClientCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function unMuteClientCommand(command, params, client) { function unMuteClientCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messagePlayerError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
@@ -115,20 +115,20 @@ function unMuteClientCommand(command, params, client) {
messagePlayerError(client, "You cannot unmute this person!"); messagePlayerError(client, "You cannot unmute this person!");
return false; return false;
} }
} }
messageAdminAction(`${targetClient.name} has been unmuted by an admin!`); messageAdminAction(`${targetClient.name} has been unmuted by an admin!`);
removeEntityData(targetClient, "ag.muted"); removeEntityData(targetClient, "ag.muted");
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function freezeClientCommand(command, params, client) { function freezeClientCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messagePlayerError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
@@ -142,7 +142,7 @@ function freezeClientCommand(command, params, client) {
return false; return false;
} }
} }
messageAdminAction(`${toString(targetClient.name)} has been frozen by an admin!`); messageAdminAction(`${toString(targetClient.name)} has been frozen by an admin!`);
triggerNetworkEvent("ag.frozen", client, true); triggerNetworkEvent("ag.frozen", client, true);
} }
@@ -154,7 +154,7 @@ function unFreezeClientCommand(command, params, client) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messagePlayerError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
@@ -168,7 +168,7 @@ function unFreezeClientCommand(command, params, client) {
return false; return false;
} }
} }
messageAdminAction(`${toString(targetClient.name)} has been un-frozen by an admin!`); messageAdminAction(`${toString(targetClient.name)} has been un-frozen by an admin!`);
triggerNetworkEvent("ag.frozen", client, false); triggerNetworkEvent("ag.frozen", client, false);
} }
@@ -180,18 +180,18 @@ function gotoPlayerCommand(command, params, client) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messagePlayerError(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);
setPlayerPosition(client, getPosBehindPos(getPlayerPosition(targetClient), getPlayerHeading(targetClient), 2)); setPlayerPosition(client, getPosBehindPos(getPlayerPosition(targetClient), getPlayerHeading(targetClient), 2));
setPlayerHeading(client, getPlayerHeading(targetClient)); setPlayerHeading(client, getPlayerHeading(targetClient));
if(isPlayerInAnyBusiness(targetClient)) { if(isPlayerInAnyBusiness(targetClient)) {
let businessData = getBusinessData(getPlayerBusiness(targetClient)); let businessData = getBusinessData(getPlayerBusiness(targetClient));
triggerNetworkEvent("ag.interior", client, businessData.exitInterior); triggerNetworkEvent("ag.interior", client, businessData.exitInterior);
@@ -221,14 +221,14 @@ function gotoVehicleCommand(command, params, client) {
} }
let vehicle = getServerData().vehicles[toInteger(params)].vehicle; let vehicle = getServerData().vehicles[toInteger(params)].vehicle;
client.player.velocity = toVector3(0.0, 0.0, 0.0); client.player.velocity = toVector3(0.0, 0.0, 0.0);
setTimeout(function() { setTimeout(function() {
setPlayerPosition(client, getPosAbovePos(getVehiclePosition(vehicle), 3.0)); setPlayerPosition(client, getPosAbovePos(getVehiclePosition(vehicle), 3.0));
setPlayerInterior(client, 0); setPlayerInterior(client, 0);
setPlayerVirtualWorld(client, vehicle.dimension); setPlayerVirtualWorld(client, vehicle.dimension);
}, 500); }, 500);
messagePlayerSuccess(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})`);
} }
@@ -246,14 +246,14 @@ function gotoBusinessCommand(command, params, client) {
messagePlayerError(client, "That business doesn't exist!"); messagePlayerError(client, "That business doesn't exist!");
return false; return false;
} }
client.player.velocity = toVector3(0.0, 0.0, 0.0); client.player.velocity = toVector3(0.0, 0.0, 0.0);
setTimeout(function() { setTimeout(function() {
setPlayerPosition(client, getBusinessData(businessId).entrancePosition); setPlayerPosition(client, getBusinessData(businessId).entrancePosition);
setPlayerInterior(client, getBusinessData(businessId).entranceInterior); setPlayerInterior(client, getBusinessData(businessId).entranceInterior);
setPlayerVirtualWorld(client, getBusinessData(businessId).entranceDimension); setPlayerVirtualWorld(client, getBusinessData(businessId).entranceDimension);
}, 500); }, 500);
messagePlayerSuccess(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})`);
} }
@@ -271,14 +271,14 @@ function gotoHouseCommand(command, params, client) {
messagePlayerError(client, "That house doesn't exist!"); messagePlayerError(client, "That house doesn't exist!");
return false; return false;
} }
client.player.velocity = toVector3(0.0, 0.0, 0.0); client.player.velocity = toVector3(0.0, 0.0, 0.0);
setTimeout(function() { setTimeout(function() {
setPlayerPosition(client, getHouseData(houseId).entrancePosition); setPlayerPosition(client, getHouseData(houseId).entrancePosition);
setPlayerInterior(client, getHouseData(houseId).entranceInterior); setPlayerInterior(client, getHouseData(houseId).entranceInterior);
setPlayerVirtualWorld(client, getHouseData(houseId).entranceDimension); setPlayerVirtualWorld(client, getHouseData(houseId).entranceDimension);
}, 500); }, 500);
messagePlayerSuccess(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})`);
} }
@@ -304,13 +304,13 @@ function gotoJobLocationCommand(command, params, client) {
if(typeof getJobData(jobId).locations[jobLocationId] == "undefined") { if(typeof getJobData(jobId).locations[jobLocationId] == "undefined") {
messagePlayerError(client, `That location ID does not exist!`); messagePlayerError(client, `That location ID does not exist!`);
return false; return false;
} }
client.player.velocity = toVector3(0.0, 0.0, 0.0); client.player.velocity = toVector3(0.0, 0.0, 0.0);
setPlayerPosition(client, getJobData(jobId).locations[jobLocationId].position); setPlayerPosition(client, getJobData(jobId).locations[jobLocationId].position);
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);
messagePlayerSuccess(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`);
} }
@@ -337,7 +337,7 @@ function gotoPositionCommand(command, params, client) {
setPlayerPosition(client, newPosition); setPlayerPosition(client, newPosition);
setPlayerInterior(client, Number(int)); setPlayerInterior(client, Number(int));
setPlayerVirtualWorld(client, Number(vw)); setPlayerVirtualWorld(client, Number(vw));
messagePlayerSuccess(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}`);
} }
@@ -348,9 +348,9 @@ function teleportForwardCommand(command, params, client) {
messagePlayerSyntax(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));
messagePlayerSuccess(client, `You teleported forward ${params} meters`); messagePlayerSuccess(client, `You teleported forward ${params} meters`);
} }
@@ -361,9 +361,9 @@ function teleportBackwardCommand(command, params, client) {
messagePlayerSyntax(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));
messagePlayerSuccess(client, `You teleported backward [#AAAAAA]${params} [#FFFFFF]meters`); messagePlayerSuccess(client, `You teleported backward [#AAAAAA]${params} [#FFFFFF]meters`);
} }
@@ -374,9 +374,9 @@ function teleportLeftCommand(command, params, client) {
messagePlayerSyntax(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));
messagePlayerSuccess(client, `You teleported left [#AAAAAA]${params} [#FFFFFF]meters`); messagePlayerSuccess(client, `You teleported left [#AAAAAA]${params} [#FFFFFF]meters`);
} }
@@ -387,9 +387,9 @@ function teleportUpCommand(command, params, client) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
setPlayerPosition(client, getPosAbovePos(getPlayerPosition(client), params)); setPlayerPosition(client, getPosAbovePos(getPlayerPosition(client), params));
messagePlayerSuccess(client, `You teleported up [#AAAAAA]${params} [#FFFFFF]meters`); messagePlayerSuccess(client, `You teleported up [#AAAAAA]${params} [#FFFFFF]meters`);
} }
@@ -400,9 +400,9 @@ function teleportDownCommand(command, params, client) {
messagePlayerSyntax(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));
messagePlayerSuccess(client, `You teleported down [#AAAAAA]${params} [#FFFFFF]meters`); messagePlayerSuccess(client, `You teleported down [#AAAAAA]${params} [#FFFFFF]meters`);
} }
@@ -413,9 +413,9 @@ function teleportRightCommand(command, params, client) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
setPlayerPosition(client, getPosToRightOfPos(getPlayerPosition(client), getPlayerHeading(client), params)); setPlayerPosition(client, getPosToRightOfPos(getPlayerPosition(client), getPlayerHeading(client), params));
messagePlayerSuccess(client, `You teleported right [#AAAAAA]${params} [#FFFFFF]meters`); messagePlayerSuccess(client, `You teleported right [#AAAAAA]${params} [#FFFFFF]meters`);
} }
@@ -476,7 +476,7 @@ function getPlayerCommand(command, params, client) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
if(!targetClient) { if(!targetClient) {
messagePlayerError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
@@ -486,7 +486,7 @@ function getPlayerCommand(command, params, client) {
removePlayerFromVehicle(targetClient); removePlayerFromVehicle(targetClient);
setPlayerPosition(targetClient, getPosBehindPos(getPlayerPosition(client), getPlayerHeading(client), 2)); setPlayerPosition(targetClient, getPosBehindPos(getPlayerPosition(client), getPlayerHeading(client), 2));
setPlayerHeading(targetClient, getPlayerHeading(client)); setPlayerHeading(targetClient, getPlayerHeading(client));
if(isPlayerInAnyBusiness(client)) { if(isPlayerInAnyBusiness(client)) {
let businessData = getBusinessData(getPlayerBusiness(client)); let businessData = getBusinessData(getPlayerBusiness(client));
setPlayerInterior(targetClient, businessData.exitInterior); setPlayerInterior(targetClient, businessData.exitInterior);
@@ -510,7 +510,7 @@ function addStaffFlagCommand(command, params, client) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let splitParams = params.split(""); let splitParams = params.split("");
let targetClient = getPlayerFromParams(splitParams[0]); let targetClient = getPlayerFromParams(splitParams[0]);
let flagName = splitParams[1] || "none"; let flagName = splitParams[1] || "none";
@@ -544,7 +544,7 @@ function takeStaffFlagCommand(command, params, client) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let splitParams = params.split(""); let splitParams = params.split("");
let targetClient = getPlayerFromParams(splitParams[0]); let targetClient = getPlayerFromParams(splitParams[0]);
let flagName = splitParams[1] || "none"; let flagName = splitParams[1] || "none";
@@ -564,7 +564,7 @@ function takeStaffFlagCommand(command, params, client) {
if(!getStaffFlagValue(flagName)) { if(!getStaffFlagValue(flagName)) {
messagePlayerError(client, "That staff flag doesn't exist!"); messagePlayerError(client, "That staff flag doesn't exist!");
return false; return false;
} }
takePlayerStaffFlag(targetClient, flagName); takePlayerStaffFlag(targetClient, flagName);
@@ -578,7 +578,7 @@ function clearStaffFlagsCommand(command, params, client) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let splitParams = params.split(""); let splitParams = params.split("");
let targetClient = getPlayerFromParams(splitParams[0]); let targetClient = getPlayerFromParams(splitParams[0]);
let flagName = splitParams[1] || "none"; let flagName = splitParams[1] || "none";
@@ -598,7 +598,7 @@ function clearStaffFlagsCommand(command, params, client) {
if(!getStaffFlagValue(flagName)) { if(!getStaffFlagValue(flagName)) {
messagePlayerError(client, "That staff flag doesn't exist!"); messagePlayerError(client, "That staff flag doesn't exist!");
return false; return false;
} }
clearPlayerStaffFlags(targetClient); clearPlayerStaffFlags(targetClient);
@@ -619,12 +619,12 @@ function getStaffFlagsCommand(command, params, client) {
messagePlayerError(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)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let splitParams = params.split(""); let splitParams = params.split("");
let targetClient = getPlayerFromParams(splitParams[0]); let targetClient = getPlayerFromParams(splitParams[0]);
let flagName = splitParams[1] || "none"; let flagName = splitParams[1] || "none";
@@ -633,7 +633,7 @@ function getStaffFlagsCommand(command, params, client) {
messagePlayerError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
let tempStaffFlags = []; let tempStaffFlags = [];
let serverBitFlagKeys = getServerBitFlagKeys(); let serverBitFlagKeys = getServerBitFlagKeys();
for(let i in serverBitFlagKeys) { for(let i in serverBitFlagKeys) {
@@ -648,12 +648,12 @@ function getStaffFlagsCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function allStaffFlagsCommand(command, params, client) { function allStaffFlagsCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let splitParams = params.split(""); let splitParams = params.split("");
let targetClient = getPlayerFromParams(splitParams[0]); let targetClient = getPlayerFromParams(splitParams[0]);
let flagName = splitParams[1] || "none"; let flagName = splitParams[1] || "none";
@@ -668,12 +668,12 @@ function allStaffFlagsCommand(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function givePlayerMoneyCommand(command, params, client) { function givePlayerMoneyCommand(command, params, client) {
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let splitParams = params.split(" "); let splitParams = params.split(" ");
let targetClient = getPlayerFromParams(splitParams[0]); let targetClient = getPlayerFromParams(splitParams[0]);
let amount = toInteger(splitParams[1]); let amount = toInteger(splitParams[1]);
@@ -682,7 +682,7 @@ function givePlayerMoneyCommand(command, params, client) {
messagePlayerError(client, "That player is not connected!"); messagePlayerError(client, "That player is not connected!");
return false; return false;
} }
getPlayerCurrentSubAccount(targetClient).cash += amount; getPlayerCurrentSubAccount(targetClient).cash += amount;
updatePlayerCash(targetClient); updatePlayerCash(targetClient);
messagePlayerSuccess(client, `You gave [#AAAAAA]$${amount} [#FFFFFF]to [#AAAAAA]${getCharacterFullName(targetClient)}`); messagePlayerSuccess(client, `You gave [#AAAAAA]$${amount} [#FFFFFF]to [#AAAAAA]${getCharacterFullName(targetClient)}`);

View File

@@ -12,30 +12,6 @@
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function agSpawnPlayer(client, subAccountData) {
return spawnPlayer(client, subAccountData.spawnPosition, subAccountData.spawnRotation, subAccountData.skin);
}
// ---------------------------------------------------------------------------
function agCreateVehicle(vehicleData) {
return createVehicle(vehicleData.model, vehicleData.spawnPosition);
}
// ---------------------------------------------------------------------------
function agSetVehiclePosition(vehicle, position) {
vehicle.position = position;
}
// ---------------------------------------------------------------------------
function agSetVehicleRotation(vehicle, heading) {
vehicle.heading = heading;
}
// ---------------------------------------------------------------------------
function getServerGame() { function getServerGame() {
return server.game; return server.game;
} }
@@ -200,4 +176,10 @@ function removePlayerFromVehicle(client) {
return true; return true;
} }
// ---------------------------------------------------------------------------
function setPlayerSkin(client, skin) {
client.player.modelIndex = skin;
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -12,6 +12,8 @@ function initServerScripts() {
checkForAllRequiredModules(); checkForAllRequiredModules();
initConfigScript();
initClassScript(); initClassScript();
initDatabaseScript(); initDatabaseScript();
initBitFlagScript(); initBitFlagScript();
@@ -27,7 +29,6 @@ function initServerScripts() {
initJobScript(); initJobScript();
initVehicleScript(); initVehicleScript();
initDeveloperScript(); initDeveloperScript();
initConfigScript();
initKeyBindScript(); initKeyBindScript();
initEventScript(); initEventScript();
initAntiCheatScript(); initAntiCheatScript();
@@ -46,7 +47,7 @@ function initServerScripts() {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function checkForHashingModule() { function checkForHashingModule() {
if(module.hashing == "undefined") { if(typeof module.hashing == "undefined") {
return false; return false;
} }
return true; return true;
@@ -55,10 +56,10 @@ function checkForHashingModule() {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function checkForMySQLModule() { function checkForMySQLModule() {
if(module.mysql == "undefined") { if(typeof module.mysql == "undefined") {
return false; return false;
} }
return true; return true;
} }
@@ -72,7 +73,7 @@ function checkForAllRequiredModules() {
console.warn("[Asshat.Startup]: This resource will now shutdown."); console.warn("[Asshat.Startup]: This resource will now shutdown.");
thisResource.stop(); thisResource.stop();
} }
if(!checkForMySQLModule()) { if(!checkForMySQLModule()) {
console.warn("[Asshat.Startup]: MySQL module is not loaded!"); console.warn("[Asshat.Startup]: MySQL module is not loaded!");
console.warn("[Asshat.Startup]: This resource will now shutdown."); console.warn("[Asshat.Startup]: This resource will now shutdown.");
@@ -85,8 +86,6 @@ function checkForAllRequiredModules() {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
serverConfig = loadServerConfigFromGameAndPort(server.game, server.port);
applyConfigToServer(serverConfig);
initServerScripts(); initServerScripts();
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -221,7 +221,7 @@ addNetworkHandler("ag.nextCharacter", function(client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
async function selectCharacter(client, characterId = -1) { function selectCharacter(client, characterId = -1) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.characterSelectSuccess", client); triggerNetworkEvent("ag.characterSelectSuccess", client);
} }
@@ -230,51 +230,28 @@ async function selectCharacter(client, characterId = -1) {
getPlayerData(client).currentSubAccount = characterId; getPlayerData(client).currentSubAccount = characterId;
} }
let tempSubAccount = getPlayerCurrentSubAccount(client); console.log(`[Asshat.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} with skin ${getPlayerCurrentSubAccount(client).skin}`);
spawnPlayer(client, tempSubAccount.spawnPosition, tempSubAccount.spawnHeading, tempSubAccount.skin); spawnPlayer(client, getPlayerCurrentSubAccount(client).spawnPosition, getPlayerCurrentSubAccount(client).spawnHeading, getPlayerCurrentSubAccount(client).skin);
tempSubAccount.lastLogin = new Date().getTime(); getPlayerCurrentSubAccount(client).lastLogin = new Date().getTime();
messagePlayerAlert(client, `You are now playing as: [#0099FF]${tempSubAccount.firstName} ${tempSubAccount.lastName}`, getColourByName("white"));
messagePlayerNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange"));
messagePlayerNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
triggerNetworkEvent("ag.restoreCamera", client);
setEntityData(client, "ag.spawned", true, true);
while(client.player == null) {};
setTimeout(function() {
setEntityData(client.player, "ag.spawned", true, true);
//triggerNetworkEvent("ag.restoreCamera", client);
setPlayerPosition(client, tempSubAccount.spawnPosition);
setPlayerHeading(client, tempSubAccount.spawnHeading);
setPlayerInterior(client, tempSubAccount.interior);
setPlayerVirtualWorld(client, tempSubAccount.dimension);
setTimeout(function() {
updatePlayerCash(client);
}, 1000);
}, client.ping+1000);
updateAllPlayerNameTags();
getPlayerData(client).switchingCharacter = false;
triggerNetworkEvent("ag.jobType", client, tempSubAccount.job);
} }
addNetworkHandler("ag.selectCharacter", selectCharacter); addNetworkHandler("ag.selectCharacter", selectCharacter);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function switchCharacterCommand(command, params, client) { function switchCharacterCommand(command, params, client) {
getPlayerCurrentSubAccount(client).spawnPosition = getPlayerPosition(client); if(isPlayerSpawned(client)) {
getPlayerCurrentSubAccount(client).spawnHeading = getPlayerHeading(client); getPlayerCurrentSubAccount(client).spawnPosition = getPlayerPosition(client);
//getPlayerCurrentSubAccount(client).interior = getPlayerInterior(client); getPlayerCurrentSubAccount(client).spawnHeading = getPlayerHeading(client);
//getPlayerCurrentSubAccount(client).dimension = getPlayerVirtualWorld(client); //getPlayerCurrentSubAccount(client).interior = getPlayerInterior(client);
//getPlayerCurrentSubAccount(client).dimension = getPlayerVirtualWorld(client);
saveSubAccountToDatabase(getPlayerCurrentSubAccount(client)); saveSubAccountToDatabase(getPlayerCurrentSubAccount(client));
resetClientStuff(client); resetClientStuff(client);
client.despawnPlayer(); client.despawnPlayer();
}
showConnectCameraToPlayer(client); showConnectCameraToPlayer(client);
showCharacterSelectToClient(client); showCharacterSelectToClient(client);
} }

View File

@@ -24,7 +24,7 @@ function saveAllServerDataToDatabase() {
saveAllHousesToDatabase(); saveAllHousesToDatabase();
saveAllBusinessesToDatabase(); saveAllBusinessesToDatabase();
saveServerConfigToDatabase(getServerConfig()); saveServerConfigToDatabase(getServerConfig());
saveAllVehiclesToDatabase(); saveAllVehiclesToDatabase();
saveAllClientsToDatabase(); saveAllClientsToDatabase();
console.log("[Asshat.Utilities]: Saved all server data to database!"); console.log("[Asshat.Utilities]: Saved all server data to database!");
} }

View File

@@ -12,7 +12,7 @@
function translateMessage(messageText, fromLanguageId, toLanguageId) { function translateMessage(messageText, fromLanguageId, toLanguageId) {
let translatedText = ""; let translatedText = "";
let thisTranslationURL = formatTranslationURL(messageText, fromLanguageId, toLanguageId); let thisTranslationURL = formatTranslationURL(messageText, fromLanguageId, toLanguageId);
httpGet( httpGet(
thisTranslationURL, thisTranslationURL,
@@ -27,7 +27,7 @@ function translateMessage(messageText, fromLanguageId, toLanguageId) {
function(data) { function(data) {
} }
); );
return this.translatedText; return this.translatedText;
} }

View File

@@ -31,11 +31,11 @@ let policeStations = [
[340.25, -1123.375, 25.98], // Staunton Island [340.25, -1123.375, 25.98], // Staunton Island
[-1253.0, -138.1875, 58.75], // Shoreside Vale [-1253.0, -138.1875, 58.75], // Shoreside Vale
], ],
[ // GTA Vice City [ // GTA Vice City
[399.77, -468.90, 11.73], // Washington Beach [399.77, -468.90, 11.73], // Washington Beach
[508.96, 512.07, 12.10], // Vice Point [508.96, 512.07, 12.10], // Vice Point
[-657.43, 762.31, 11.59], // Downtown [-657.43, 762.31, 11.59], // Downtown
[-885.08, -470.44, 13.11], // Little Havana [-885.08, -470.44, 13.11], // Little Havana
], ],
]; ];
@@ -49,7 +49,7 @@ let fireStations = [
[-78.48, -436.80, 16.17], // Staunton Island [-78.48, -436.80, 16.17], // Staunton Island
[-1202.10, -14.67, 53.20], // Shoreside Vale [-1202.10, -14.67, 53.20], // Shoreside Vale
], ],
[ // GTA Vice City [ // GTA Vice City
[-695.15, 912.58, 11.08], // Downtown [-695.15, 912.58, 11.08], // Downtown
], ],
@@ -60,9 +60,9 @@ let fireStations = [
let hospitals = [ let hospitals = [
[], [],
[ // GTA III [ // GTA III
], ],
[ // GTA Vice City [ // GTA Vice City
[-822.57, 1152.82, 12.41], // Downtown (Shuman Health Care Center) [-822.57, 1152.82, 12.41], // Downtown (Shuman Health Care Center)
[-885.08, -470.44, 13.11], // Little Havana (West Haven Community Health Care Center) [-885.08, -470.44, 13.11], // Little Havana (West Haven Community Health Care Center)
@@ -78,7 +78,7 @@ let payAndSprays = [
[925.4, -360.3, 10.83], // Portland [925.4, -360.3, 10.83], // Portland
[-1142.4, 35.01, 58.61], // Shoreside Vale [-1142.4, 35.01, 58.61], // Shoreside Vale
], ],
[ // GTA Vice City [ // GTA Vice City
[-869.95, -119.06, 10.63], // Little Haiti [-869.95, -119.06, 10.63], // Little Haiti
[-910.82, -1265.96, 11.79], // Viceport [-910.82, -1265.96, 11.79], // Viceport
@@ -93,7 +93,7 @@ let ammuNations = [
[1068.3, -400.9, 15.24], // Portland [1068.3, -400.9, 15.24], // Portland
[348.2, -717.9, 26.43], // Staunton Island [348.2, -717.9, 26.43], // Staunton Island
], ],
[ // GTA Vice City [ // GTA Vice City
[-676.32, 1204.98, 11.10], // Downtown [-676.32, 1204.98, 11.10], // Downtown
], ],
@@ -103,27 +103,27 @@ let ammuNations = [
let hiddenPackages = [ let hiddenPackages = [
[ [
[1105.25, -1020, 25.0625], [1105.25, -1020, 25.0625],
[877.562, -788, 27.5625], [877.562, -788, 27.5625],
[1254, -611.188, 22.75], [1254, -611.188, 22.75],
[1045.75, -967.062, 16], [1045.75, -967.062, 16],
[942.062, -793.375, 14.875], [942.062, -793.375, 14.875],
[934, -718.875, 14.75], [934, -718.875, 14.75],
[898.062, -414.688, 26.5], [898.062, -414.688, 26.5],
[846.875, -442.5, 23.1875], [846.875, -442.5, 23.1875],
[927.062, -404.375, 29.0625], [927.062, -404.375, 29.0625],
[864.25, -171.5, 3.5], [864.25, -171.5, 3.5],
[1538.25, -174.375, 19.1875], [1538.25, -174.375, 19.1875],
[1213.06, -127.062, 15.0625], [1213.06, -127.062, 15.0625],
[753.562, 137, 3.5], [753.562, 137, 3.5],
[1162, -101.75, 12], [1162, -101.75, 12],
[1155.56, -191.5, 14.375], [1155.56, -191.5, 14.375],
[1285.5, -247.5, 42.375], [1285.5, -247.5, 42.375],
[1007.19, -219.562, 6.6875], [1007.19, -219.562, 6.6875],
[1138.19, -250, 24.25], [1138.19, -250, 24.25],
[1023.56, -423.688, 14.875], [1023.56, -423.688, 14.875],
[1237.5, -854.062, 20.5625], [1237.5, -854.062, 20.5625],
[1478.25, -1150.69, 12], [1478.25, -1150.69, 12],
[1018.88, -56.75, 21], [1018.88, -56.75, 21],
[1465.69, -166.5, 55.5], [1465.69, -166.5, 55.5],
[1120.19, -926.188, 16], [1120.19, -926.188, 16],
@@ -211,29 +211,29 @@ let hiddenPackages = [
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
let weekDays = [ let weekDays = [
"Sunday", "Sunday",
"Monday", "Monday",
"Tuesday", "Tuesday",
"Wednesday", "Wednesday",
"Thursday", "Thursday",
"Friday", "Friday",
"Saturday" "Saturday"
]; ];
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
let months = [ let months = [
"January", "January",
"February", "February",
"March", "March",
"April", "April",
"May", "May",
"June", "June",
"July", "July",
"August", "August",
"September", "September",
"October", "October",
"November", "November",
"December" "December"
]; ];
@@ -241,13 +241,13 @@ let months = [
let cardinalDirections = [ let cardinalDirections = [
"North", "North",
"Northeast", "Northeast",
"East", "East",
"Southeast", "Southeast",
"South", "South",
"Southwest", "Southwest",
"West", "West",
"Northwest", "Northwest",
"Unknown" "Unknown"
]; ];
@@ -257,7 +257,7 @@ function areParamsEmpty(params) {
if(!params || params == "" || params.length == 0 || typeof params == "undefined") { if(!params || params == "" || params.length == 0 || typeof params == "undefined") {
return true; return true;
} }
return false; return false;
} }
@@ -314,7 +314,7 @@ function getWeaponModelId(weaponId) {
function getIsland(position) { function getIsland(position) {
if(getServerGame() == GAME_GTA_III) { if(getServerGame() == GAME_GTA_III) {
if(position.x > 616) { if(position.x > 616) {
return 0; return 0;
} else if(position.x < -283) { } else if(position.x < -283) {
return 2; return 2;
@@ -352,12 +352,12 @@ function makeReadableTime(hour, minute) {
let hourStr = toString(hour); let hourStr = toString(hour);
let minuteStr = toString(minute); let minuteStr = toString(minute);
let meridianStr = "AM"; let meridianStr = "AM";
if(hour < 10) { if(hour < 10) {
hourStr = "0" + toString(hour); hourStr = "0" + toString(hour);
meridianStr = "AM"; meridianStr = "AM";
} }
if(hour > 12) { if(hour > 12) {
let actualHour = hour-12; let actualHour = hour-12;
if(actualHour < 10) { if(actualHour < 10) {
@@ -367,11 +367,11 @@ function makeReadableTime(hour, minute) {
} }
meridianStr = "PM"; meridianStr = "PM";
} }
if(minute < 10) { if(minute < 10) {
minuteStr = "0" + toString(minute); minuteStr = "0" + toString(minute);
} }
return hourStr + ":" + minuteStr + " " + meridianStr; return hourStr + ":" + minuteStr + " " + meridianStr;
} }
@@ -380,9 +380,9 @@ function makeReadableTime(hour, minute) {
function getPosToRightOfPos(pos, angle, distance) { function getPosToRightOfPos(pos, angle, distance) {
let x = (pos.x+((Math.cos((-angle+1.57)+(Math.PI/2)))*distance)); let x = (pos.x+((Math.cos((-angle+1.57)+(Math.PI/2)))*distance));
let y = (pos.y+((Math.sin((-angle+1.57)+(Math.PI/2)))*distance)); let y = (pos.y+((Math.sin((-angle+1.57)+(Math.PI/2)))*distance));
let rightPos = toVector3(x, y, pos.z); let rightPos = toVector3(x, y, pos.z);
return rightPos; return rightPos;
} }
@@ -391,9 +391,9 @@ function getPosToRightOfPos(pos, angle, distance) {
function getPosToLeftOfPos(pos, angle, distance) { function getPosToLeftOfPos(pos, angle, distance) {
let x = (pos.x+((Math.cos((angle+1.57)+(Math.PI/2)))*distance)); let x = (pos.x+((Math.cos((angle+1.57)+(Math.PI/2)))*distance));
let y = (pos.y+((Math.sin((angle+1.57)+(Math.PI/2)))*distance)); let y = (pos.y+((Math.sin((angle+1.57)+(Math.PI/2)))*distance));
let leftPos = toVector3(x, y, pos.z); let leftPos = toVector3(x, y, pos.z);
return leftPos; return leftPos;
} }
@@ -403,7 +403,7 @@ function getPosInFrontOfPos(pos, angle, distance) {
let x = (pos.x+((Math.cos(angle+(Math.PI/2)))*distance)); let x = (pos.x+((Math.cos(angle+(Math.PI/2)))*distance));
let y = (pos.y+((Math.sin(angle+(Math.PI/2)))*distance)); let y = (pos.y+((Math.sin(angle+(Math.PI/2)))*distance));
let z = pos.z; let z = pos.z;
return toVector3(x, y, z); return toVector3(x, y, z);
} }
@@ -413,7 +413,7 @@ function getPosBehindPos(pos, angle, distance) {
let x = (pos.x+((Math.cos(angle-(Math.PI/2)))*distance)); let x = (pos.x+((Math.cos(angle-(Math.PI/2)))*distance));
let y = (pos.y+((Math.sin(angle-(Math.PI/2)))*distance)); let y = (pos.y+((Math.sin(angle-(Math.PI/2)))*distance));
let z = pos.z; let z = pos.z;
return toVector3(x,y,z); return toVector3(x,y,z);
} }
@@ -458,7 +458,7 @@ function radToDeg(rad) {
function getAngleInCircleFromCenter(center, total, current) { function getAngleInCircleFromCenter(center, total, current) {
let gap = 360 / total; let gap = 360 / total;
let deg = Math.floor(gap*current); let deg = Math.floor(gap*current);
if(deg <= 0) { if(deg <= 0) {
deg = 1; deg = 1;
} else { } else {
@@ -466,7 +466,7 @@ function getAngleInCircleFromCenter(center, total, current) {
deg = 359; deg = 359;
} }
} }
return degToRad(deg); return degToRad(deg);
} }
@@ -586,15 +586,15 @@ function isParamsInvalid(params) {
if(params == null) { if(params == null) {
return true; return true;
} }
if(params == "") { if(params == "") {
return true; return true;
} }
if(params.length == 0) { if(params.length == 0) {
return true; return true;
} }
return false; return false;
} }
@@ -605,22 +605,22 @@ function isValidVehicleModel(modelId) {
if(modelId < 90 || modelId > 150) { if(modelId < 90 || modelId > 150) {
return false; return false;
} }
return true; return true;
} }
if(getServerGame() == GAME_GTA_VC) { if(getServerGame() == GAME_GTA_VC) {
if(modelId < 130 || modelId > 236) { if(modelId < 130 || modelId > 236) {
return false; return false;
} }
return true; return true;
} }
if(getServerGame() == GAME_GTA_SA) { if(getServerGame() == GAME_GTA_SA) {
return true; return true;
} }
if(getServerGame() == GAME_GTA_IV) { if(getServerGame() == GAME_GTA_IV) {
return true; return true;
} }
@@ -633,24 +633,24 @@ function isValidVehicleModel(modelId) {
function getVehicleModelIdFromParams(params) { function getVehicleModelIdFromParams(params) {
if(isNaN(params)) { if(isNaN(params)) {
let modelId = getVehicleModelIdFromName(params); let modelId = getVehicleModelIdFromName(params);
if(!modelId) { if(!modelId) {
return false; return false;
} }
if(isValidVehicleModel(toInteger(modelId))) { if(isValidVehicleModel(toInteger(modelId))) {
return toInteger(modelId); return toInteger(modelId);
} }
return false; return false;
} else { } else {
if(isValidVehicleModel(toInteger(params))) { if(isValidVehicleModel(toInteger(params))) {
return toInteger(params); return toInteger(params);
} }
return false; return false;
} }
return false; return false;
} }
@@ -662,15 +662,15 @@ function getVehicleModelIdFromName(params) {
if(toLowerCase(getGameData().gtaivVehicleModels[i][0]).indexOf(toLowerCase(params)) != -1) { if(toLowerCase(getGameData().gtaivVehicleModels[i][0]).indexOf(toLowerCase(params)) != -1) {
return getGameData().gtaivVehicleModels[i][1]; return getGameData().gtaivVehicleModels[i][1];
} }
} }
} else { } else {
let vehicleNames = getGameData().vehicleNames[getServerGame()]; let vehicleNames = getGameData().vehicleNames[getServerGame()];
for(let i in vehicleNames) { for(let i in vehicleNames) {
if(toLowerCase(vehicleNames[i]).indexOf(toLowerCase(params)) != -1) { if(toLowerCase(vehicleNames[i]).indexOf(toLowerCase(params)) != -1) {
return toInteger(i)+toInteger(getGameData().vehicleModelIdStart[getServerGame()]); return toInteger(i)+toInteger(getGameData().vehicleModelIdStart[getServerGame()]);
} }
} }
} }
return false; return false;
} }
@@ -685,11 +685,11 @@ function doesWordStartWithVowel(word) {
case "o": case "o":
case "u": case "u":
return true; return true;
default: default:
return false; return false;
} }
return false; return false;
} }
@@ -740,7 +740,7 @@ function getClientFromName(clientName) {
return clients[i]; return clients[i];
} }
} }
return false; return false;
} }
@@ -753,7 +753,7 @@ function getClientFromPlayer(player) {
return clients[i]; return clients[i];
} }
} }
return false; return false;
} }
@@ -771,14 +771,14 @@ function getPlayerFromParams(params) {
if(toLowerCase(getCharacterFullName(clients[i])).indexOf(toLowerCase(params)) != -1) { if(toLowerCase(getCharacterFullName(clients[i])).indexOf(toLowerCase(params)) != -1) {
return clients[i]; return clients[i];
} }
} }
} }
} else { } else {
if(typeof clients[toInteger(params)] != "undefined") { if(typeof clients[toInteger(params)] != "undefined") {
return clients[toInteger(params)]; return clients[toInteger(params)];
} }
} }
return false; return false;
} }
@@ -792,7 +792,7 @@ function getFirstEmptyEffectSlot(isServer = false) {
} }
} }
} }
return false; return false;
} }
@@ -826,7 +826,7 @@ function createBitwiseTable(tableKeys) {
let bitVal = 0; let bitVal = 0;
let bitTable = {}; let bitTable = {};
let incVal = 1; let incVal = 1;
for(let i in tableKeys) { for(let i in tableKeys) {
let key = tableKeys[i]; let key = tableKeys[i];
bitTable[key] = bitVal; bitTable[key] = bitVal;
@@ -860,11 +860,11 @@ function getCardinalDirection(pos1, pos2) {
let a = pos1.x - pos2.x; let a = pos1.x - pos2.x;
let b = pos1.y - pos2.y; let b = pos1.y - pos2.y;
let c = pos1.z - pos2.z; let c = pos1.z - pos2.z;
let x = Math.abs(a); let x = Math.abs(a);
let y = Math.abs(b); let y = Math.abs(b);
let z = Math.abs(c); let z = Math.abs(c);
let no = 0; let no = 0;
let ne = 1; let ne = 1;
let ea = 2; let ea = 2;
@@ -874,7 +874,7 @@ function getCardinalDirection(pos1, pos2) {
let we = 6; let we = 6;
let nw = 7; let nw = 7;
let na = 8; let na = 8;
if(b < 0 && a < 0){ if(b < 0 && a < 0){
if(x < (y/2)){ if(x < (y/2)){
return no; return no;
@@ -921,19 +921,19 @@ function getTimeDifferenceDisplay(unixTimeOne, unixTimeTwo) {
let minutes = floor(timeDifference/60); let minutes = floor(timeDifference/60);
let hourString = ""; let hourString = "";
let minuteString = ""; let minuteString = "";
if(hours == 1) { if(hours == 1) {
hourString = "1 hour"; hourString = "1 hour";
} else { } else {
hourString = toString(hours) + " hours"; hourString = toString(hours) + " hours";
} }
if(minutes == 1) { if(minutes == 1) {
minuteString = "1 minute"; minuteString = "1 minute";
} else { } else {
minuteString = toString(minutes) + " minute"; minuteString = toString(minutes) + " minute";
} }
return hourString + " and " + minuteString; return hourString + " and " + minuteString;
} }
@@ -1027,16 +1027,16 @@ function getRandomRGB() {
function breakText(text, maxLength) { function breakText(text, maxLength) {
let lines = []; let lines = [];
let j = Math.floor(text.length / maxLength); let j = Math.floor(text.length / maxLength);
for(let i = 0; i < j; i++) { for(let i = 0; i < j; i++) {
lines.push(text.substr(i*maxLength,maxLength)); lines.push(text.substr(i*maxLength,maxLength));
} }
let line = text.substr(j*maxLength, text.length % maxLength); let line = text.substr(j*maxLength, text.length % maxLength);
if(line.length > 0) { if(line.length > 0) {
lines.push(line); lines.push(line);
} }
return lines; return lines;
} }
@@ -1059,7 +1059,7 @@ function getArrayOfElementId(elements) {
for(let i in elements) { for(let i in elements) {
tempArray.push(elements[i].id); tempArray.push(elements[i].id);
} }
return tempArray; return tempArray;
} }
@@ -1082,7 +1082,7 @@ function isValidSkin(skin, game = GAME_GTA_III) {
switch(skin) { switch(skin) {
case 111: case 111:
return false; return false;
default: default:
return true; return true;
} }
@@ -1252,11 +1252,11 @@ function sendAllPoliceStationBlips(client) {
let tempBlips = []; let tempBlips = [];
for(let i in getServerData().policeStations[getServerGame()]) { for(let i in getServerData().policeStations[getServerGame()]) {
tempBlips.push([ tempBlips.push([
getGameConfig().blipSprites[getServerGame()].policeStation, getGameConfig().blipSprites[getServerGame()].policeStation,
getServerData().policeStations[getServerGame()][i].position.x, getServerData().policeStations[getServerGame()][i].position.x,
getServerData().policeStations[getServerGame()][i].position.y, getServerData().policeStations[getServerGame()][i].position.y,
getServerData().policeStations[getServerGame()][i].position.z, getServerData().policeStations[getServerGame()][i].position.z,
3, 3,
getColourByName("policeBlue"), getColourByName("policeBlue"),
]); ]);
} }
@@ -1271,11 +1271,11 @@ function sendAllFireStationBlips(client) {
let tempBlips = []; let tempBlips = [];
for(let i in getServerData().fireStations[getServerGame()]) { for(let i in getServerData().fireStations[getServerGame()]) {
tempBlips.push([ tempBlips.push([
getGameConfig().blipSprites[getServerGame()].fireStation, getGameConfig().blipSprites[getServerGame()].fireStation,
getServerData().fireStations[getServerGame()][i].position.x, getServerData().fireStations[getServerGame()][i].position.x,
getServerData().fireStations[getServerGame()][i].position.y, getServerData().fireStations[getServerGame()][i].position.y,
getServerData().fireStations[getServerGame()][i].position.z, getServerData().fireStations[getServerGame()][i].position.z,
3, 3,
getColourByName("firefighterRed"), getColourByName("firefighterRed"),
]); ]);
} }
@@ -1290,11 +1290,11 @@ function sendAllHospitalBlips(client) {
let tempBlips = []; let tempBlips = [];
for(let i in getServerData().hospitals[getServerGame()]) { for(let i in getServerData().hospitals[getServerGame()]) {
tempBlips.push([ tempBlips.push([
getGameConfig().blipSprites[getServerGame()].hospital, getGameConfig().blipSprites[getServerGame()].hospital,
getServerData().hospitals[getServerGame()][i].position.x, getServerData().hospitals[getServerGame()][i].position.x,
getServerData().hospitals[getServerGame()][i].position.y, getServerData().hospitals[getServerGame()][i].position.y,
getServerData().hospitals[getServerGame()][i].position.z, getServerData().hospitals[getServerGame()][i].position.z,
3, 3,
getColourByName("medicPink"), getColourByName("medicPink"),
]); ]);
} }
@@ -1309,11 +1309,11 @@ function sendAllAmmunationBlips(client) {
let tempBlips = []; let tempBlips = [];
for(let i in getServerData().ammunations[getServerGame()]) { for(let i in getServerData().ammunations[getServerGame()]) {
tempBlips.push([ tempBlips.push([
getGameConfig().blipSprites[getServerGame()].ammunation, getGameConfig().blipSprites[getServerGame()].ammunation,
getServerData().ammunations[getServerGame()][i].position.x, getServerData().ammunations[getServerGame()][i].position.x,
getServerData().ammunations[getServerGame()][i].position.y, getServerData().ammunations[getServerGame()][i].position.y,
getServerData().ammunations[getServerGame()][i].position.z, getServerData().ammunations[getServerGame()][i].position.z,
3, 3,
0 0
]); ]);
} }
@@ -1328,11 +1328,11 @@ function sendAllPayAndSprayBlips(client) {
let tempBlips = []; let tempBlips = [];
for(let i in getServerData().payAndSprays[getServerGame()]) { for(let i in getServerData().payAndSprays[getServerGame()]) {
tempBlips.push([ tempBlips.push([
getGameConfig().blipSprites[getServerGame()].payAndSpray, getGameConfig().blipSprites[getServerGame()].payAndSpray,
getServerData().payAndSprays[getServerGame()][i].position.x, getServerData().payAndSprays[getServerGame()][i].position.x,
getServerData().payAndSprays[getServerGame()][i].position.y, getServerData().payAndSprays[getServerGame()][i].position.y,
getServerData().payAndSprays[getServerGame()][i].position.z, getServerData().payAndSprays[getServerGame()][i].position.z,
3, 3,
0 0
]); ]);
} }
@@ -1347,11 +1347,11 @@ function sendAllFuelStationBlips(client) {
let tempBlips = []; let tempBlips = [];
for(let i in getServerData().fuelStations[getServerGame()]) { for(let i in getServerData().fuelStations[getServerGame()]) {
tempBlips.push([ tempBlips.push([
getGameConfig().blipSprites[getServerGame()].fuelStation, getGameConfig().blipSprites[getServerGame()].fuelStation,
getServerData().fuelStations[getServerGame()][i].position.x, getServerData().fuelStations[getServerGame()][i].position.x,
getServerData().fuelStations[getServerGame()][i].position.y, getServerData().fuelStations[getServerGame()][i].position.y,
getServerData().fuelStations[getServerGame()][i].position.z, getServerData().fuelStations[getServerGame()][i].position.z,
3, 3,
getColourByName("burntOrange"), getColourByName("burntOrange"),
]); ]);
} }
@@ -1480,10 +1480,10 @@ function processHoldActionKey(client) {
function processPressActionKey(client) { function processPressActionKey(client) {
// Check job stuff // Check job stuff
let closestJob = getClosestJob(client.player.position); let closestJob = getClosestJob(client.player.position);
if(getPlayerCurrentSubAccount(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) {
} }
} }
} }
@@ -1503,7 +1503,7 @@ function processHoldVehicleLockKey(client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function processHoldVehicleEngineKey(client) { function processHoldVehicleEngineKey(client) {
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -1522,7 +1522,7 @@ function getClientChatColour(client) {
function showConnectCameraToPlayer(client) { function showConnectCameraToPlayer(client) {
triggerNetworkEvent("ag.connectCamera", client, getServerConfig().connectCameraPosition, getServerConfig().connectCameraLookAt); triggerNetworkEvent("ag.connectCamera", client, getServerConfig().connectCameraPosition, getServerConfig().connectCameraLookAt);
//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);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -1732,7 +1732,7 @@ function getSkinIdFromName(params, gameId = getServerGame()) {
function getClosestHospital(position) { function getClosestHospital(position) {
let closest = 0; let closest = 0;
for(let i in getServerData().hospitals[getServerGame()]) { for(let i in getServerData().hospitals[getServerGame()]) {
if(getServerData().hospitals[getServerGame()][i].position.distance(position) < getServerData().hospitals[getServerGame()][closest].position) { if(getDistance(getServerData().hospitals[getServerGame()][i].position, position) < getDistance(getServerData().hospitals[getServerGame()][closest].position, position)) {
closest = i; closest = i;
} }
} }

View File

@@ -35,7 +35,7 @@ function loadVehiclesFromDatabase() {
} }
disconnectFromDatabase(dbConnection); disconnectFromDatabase(dbConnection);
} }
console.log(`[Asshat.Vehicle]: ${tempVehicles.length} vehicles loaded from database successfully!`); console.log(`[Asshat.Vehicle]: ${tempVehicles.length} vehicles loaded from database successfully!`);
return tempVehicles; return tempVehicles;
} }
@@ -66,7 +66,7 @@ function saveVehicleToDatabase(vehicleData) {
return false; return false;
} }
console.log(`[Asshat.Vehicle]: Saving vehicle ${vehicleData.vehicle.id} to database ...`); console.log(`[Asshat.Vehicle]: Saving vehicle ${vehicleData.databaseId} to database ...`);
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
if(dbConnection) { if(dbConnection) {
if(!vehicleData.spawnLocked) { if(!vehicleData.spawnLocked) {
@@ -75,7 +75,7 @@ function saveVehicleToDatabase(vehicleData) {
vehicleData.spawnRotation = vehicleData.vehicle.heading; vehicleData.spawnRotation = vehicleData.vehicle.heading;
} else { } else {
vehicleData.spawnPosition = vehicleData.syncPosition; vehicleData.spawnPosition = vehicleData.syncPosition;
vehicleData.spawnRotation = vehicleData.syncHeading; vehicleData.spawnRotation = vehicleData.syncHeading;
} }
} }
@@ -142,10 +142,10 @@ function createVehicleCommand(command, params, client) {
if(!vehicle) { if(!vehicle) {
messagePlayerError(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);
addToWorld(vehicle); addToWorld(vehicle);
let tempVehicleData = new serverClasses.vehicleData(false, vehicle); let tempVehicleData = new serverClasses.vehicleData(false, vehicle);
setEntityData(vehicle, "ag.dataSlot", vehicleDataSlot, true); setEntityData(vehicle, "ag.dataSlot", vehicleDataSlot, true);
@@ -168,7 +168,7 @@ function createTemporaryVehicleCommand(command, params, client) {
let frontPos = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getGlobalConfig().spawnCarDistance); let frontPos = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getGlobalConfig().spawnCarDistance);
let vehicleDataSlot = getServerData().vehicles.length; let vehicleDataSlot = getServerData().vehicles.length;
let vehicle = gta.createVehicle(modelId, frontPos, getPlayerHeading(client)); let vehicle = gta.createVehicle(modelId, frontPos, getPlayerHeading(client));
if(!vehicle) { if(!vehicle) {
messagePlayerError(client, "The vehicle could not be created!"); messagePlayerError(client, "The vehicle could not be created!");
@@ -229,18 +229,18 @@ function vehicleLockCommand(command, params, client) {
function vehicleLightsCommand(command, params, client) { function vehicleLightsCommand(command, params, client) {
if(!getPlayerVehicle(client)) { if(!getPlayerVehicle(client)) {
messagePlayerError(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) {
messagePlayerError(client, "You need to be in the front seat!"); messagePlayerError(client, "You need to be in the front seat!");
return false; return false;
} }
triggerNetworkEvent("ag.veh.lights", getVehicleSyncer(vehicle), getVehicleForNetworkEvent(vehicle), getVehicleData(vehicle).lights); triggerNetworkEvent("ag.veh.lights", getVehicleSyncer(vehicle), getVehicleForNetworkEvent(vehicle), getVehicleData(vehicle).lights);
getVehicleData(vehicle).lights = !getVehicleData(vehicle).lights; getVehicleData(vehicle).lights = !getVehicleData(vehicle).lights;
meActionToNearbyPlayers(client, `turned the ${getVehicleName(vehicle)}'s lights ${getOnOffFromBool(vehicle)}`); meActionToNearbyPlayers(client, `turned the ${getVehicleName(vehicle)}'s lights ${getOnOffFromBool(vehicle)}`);
@@ -251,7 +251,7 @@ function vehicleLightsCommand(command, params, client) {
function deleteVehicleCommand(command, params, client) { function deleteVehicleCommand(command, params, client) {
if(!getPlayerVehicle(client)) { if(!getPlayerVehicle(client)) {
messagePlayerError(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);
@@ -269,12 +269,12 @@ function deleteVehicleCommand(command, params, client) {
function vehicleEngineCommand(command, params, client) { function vehicleEngineCommand(command, params, client) {
if(!getPlayerVehicle(client)) { if(!getPlayerVehicle(client)) {
messagePlayerError(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) {
messagePlayerError(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);
@@ -296,12 +296,12 @@ function vehicleEngineCommand(command, params, client) {
function vehicleSirenCommand(command, params, client) { function vehicleSirenCommand(command, params, client) {
if(!getPlayerVehicle(client)) { if(!getPlayerVehicle(client)) {
messagePlayerError(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) {
messagePlayerError(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);
@@ -322,8 +322,8 @@ function vehicleSirenCommand(command, params, client) {
function setVehicleColourCommand(command, params, client) { function setVehicleColourCommand(command, params, client) {
if(!getPlayerVehicle(client)) { if(!getPlayerVehicle(client)) {
messagePlayerError(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);
@@ -342,14 +342,14 @@ function setVehicleColourCommand(command, params, client) {
let splitParams = params.split(" "); let splitParams = params.split(" ");
let colour1 = toInteger(splitParams[0]) || 0; let colour1 = toInteger(splitParams[0]) || 0;
let colour2 = toInteger(splitParams[1]) || 0; let colour2 = toInteger(splitParams[1]) || 0;
getPlayerCurrentSubAccount(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;
getVehicleData(vehicle).colour1 = colour1; getVehicleData(vehicle).colour1 = colour1;
getVehicleData(vehicle).colour2 = colour1; getVehicleData(vehicle).colour2 = colour1;
meActionToNearbyPlayers(client, `resprays the ${getVehicleName(vehicle)}'s colours`); meActionToNearbyPlayers(client, `resprays the ${getVehicleName(vehicle)}'s colours`);
} }
@@ -358,10 +358,10 @@ function setVehicleColourCommand(command, params, client) {
function vehicleRepairCommand(command, params, client) { function vehicleRepairCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messagePlayerError(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(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("manageVehicles"))) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("manageVehicles"))) {
@@ -375,10 +375,10 @@ function vehicleRepairCommand(command, params, client) {
return false; return false;
} }
getPlayerCurrentSubAccount(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)}!`);
} }
@@ -387,14 +387,14 @@ function vehicleRepairCommand(command, params, client) {
function buyVehicleCommand(command, params, client) { function buyVehicleCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messagePlayerError(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) {
messagePlayerError(client, `This ${getVehicleName(vehicle)} is not for sale!`); messagePlayerError(client, `This ${getVehicleName(vehicle)} is not for sale!`);
return false; return false;
} }
if(getPlayerCurrentSubAccount(client).cash < getVehicleData(vehicle).buyPrice) { if(getPlayerCurrentSubAccount(client).cash < getVehicleData(vehicle).buyPrice) {
@@ -403,13 +403,13 @@ function buyVehicleCommand(command, params, client) {
} }
getPlayerData(client).buyingVehicle = vehicle; getPlayerData(client).buyingVehicle = vehicle;
//getPlayerCurrentSubAccount(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`);
messagePlayerInfo(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.`);
} }
@@ -419,20 +419,20 @@ function buyVehicleCommand(command, params, client) {
function rentVehicleCommand(command, params, client) { function rentVehicleCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messagePlayerError(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) {
messagePlayerError(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;
getPlayerCurrentSubAccount(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!`);
messagePlayerAlert(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.`);
} }
@@ -449,7 +449,7 @@ function stopRentingVehicleCommand(command, params, client) {
//getPlayerCurrentSubAccount(client).cash -= getVehicleData(vehicle).rentPrice; //getPlayerCurrentSubAccount(client).cash -= getVehicleData(vehicle).rentPrice;
let vehicle = getPlayerCurrentSubAccount(client).rentingVehicle; let vehicle = getPlayerCurrentSubAccount(client).rentingVehicle;
stopRentingVehicle(client); stopRentingVehicle(client);
messagePlayerAlert(client, `You are no longer renting the ${getVehicleName(vehicle)}`); messagePlayerAlert(client, `You are no longer renting the ${getVehicleName(vehicle)}`);
} }
@@ -464,7 +464,7 @@ function doesClientHaveVehicleKeys(client, vehicle) {
if(vehicleData.ownerType == AG_VEHOWNER_PUBLIC) { if(vehicleData.ownerType == AG_VEHOWNER_PUBLIC) {
return true; return true;
} }
if(vehicleData.ownerType == AG_VEHOWNER_PLAYER) { if(vehicleData.ownerType == AG_VEHOWNER_PLAYER) {
if(vehicleData.ownerId == getPlayerData(client).accountData.databaseId) { if(vehicleData.ownerId == getPlayerData(client).accountData.databaseId) {
@@ -534,10 +534,10 @@ function getVehicleName(vehicle) {
function setVehicleJobCommand(command, params, client) { function setVehicleJobCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messagePlayerError(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);
let closestJobLocation = getClosestJobLocation(getVehiclePosition(vehicle)); let closestJobLocation = getClosestJobLocation(getVehiclePosition(vehicle));
let jobId = closestJobLocation.job; let jobId = closestJobLocation.job;
@@ -565,13 +565,13 @@ function setVehicleRankCommand(command, params, client) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messagePlayerError(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);
let rankId = params; let rankId = params;
@@ -585,7 +585,7 @@ function setVehicleRankCommand(command, params, client) {
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set their [#AAAAAA]${getVehicleName(vehicle)} [#FFFFFF]rank to [#AAAAAA]${getClanRankData(getVehicleData(vehicle).ownerId, rankId).name} [#FFFFFF]of the [#FF9900]${getClanData(getVehicleData(vehicle).ownerId).name} [#FFFFFFclan!`); messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set their [#AAAAAA]${getVehicleName(vehicle)} [#FFFFFF]rank to [#AAAAAA]${getClanRankData(getVehicleData(vehicle).ownerId, rankId).name} [#FFFFFF]of the [#FF9900]${getClanData(getVehicleData(vehicle).ownerId).name} [#FFFFFFclan!`);
} else if(getVehicleData(vehicle).ownerType == AG_VEHOWNER_JOB) { } else if(getVehicleData(vehicle).ownerType == AG_VEHOWNER_JOB) {
getVehicleData(vehicle).rank = rankId; getVehicleData(vehicle).rank = rankId;
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set their [#AAAAAA]${getVehicleName(vehicle)} [#FFFFFF]rank to [#AAAAAA]${rankId} [#FFFFFF]of the [#FFFF00]${getJobData(getVehicleData(vehicle).ownerId).name} [#FFFFFF]job!`); messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set their [#AAAAAA]${getVehicleName(vehicle)} [#FFFFFF]rank to [#AAAAAA]${rankId} [#FFFFFF]of the [#FFFF00]${getJobData(getVehicleData(vehicle).ownerId).name} [#FFFFFF]job!`);
} }
} }
@@ -594,9 +594,9 @@ function setVehicleRankCommand(command, params, client) {
function setVehicleClanCommand(command, params, client) { function setVehicleClanCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messagePlayerError(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);
let clanId = getClanFromParams(params); let clanId = getClanFromParams(params);
@@ -616,9 +616,9 @@ function setVehicleClanCommand(command, params, client) {
function setVehicleToBusinessCommand(command, params, client) { function setVehicleToBusinessCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messagePlayerError(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);
let businessId = toInteger(isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)); let businessId = toInteger(isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
@@ -633,9 +633,9 @@ function setVehicleToBusinessCommand(command, params, client) {
function setVehicleOwnerCommand(command, params, client) { function setVehicleOwnerCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messagePlayerError(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);
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
@@ -655,9 +655,9 @@ function setVehicleOwnerCommand(command, params, client) {
function setVehicleRentPriceCommand(command, params, client) { function setVehicleRentPriceCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messagePlayerError(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)) {
@@ -678,9 +678,9 @@ function setVehicleRentPriceCommand(command, params, client) {
function setVehicleBuyPriceCommand(command, params, client) { function setVehicleBuyPriceCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messagePlayerError(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)) {
@@ -701,9 +701,9 @@ function setVehicleBuyPriceCommand(command, params, client) {
function removeVehicleOwnerCommand(command, params, client) { function removeVehicleOwnerCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messagePlayerError(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);
let targetClient = getPlayerFromParams(params); let targetClient = getPlayerFromParams(params);
@@ -724,15 +724,15 @@ function removeVehicleOwnerCommand(command, params, client) {
function getVehicleInfoCommand(command, params, client) { function getVehicleInfoCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messagePlayerError(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)) {
messagePlayerError(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;
} }
let vehicleData = getVehicleData(vehicle); let vehicleData = getVehicleData(vehicle);
@@ -759,8 +759,8 @@ function getVehicleInfoCommand(command, params, client) {
case AG_VEHOWNER_BIZ: case AG_VEHOWNER_BIZ:
ownerName = getBusinessData(vehicleData.ownerId).name; ownerName = getBusinessData(vehicleData.ownerId).name;
ownerType = "business"; ownerType = "business";
break; break;
default: default:
break; break;
} }
@@ -773,9 +773,9 @@ function getVehicleInfoCommand(command, params, client) {
function toggleVehicleSpawnLockCommand(command, params, client) { function toggleVehicleSpawnLockCommand(command, params, client) {
if(!isPlayerInAnyVehicle(client)) { if(!isPlayerInAnyVehicle(client)) {
messagePlayerError(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);
let spawnLocked = getVehicleData(vehicle).spawnLocked; let spawnLocked = getVehicleData(vehicle).spawnLocked;
@@ -825,7 +825,7 @@ function respawnAllVehiclesCommand(command, params, client) {
function stopRentingVehicle(client) { function stopRentingVehicle(client) {
let vehicleData = getPlayerData(client).rentingVehicle; let vehicleData = getPlayerData(client).rentingVehicle;
getPlayerData(client).rentingVehicle = false; getPlayerData(client).rentingVehicle = false;
vehicleData.rentedBy = false; vehicleData.rentedBy = false;
respawnVehicle(vehicleData); respawnVehicle(vehicleData);
} }
@@ -861,11 +861,11 @@ function spawnVehicle(vehicleData) {
vehicle.engine = intToBool(vehicleData.engine); vehicle.engine = intToBool(vehicleData.engine);
//vehicle.lights = intToBool(vehicleData.lights); //vehicle.lights = intToBool(vehicleData.lights);
//vehicle.health = vehicleData.health; //vehicle.health = vehicleData.health;
//vehicle.position = vehicleData.spawnPosition; //vehicle.position = vehicleData.spawnPosition;
vehicle.heading = vehicleData.spawnRotation; vehicle.heading = vehicleData.spawnRotation;
vehicle.locked = intToBool(vehicleData.locked); vehicle.locked = intToBool(vehicleData.locked);
vehicleData.vehicle = vehicle; vehicleData.vehicle = vehicle;
@@ -928,8 +928,8 @@ function getVehicleOwnerTypeText(ownerType) {
return "player"; return "player";
case AG_VEHOWNER_BIZ: case AG_VEHOWNER_BIZ:
return "business"; return "business";
default: default:
return "unknown"; return "unknown";
} }
@@ -966,9 +966,9 @@ function createNewDealershipVehicle(model, spawnPosition, spawnRotation, price,
} }
vehicle.heading = spawnRotation; vehicle.heading = spawnRotation;
addToWorld(vehicle); addToWorld(vehicle);
let tempVehicleData = new serverClasses.vehicleData(false, vehicle); let tempVehicleData = new serverClasses.vehicleData(false, vehicle);
tempVehicleData.buyPrice = price; tempVehicleData.buyPrice = price;
tempVehicleData.spawnLocked = true; tempVehicleData.spawnLocked = true;
tempVehicleData.spawnPosition = spawnPosition; tempVehicleData.spawnPosition = spawnPosition;

View File

@@ -275,7 +275,7 @@ let gameData = {
COLOUR_ORANGE, // GTA San Andreas COLOUR_ORANGE, // GTA San Andreas
COLOUR_ORANGE, // GTA Underground COLOUR_ORANGE, // GTA Underground
COLOUR_SILVER, // GTA IV COLOUR_SILVER, // GTA IV
COLOUR_SILVER // GTA IV (EFLC) COLOUR_SILVER // GTA IV (EFLC)
], ],
weatherNames: [ weatherNames: [
["Unknown"], ["Unknown"],
@@ -360,26 +360,26 @@ let gameData = {
"Thunderstorm", "Thunderstorm",
"Extra Sunny", "Extra Sunny",
"Sunny/Windy", "Sunny/Windy",
], ],
], ],
gameNames: [ gameNames: [
"Unknown", "Unknown",
"GTA III", "GTA III",
"GTA Vice City", "GTA Vice City",
"GTA San Andreas", "GTA San Andreas",
"GTA Underground", "GTA Underground",
"GTA IV", "GTA IV",
"GTA IV: Episodes from Liberty City", "GTA IV: Episodes from Liberty City",
], ],
vehicleWheelStateNames: [ vehicleWheelStateNames: [
"normal", "normal",
"flat", "flat",
"gone" "gone"
], ],
vehicleDoorStateNames: [ vehicleDoorStateNames: [
"closed",
"closed", "closed",
"swinging", "closed",
"swinging",
"open" "open"
], ],
vehicleWheelNames: [ vehicleWheelNames: [
@@ -400,7 +400,7 @@ let gameData = {
"Head Radio", "Head Radio",
"Double Cleff FM", "Double Cleff FM",
"Jah Radio", "Jah Radio",
"Rise FM", "Rise FM",
"Lips 106", "Lips 106",
"Flashback FM", "Flashback FM",
"Chatterbox 109", "Chatterbox 109",
@@ -410,7 +410,7 @@ let gameData = {
"Wildstyle", "Wildstyle",
"Flash FM", "Flash FM",
"K CHAT", "K CHAT",
"Fever 105", "Fever 105",
"VROCK", "VROCK",
"VCPR", "VCPR",
"Espantoso", "Espantoso",
@@ -422,7 +422,7 @@ let gameData = {
"KROSE", "KROSE",
"KDST", "KDST",
"Bounce FM", "Bounce FM",
"SFUR", "SFUR",
"Radio Los Santos", "Radio Los Santos",
"Radio X", "Radio X",
"CSR Radio", "CSR Radio",
@@ -433,7 +433,7 @@ let gameData = {
] ]
], ],
vehicleModelIdStart: [ vehicleModelIdStart: [
0, 0,
90, // GTA III 90, // GTA III
130, // GTA Vice City 130, // GTA Vice City
400, // GTA San Andreas 400, // GTA San Andreas
@@ -502,7 +502,7 @@ let gameData = {
"Escape", "Escape",
"Borgnine Taxi", "Borgnine Taxi",
"Toyz Van", "Toyz Van",
"Ghost" "Ghost"
], ],
[ // GTA Vice City [ // GTA Vice City
"Landstalker", "Landstalker",
@@ -611,7 +611,7 @@ let gameData = {
"Hotring Racer 3", "Hotring Racer 3",
"Bloodring Banger 1", "Bloodring Banger 1",
"Bloodring Banger 2", "Bloodring Banger 2",
"VCPD Cheetah" "VCPD Cheetah"
], ],
[ // GTA San Andreas [ // GTA San Andreas
"Landstalker", "Landstalker",
@@ -1153,7 +1153,7 @@ let gameData = {
"#1B376D", "#1B376D",
"#EC6AAE", "#EC6AAE",
"#000000" "#000000"
], ],
[ // GTA Underground [ // GTA Underground
"#000000", "#000000",
"#F5F5F5", "#F5F5F5",
@@ -1931,45 +1931,45 @@ let gameData = {
292 292
], ],
[ // GTA San Andreas [ // GTA San Andreas
], ],
], ],
locations: [ locations: [
[], [],
[ // GTA III [ // GTA III
// Police Stations // Police Stations
["Portland Police Station", [1143.875, -675.1875, 14.97], 0.0], ["Portland Police Station", [1143.875, -675.1875, 14.97], 0.0],
["Staunton Island Police Station", [340.25, -1123.375, 25.98], 0.0], ["Staunton Island Police Station", [340.25, -1123.375, 25.98], 0.0],
["Shoreside Vale Police Station", [-1253.0, -138.1875, 58.75], 0.0], ["Shoreside Vale Police Station", [-1253.0, -138.1875, 58.75], 0.0],
// Hospitals // Hospitals
["Portland Hospital", [1144.25, -596.875, 14.97], 0.0], ["Portland Hospital", [1144.25, -596.875, 14.97], 0.0],
["Staunton Island Hospital", [183.5, -17.75, 16.21], 0.0], ["Staunton Island Hospital", [183.5, -17.75, 16.21], 0.0],
["Shoreside Vale Hospital", [-1259.5, -44.5, 58.89], 0.0], ["Shoreside Vale Hospital", [-1259.5, -44.5, 58.89], 0.0],
// Fire Stations // Fire Stations
["Portland Fire Station", [1103.70, -52.45, 7.49], 0.0], ["Portland Fire Station", [1103.70, -52.45, 7.49], 0.0],
["Staunton Island Fire Station", [-78.48, -436.80, 16.17], 0.0], ["Staunton Island Fire Station", [-78.48, -436.80, 16.17], 0.0],
["Shoreside Vale Fire Station", [-1202.10, -14.67, 53.20], 0.0], ["Shoreside Vale Fire Station", [-1202.10, -14.67, 53.20], 0.0],
// Pay and Sprays // Pay and Sprays
["Portland Pay and Spray", [925.4, -360.3, 10.83], 0.0], ["Portland Pay and Spray", [925.4, -360.3, 10.83], 0.0],
["Staunton Island Pay and Spray", [381.8, -493.8, 25.95], 0.0], ["Staunton Island Pay and Spray", [381.8, -493.8, 25.95], 0.0],
["Shoreside Vale Pay and Spray", [-1142.4, 35.01, 58.61], 0.0], ["Shoreside Vale Pay and Spray", [-1142.4, 35.01, 58.61], 0.0],
// Ammunations // Ammunations
["Portland Ammunation", [1068.3, -400.9, 15.24], 0.0], ["Portland Ammunation", [1068.3, -400.9, 15.24], 0.0],
["Staunton Island Ammunation", [348.2, -717.9, 26.43], 0.0], ["Staunton Island Ammunation", [348.2, -717.9, 26.43], 0.0],
// Train Stations // Train Stations
["Bedford Point Train Station", [178.52, -1551.40, 26.162], -3.105], ["Bedford Point Train Station", [178.52, -1551.40, 26.162], -3.105],
["Francis International Airport Train Station", [-633.42, -760.06, 18.919], 1.586], ["Francis International Airport Train Station", [-633.42, -760.06, 18.919], 1.586],
["Rockford Train Station", [225.66, -69.07, 20.998], -3.115], ["Rockford Train Station", [225.66, -69.07, 20.998], -3.115],
["Saint Marks Train Station", [1306.69, -512.38, 40.078], -2.458], ["Saint Marks Train Station", [1306.69, -512.38, 40.078], -2.458],
["Hepburn Heights Train Station", [1029.07, -164.18, 4.972], 0.005], ["Hepburn Heights Train Station", [1029.07, -164.18, 4.972], 0.005],
["Chinatown Train Station", [775.27, -622.28, 14.747], 0.006], ["Chinatown Train Station", [775.27, -622.28, 14.747], 0.006],
// Safehouses // Safehouses
["Portland Safehouse", [885.52, -308.47, 8.615], -1.532], ["Portland Safehouse", [885.52, -308.47, 8.615], -1.532],
@@ -1993,44 +1993,44 @@ let gameData = {
["Fuzz Ball", [1000.03, -877.82, 14.547], -3.136], ["Fuzz Ball", [1000.03, -877.82, 14.547], -3.136],
["Portland Docks Entrance", [1360.55, -818.08, 14.415], -1.574], ["Portland Docks Entrance", [1360.55, -818.08, 14.415], -1.574],
["Punk Noodle Diner", [1040.10, -653.10, 14.973], 1.551], ["Punk Noodle Diner", [1040.10, -653.10, 14.973], 1.551],
["Greasy Joe's Diner", [864.45, -999.86, 4.646], -0.020], ["Greasy Joe's Diner", [864.45, -999.86, 4.646], -0.020],
], ],
[ // GTA VC [ // GTA VC
// Police Stations // Police Stations
["Washington Beach Police Station", [399.77, -468.90, 11.73], 0.0], ["Washington Beach Police Station", [399.77, -468.90, 11.73], 0.0],
["Vice Point Police Station", [508.96, 512.07, 12.10], 0.0], ["Vice Point Police Station", [508.96, 512.07, 12.10], 0.0],
["Downtown Police Station", [-657.43, 762.31, 11.59], 0.0], ["Downtown Police Station", [-657.43, 762.31, 11.59], 0.0],
["Little Havana Police Station", [-885.08, -470.44, 13.11], 0.0], ["Little Havana Police Station", [-885.08, -470.44, 13.11], 0.0],
// Hospitals // Hospitals
["Downtown Hospital", [-822.57, 1152.82, 12.41], 0.0], ["Downtown Hospital", [-822.57, 1152.82, 12.41], 0.0],
["Little Havana Medical Center", [-885.08, -470.44, 13.11], 0.0], ["Little Havana Medical Center", [-885.08, -470.44, 13.11], 0.0],
["Ocean Beach Hospital", [-133.19, -980.76, 10.46], 0.0], ["Ocean Beach Hospital", [-133.19, -980.76, 10.46], 0.0],
], ],
[ // GTA SA [ // GTA SA
// Coming Soon! // Coming Soon!
], ],
[ // GTA UG [ // GTA UG
// Coming Soon! // Coming Soon!
], ],
[ // GTA IV [ // GTA IV
// Police Stations // Police Stations
["Broker Police Station", [894.99, -357.39, 18.185], 2.923], ["Broker Police Station", [894.99, -357.39, 18.185], 2.923],
["South Bohan Police Station", [435.40, 1592.29, 17.353], 3.087], ["South Bohan Police Station", [435.40, 1592.29, 17.353], 3.087],
["Northern Gardens Police Station", [974.93, 1870.45, 23.073], -1.621], ["Northern Gardens Police Station", [974.93, 1870.45, 23.073], -1.621],
["South Slopes Police Station", [1233.25, -89.13, 28.034], 1.568], ["South Slopes Police Station", [1233.25, -89.13, 28.034], 1.568],
["Middle Part East Police Station", [50.12, 679.88, 15.316], 1.569], ["Middle Part East Police Station", [50.12, 679.88, 15.316], 1.569],
["East Holland Police Station", [85.21, 1189.82, 14.755], 3.127], ["East Holland Police Station", [85.21, 1189.82, 14.755], 3.127],
["Francis International Airport Police Station", [2170.87, 448.87, 6.085], 1.501], ["Francis International Airport Police Station", [2170.87, 448.87, 6.085], 1.501],
["Chinatown Police Station", [213.12, -211.70, 10.752], 0.200], ["Chinatown Police Station", [213.12, -211.70, 10.752], 0.200],
["Acter Police Station", [-1714.95, 276.31, 22.134], 1.127], ["Acter Police Station", [-1714.95, 276.31, 22.134], 1.127],
["Port Tudor Police Station", [-1220.73, -231.53, 3.024], 2.210], ["Port Tudor Police Station", [-1220.73, -231.53, 3.024], 2.210],
["Leftwood Police Station", [-927.66, 1263.63, 24.587], -0.913], ["Leftwood Police Station", [-927.66, 1263.63, 24.587], -0.913],
// Fire Stations // Fire Stations
["Broker Fire Station", [953.13, 95.90, 35.004], 1.595], ["Broker Fire Station", [953.13, 95.90, 35.004], 1.595],
["Northwood Fire Station", [-271.02, 1542.15, 20.420], -1.160], ["Northwood Fire Station", [-271.02, 1542.15, 20.420], -1.160],
@@ -2039,53 +2039,53 @@ let gameData = {
["Chinatown Fire Station", [295.40, -336.88, 4.963], 2.887], ["Chinatown Fire Station", [295.40, -336.88, 4.963], 2.887],
["Berchem Fire Station", [-1574.90, 546.54, 25.449], -0.509], ["Berchem Fire Station", [-1574.90, 546.54, 25.449], -0.509],
["Tudor Fire Station", [-2144.97, 164.15, 12.051], -2.149], ["Tudor Fire Station", [-2144.97, 164.15, 12.051], -2.149],
// Safehouses // Safehouses
["Hove Beach Safehouse Parking", [904.27, -498.00, 14.522], 3.127], ["Hove Beach Safehouse Parking", [904.27, -498.00, 14.522], 3.127],
["South Bohan Safehouse", [589.42, 1402.15, 10.364], 0.007], ["South Bohan Safehouse", [589.42, 1402.15, 10.364], 0.007],
// Hospitals // Hospitals
["Schottler Medical Center", [1199.59, 196.78, 33.554], 1.633], ["Schottler Medical Center", [1199.59, 196.78, 33.554], 1.633],
["Northern Gardens Medical Center", [980.71, 1831.61, 23.898], -0.049], ["Northern Gardens Medical Center", [980.71, 1831.61, 23.898], -0.049],
["Leftwood Hospital", [-1317.27, 1277.20, 22.370], 2.246], ["Leftwood Hospital", [-1317.27, 1277.20, 22.370], 2.246],
["Acter Medical Center", [-1538.43, 344.58, 20.943], -0.156], ["Acter Medical Center", [-1538.43, 344.58, 20.943], -0.156],
// Fuel Stations // Fuel Stations
["Hove Beach Fuel Station", [1128.51, -359.55, 18.441], -0.052], ["Hove Beach Fuel Station", [1128.51, -359.55, 18.441], -0.052],
["Lancaster Fuel Station", [108.37, 1135.13, 13.975], 0.007], ["Lancaster Fuel Station", [108.37, 1135.13, 13.975], 0.007],
["The Meat Quarter Fuel Station", [-434.30, -19.47, 9.864], 1.469], ["The Meat Quarter Fuel Station", [-434.30, -19.47, 9.864], 1.469],
["Cerveza Heights Fuel Station", [1123.50, 328.84, 29.245], -0.154], ["Cerveza Heights Fuel Station", [1123.50, 328.84, 29.245], -0.154],
["Tudor Fuel Station", [-1389.91, 29.19, 6.875], 0.982], ["Tudor Fuel Station", [-1389.91, 29.19, 6.875], 0.982],
// Restaurants // Restaurants
["Star Junction Burger Shot", [-174.00, 276.96, 14.818], -0.029], ["Star Junction Burger Shot", [-174.00, 276.96, 14.818], -0.029],
["South Bohan Burger Shot", [441.95, 1516.64, 16.289], -2.682], ["South Bohan Burger Shot", [441.95, 1516.64, 16.289], -2.682],
["Industrial Burger Shot", [1096.93, 1598.33, 16.721], -2.289], ["Industrial Burger Shot", [1096.93, 1598.33, 16.721], -2.289],
// Night Clubs/Strip Clubs/Bars // Night Clubs/Strip Clubs/Bars
["Perestroika Club", [957.58, -292.58, 19.644], -0.009], ["Perestroika Club", [957.58, -292.58, 19.644], -0.009],
["Triangle Club", [1210.90, 1718.18, 16.667], 1.819], ["Triangle Club", [1210.90, 1718.18, 16.667], 1.819],
// TW@ Cafes // TW@ Cafes
["Outlook Internet Cafe", [977.42, -169.11, 24.013], 1.844], ["Outlook Internet Cafe", [977.42, -169.11, 24.013], 1.844],
["Berchem Internet Cafe", [-1584.46, 466.05, 25.398], -2.441], ["Berchem Internet Cafe", [-1584.46, 466.05, 25.398], -2.441],
// Pay-n-Sprays // Pay-n-Sprays
["Hove Beach Pay-n-Spray", [1058.57, -282.58, 20.760], -3.135], ["Hove Beach Pay-n-Spray", [1058.57, -282.58, 20.760], -3.135],
["Leftwood Pay-n-Spray", [-1148.69, 1171.52, 16.457], -0.059], ["Leftwood Pay-n-Spray", [-1148.69, 1171.52, 16.457], -0.059],
// Clothes Shops // Clothes Shops
["Hove Beach Russian Clothes Shop", [896.31, -442.59, 15.888], 1.500], ["Hove Beach Russian Clothes Shop", [896.31, -442.59, 15.888], 1.500],
// Car Wash // Car Wash
["Willis Car Wash", [1831.02, 360.20, 22.061], -1.515], ["Willis Car Wash", [1831.02, 360.20, 22.061], -1.515],
["Tudor Car Wash", [-1371.68, 35.13, 7.028], 1.029], ["Tudor Car Wash", [-1371.68, 35.13, 7.028], 1.029],
// Gun Shops // Gun Shops
["Downtown Broker Gun Shop", [1054.11, 86.84, 33.408], -1.574], ["Downtown Broker Gun Shop", [1054.11, 86.84, 33.408], -1.574],
["Chinatown Gun Shop", [65.43, -342.36, 14.767], -1.589], ["Chinatown Gun Shop", [65.43, -342.36, 14.767], -1.589],
["Port Tudor Gun Shop", [-1338.77, 307.61, 13.378], -1.530], ["Port Tudor Gun Shop", [-1338.77, 307.61, 13.378], -1.530],
// Train Stations // Train Stations
["Hove Beach Train Station", [1000.41, -544.82, 14.854], -1.576], ["Hove Beach Train Station", [1000.41, -544.82, 14.854], -1.576],
["Schottler Train Station", [1303.93, -37.75, 28.377], 3.065], ["Schottler Train Station", [1303.93, -37.75, 28.377], 3.065],
@@ -2112,7 +2112,7 @@ let gameData = {
["San Quentin Ave Train Station", [373.12, 1625.93, 16.347], -2.249], ["San Quentin Ave Train Station", [373.12, 1625.93, 16.347], -2.249],
["Windmill Street Train Station", [749.97, 1447.44, 14.252], -0.120], ["Windmill Street Train Station", [749.97, 1447.44, 14.252], -0.120],
["Francis International Airport Train Station", [2297.57, 474.62, 6.086], 0.066], ["Francis International Airport Train Station", [2297.57, 474.62, 6.086], 0.066],
// Misc // Misc
["Hove Beach Laundromat", [1011.74, -325.33, 20.339], -1.402], ["Hove Beach Laundromat", [1011.74, -325.33, 20.339], -1.402],
["The Exchange Docks", [-354.68, -661.62, 4.791], 2.066], ["The Exchange Docks", [-354.68, -661.62, 4.791], 2.066],
@@ -2122,24 +2122,24 @@ let gameData = {
["Alderney State Correctional Facility", [-1155.21, -374.34, 2.885], -1.680], ["Alderney State Correctional Facility", [-1155.21, -374.34, 2.885], -1.680],
["Chinatown Bank of Liberty", [-34.92, -466.80, 14.75], -1.52], ["Chinatown Bank of Liberty", [-34.92, -466.80, 14.75], -1.52],
["Suffolk Church", [-274.30, -281.63, 14.36], 1.56], ["Suffolk Church", [-274.30, -281.63, 14.36], 1.56],
// More will be added soon! // More will be added soon!
], ],
[ // GTA EFLC [ // GTA EFLC
// Police Stations // Police Stations
["Broker Police Station", [894.99, -357.39, 18.185], 2.923], ["Broker Police Station", [894.99, -357.39, 18.185], 2.923],
["South Bohan Police Station", [435.40, 1592.29, 17.353], 3.087], ["South Bohan Police Station", [435.40, 1592.29, 17.353], 3.087],
["Northern Gardens Police Station", [974.93, 1870.45, 23.073], -1.621], ["Northern Gardens Police Station", [974.93, 1870.45, 23.073], -1.621],
["South Slopes Police Station", [1233.25, -89.13, 28.034], 1.568], ["South Slopes Police Station", [1233.25, -89.13, 28.034], 1.568],
["Middle Part East Police Station", [50.12, 679.88, 15.316], 1.569], ["Middle Part East Police Station", [50.12, 679.88, 15.316], 1.569],
["East Holland Police Station", [85.21, 1189.82, 14.755], 3.127], ["East Holland Police Station", [85.21, 1189.82, 14.755], 3.127],
["Francis International Airport Police Station", [2170.87, 448.87, 6.085], 1.501], ["Francis International Airport Police Station", [2170.87, 448.87, 6.085], 1.501],
["Chinatown Police Station", [213.12, -211.70, 10.752], 0.200], ["Chinatown Police Station", [213.12, -211.70, 10.752], 0.200],
["Acter Police Station", [-1714.95, 276.31, 22.134], 1.127], ["Acter Police Station", [-1714.95, 276.31, 22.134], 1.127],
["Port Tudor Police Station", [-1220.73, -231.53, 3.024], 2.210], ["Port Tudor Police Station", [-1220.73, -231.53, 3.024], 2.210],
["Leftwood Police Station", [-927.66, 1263.63, 24.587], -0.913], ["Leftwood Police Station", [-927.66, 1263.63, 24.587], -0.913],
// Fire Stations // Fire Stations
["Broker Fire Station", [953.13, 95.90, 35.004], 1.595], ["Broker Fire Station", [953.13, 95.90, 35.004], 1.595],
["Northwood Fire Station", [-271.02, 1542.15, 20.420], -1.160], ["Northwood Fire Station", [-271.02, 1542.15, 20.420], -1.160],
@@ -2148,53 +2148,53 @@ let gameData = {
["Chinatown Fire Station", [295.40, -336.88, 4.963], 2.887], ["Chinatown Fire Station", [295.40, -336.88, 4.963], 2.887],
["Berchem Fire Station", [-1574.90, 546.54, 25.449], -0.509], ["Berchem Fire Station", [-1574.90, 546.54, 25.449], -0.509],
["Tudor Fire Station", [-2144.97, 164.15, 12.051], -2.149], ["Tudor Fire Station", [-2144.97, 164.15, 12.051], -2.149],
// Safehouses // Safehouses
["Hove Beach Safehouse Parking", [904.27, -498.00, 14.522], 3.127], ["Hove Beach Safehouse Parking", [904.27, -498.00, 14.522], 3.127],
["South Bohan Safehouse", [589.42, 1402.15, 10.364], 0.007], ["South Bohan Safehouse", [589.42, 1402.15, 10.364], 0.007],
// Hospitals // Hospitals
["Schottler Medical Center", [1199.59, 196.78, 33.554], 1.633], ["Schottler Medical Center", [1199.59, 196.78, 33.554], 1.633],
["Northern Gardens Medical Center", [980.71, 1831.61, 23.898], -0.049], ["Northern Gardens Medical Center", [980.71, 1831.61, 23.898], -0.049],
["Leftwood Hospital", [-1317.27, 1277.20, 22.370], 2.246], ["Leftwood Hospital", [-1317.27, 1277.20, 22.370], 2.246],
["Acter Medical Center", [-1538.43, 344.58, 20.943], -0.156], ["Acter Medical Center", [-1538.43, 344.58, 20.943], -0.156],
// Fuel Stations // Fuel Stations
["Hove Beach Fuel Station", [1128.51, -359.55, 18.441], -0.052], ["Hove Beach Fuel Station", [1128.51, -359.55, 18.441], -0.052],
["Lancaster Fuel Station", [108.37, 1135.13, 13.975], 0.007], ["Lancaster Fuel Station", [108.37, 1135.13, 13.975], 0.007],
["The Meat Quarter Fuel Station", [-434.30, -19.47, 9.864], 1.469], ["The Meat Quarter Fuel Station", [-434.30, -19.47, 9.864], 1.469],
["Cerveza Heights Fuel Station", [1123.50, 328.84, 29.245], -0.154], ["Cerveza Heights Fuel Station", [1123.50, 328.84, 29.245], -0.154],
["Tudor Fuel Station", [-1389.91, 29.19, 6.875], 0.982], ["Tudor Fuel Station", [-1389.91, 29.19, 6.875], 0.982],
// Restaurants // Restaurants
["Star Junction Burger Shot", [-174.00, 276.96, 14.818], -0.029], ["Star Junction Burger Shot", [-174.00, 276.96, 14.818], -0.029],
["South Bohan Burger Shot", [441.95, 1516.64, 16.289], -2.682], ["South Bohan Burger Shot", [441.95, 1516.64, 16.289], -2.682],
["Industrial Burger Shot", [1096.93, 1598.33, 16.721], -2.289], ["Industrial Burger Shot", [1096.93, 1598.33, 16.721], -2.289],
// Night Clubs/Strip Clubs/Bars // Night Clubs/Strip Clubs/Bars
["Perestroika Club", [957.58, -292.58, 19.644], -0.009], ["Perestroika Club", [957.58, -292.58, 19.644], -0.009],
["Triangle Club", [1210.90, 1718.18, 16.667], 1.819], ["Triangle Club", [1210.90, 1718.18, 16.667], 1.819],
// TW@ Cafes // TW@ Cafes
["Outlook Internet Cafe", [977.42, -169.11, 24.013], 1.844], ["Outlook Internet Cafe", [977.42, -169.11, 24.013], 1.844],
["Berchem Internet Cafe", [-1584.46, 466.05, 25.398], -2.441], ["Berchem Internet Cafe", [-1584.46, 466.05, 25.398], -2.441],
// Pay-n-Sprays // Pay-n-Sprays
["Hove Beach Pay-n-Spray", [1058.57, -282.58, 20.760], -3.135], ["Hove Beach Pay-n-Spray", [1058.57, -282.58, 20.760], -3.135],
["Leftwood Pay-n-Spray", [-1148.69, 1171.52, 16.457], -0.059], ["Leftwood Pay-n-Spray", [-1148.69, 1171.52, 16.457], -0.059],
// Clothes Shops // Clothes Shops
["Hove Beach Russian Clothes Shop", [896.31, -442.59, 15.888], 1.500], ["Hove Beach Russian Clothes Shop", [896.31, -442.59, 15.888], 1.500],
// Car Wash // Car Wash
["Willis Car Wash", [1831.02, 360.20, 22.061], -1.515], ["Willis Car Wash", [1831.02, 360.20, 22.061], -1.515],
["Tudor Car Wash", [-1371.68, 35.13, 7.028], 1.029], ["Tudor Car Wash", [-1371.68, 35.13, 7.028], 1.029],
// Gun Shops // Gun Shops
["Downtown Broker Gun Shop", [1054.11, 86.84, 33.408], -1.574], ["Downtown Broker Gun Shop", [1054.11, 86.84, 33.408], -1.574],
["Chinatown Gun Shop", [65.43, -342.36, 14.767], -1.589], ["Chinatown Gun Shop", [65.43, -342.36, 14.767], -1.589],
["Port Tudor Gun Shop", [-1338.77, 307.61, 13.378], -1.530], ["Port Tudor Gun Shop", [-1338.77, 307.61, 13.378], -1.530],
// Train Stations // Train Stations
["Hove Beach Train Station", [1000.41, -544.82, 14.854], -1.576], ["Hove Beach Train Station", [1000.41, -544.82, 14.854], -1.576],
["Schottler Train Station", [1303.93, -37.75, 28.377], 3.065], ["Schottler Train Station", [1303.93, -37.75, 28.377], 3.065],
@@ -2221,7 +2221,7 @@ let gameData = {
["San Quentin Ave Train Station", [373.12, 1625.93, 16.347], -2.249], ["San Quentin Ave Train Station", [373.12, 1625.93, 16.347], -2.249],
["Windmill Street Train Station", [749.97, 1447.44, 14.252], -0.120], ["Windmill Street Train Station", [749.97, 1447.44, 14.252], -0.120],
["Francis International Airport Train Station", [2297.57, 474.62, 6.086], 0.066], ["Francis International Airport Train Station", [2297.57, 474.62, 6.086], 0.066],
// Misc // Misc
["Hove Beach Laundromat", [1011.74, -325.33, 20.339], -1.402], ["Hove Beach Laundromat", [1011.74, -325.33, 20.339], -1.402],
["The Exchange Docks", [-354.68, -661.62, 4.791], 2.066], ["The Exchange Docks", [-354.68, -661.62, 4.791], 2.066],
@@ -2231,9 +2231,9 @@ let gameData = {
["Alderney State Correctional Facility", [-1155.21, -374.34, 2.885], -1.680], ["Alderney State Correctional Facility", [-1155.21, -374.34, 2.885], -1.680],
["Chinatown Bank of Liberty", [-34.92, -466.80, 14.75], -1.52], ["Chinatown Bank of Liberty", [-34.92, -466.80, 14.75], -1.52],
["Suffolk Church", [-274.30, -281.63, 14.36], 1.56], ["Suffolk Church", [-274.30, -281.63, 14.36], 1.56],
// More will be added soon! // More will be added soon!
], ],
], ],
gtaivSkinModels: [ gtaivSkinModels: [
//["Nico Bellic", 1862763509], //["Nico Bellic", 1862763509],
@@ -2711,7 +2711,7 @@ let gameData = {
["Cablecar", -960289747], ["Cablecar", -960289747],
["Subway", 800869680], ["Subway", 800869680],
["El Train", -1953988645], ["El Train", -1953988645],
] ]
}; };
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -43,7 +43,7 @@ mexui.bindEvents = function()
{ {
if(isAbsolute) if(isAbsolute)
return; return;
mexui.triggerEvent('onMouseMove', new Vec2(position.x, position.y), true); mexui.triggerEvent('onMouseMove', new Vec2(position.x, position.y), true);
}); });
@@ -55,7 +55,7 @@ mexui.bindEvents = function()
addEventHandler('onKeyDown', function(event, key, pkey, mods) addEventHandler('onKeyDown', function(event, key, pkey, mods)
{ {
mexui.triggerEvent('onKeyDown', key, mods); mexui.triggerEvent('onKeyDown', key, mods);
if(key == SDLK_TAB) if(key == SDLK_TAB)
{ {
mexui.cycleFocusedControl(); mexui.cycleFocusedControl();
@@ -65,7 +65,7 @@ mexui.bindEvents = function()
addEventHandler('onCharacter', function(event, character) addEventHandler('onCharacter', function(event, character)
{ {
mexui.triggerEvent('onCharacter', character); mexui.triggerEvent('onCharacter', character);
if(character == 't' || character == 'T') if(character == 't' || character == 'T')
{ {
var textInput = mexui.getFocusedTextInput(); var textInput = mexui.getFocusedTextInput();
@@ -118,10 +118,10 @@ mexui.render = function()
mexui.triggerEvent = function(eventName, data, callBaseMethodFirst) mexui.triggerEvent = function(eventName, data, callBaseMethodFirst)
{ {
var e = new mexui.Component.Event(); var e = new mexui.Component.Event();
if(data.button !== undefined) if(data.button !== undefined)
e.button = data.button; e.button = data.button;
var windows = mexui.windows.slice(0, mexui.windows.length).reverse(); var windows = mexui.windows.slice(0, mexui.windows.length).reverse();
for(var i in windows) for(var i in windows)
{ {
@@ -135,7 +135,7 @@ mexui.triggerEvent = function(eventName, data, callBaseMethodFirst)
if(e.used) if(e.used)
break; break;
} }
windows[i][eventName].call(windows[i], e, data); windows[i][eventName].call(windows[i], e, data);
if(e.used) if(e.used)
break; break;
@@ -145,7 +145,7 @@ mexui.triggerEvent = function(eventName, data, callBaseMethodFirst)
windows[i][eventName].call(windows[i], e, data); windows[i][eventName].call(windows[i], e, data);
if(e.used) if(e.used)
break; break;
if(mexui.Entity.Component.prototype[eventName]) if(mexui.Entity.Component.prototype[eventName])
{ {
mexui.Entity.Component.prototype[eventName].call(windows[i], e, data); mexui.Entity.Component.prototype[eventName].call(windows[i], e, data);
@@ -182,15 +182,15 @@ mexui.getShownWindows = function()
mexui.getNextShownWindows = function(afterWindow) mexui.getNextShownWindows = function(afterWindow)
{ {
var shownWindows = mexui.getShownWindows(); var shownWindows = mexui.getShownWindows();
var windowIndex = shownWindows.indexOf(afterWindow); var windowIndex = shownWindows.indexOf(afterWindow);
var windows2 = shownWindows.splice(0, windowIndex + 1); var windows2 = shownWindows.splice(0, windowIndex + 1);
var args = windows2; var args = windows2;
args.unshift(0); args.unshift(0);
args.unshift(shownWindows.length); args.unshift(shownWindows.length);
shownWindows.splice.apply(shownWindows, args); shownWindows.splice.apply(shownWindows, args);
return shownWindows; return shownWindows;
}; };
@@ -199,18 +199,18 @@ mexui.cycleFocusedControl = function()
// no windows are created // no windows are created
if(mexui.windows.length == 0) if(mexui.windows.length == 0)
return; return;
// no control is focused // no control is focused
if(!mexui.focusedControl) if(!mexui.focusedControl)
{ {
var topWindow = mexui.getTopWindow(); var topWindow = mexui.getTopWindow();
if(!topWindow) if(!topWindow)
return; return;
mexui.focusedControl = topWindow.getFirstShownControl(); mexui.focusedControl = topWindow.getFirstShownControl();
return; return;
} }
// a control is focused // a control is focused
var focusedControlWindow = mexui.focusedControl.window; var focusedControlWindow = mexui.focusedControl.window;
var nextControl = focusedControlWindow.getNextShownControl(mexui.focusedControl); var nextControl = focusedControlWindow.getNextShownControl(mexui.focusedControl);
@@ -219,7 +219,7 @@ mexui.cycleFocusedControl = function()
mexui.focusedControl = nextControl; mexui.focusedControl = nextControl;
return; return;
} }
// set focus to first control on next window that has a control shown // set focus to first control on next window that has a control shown
var shownWindows = mexui.getNextShownWindows(focusedControlWindow); var shownWindows = mexui.getNextShownWindows(focusedControlWindow);
for(var i in shownWindows) for(var i in shownWindows)
@@ -238,10 +238,10 @@ mexui.getFocusedTextInput = function()
{ {
if(!mexui.focusedControl) if(!mexui.focusedControl)
return null; return null;
if(!(mexui.focusedControl instanceof mexui.Control.TextInput)) if(!(mexui.focusedControl instanceof mexui.Control.TextInput))
return null; return null;
return mexui.focusedControl; return mexui.focusedControl;
}; };
@@ -250,7 +250,7 @@ mexui.toggleTextInputCaretShownForBlink = function()
var textInput = mexui.getFocusedTextInput(); var textInput = mexui.getFocusedTextInput();
if(!textInput) if(!textInput)
return; return;
textInput.caretShownForBlink = !textInput.caretShownForBlink; textInput.caretShownForBlink = !textInput.caretShownForBlink;
}; };
@@ -287,12 +287,12 @@ mexui.isAnyWindowShown = function()
mexui.setInput = function(showInput) mexui.setInput = function(showInput)
{ {
gui.showCursor(showInput, !showInput); gui.showCursor(showInput, !showInput);
if(localPlayer) //if(localPlayer)
{ //{
if(showInput) // if(showInput)
gta.setCameraLookAtEntity(new Vec3(gta.cameraMatrix.m41, gta.cameraMatrix.m42, gta.cameraMatrix.m43), localPlayer, false); // gta.setCameraLookAtEntity(new Vec3(gta.cameraMatrix.m41, gta.cameraMatrix.m42, gta.cameraMatrix.m43), localPlayer, false);
else // else
gta.restoreCamera(false); // gta.restoreCamera(false);
} //}
}; };