Add some IV support

This commit is contained in:
Vortrex
2021-02-20 20:09:07 -06:00
parent a48cdd3e72
commit d501e00092
6 changed files with 39 additions and 20 deletions

View File

@@ -311,7 +311,9 @@ addNetworkHandler("ag.removeFromVehicle", function() {
// ---------------------------------------------------------------------------
function processEvent(event, deltaTime) {
if(gta.game != GAME_GTA_IV) {
gta.clearMessages();
}
if(localPlayer != null) {
if(isSpawned) {
@@ -436,7 +438,7 @@ addEventHandler("OnDrawnHUD", function (event) {
}
}
if(renderLabels) {
if(renderLabels && gta.game != GAME_GTA_IV) {
processLabelRendering();
}

View File

@@ -36,6 +36,15 @@ addNetworkHandler("ag.nametag", function(clientName, characterName, colour, paus
playerColours[clientName] = colour;
playerPaused[clientName] = paused;
playerPing[clientName] = ping;
if(gta.game == GAME_GTA_IV) {
let client = getPlayerFromParams(clientName);
if(client != false) {
if(client.player != null) {
client.player.setNametag(characterName, colour);
}
}
}
});
// -------------------------------------------------------------------------

View File

@@ -67,7 +67,7 @@ function addAllNetworkHandlers() {
// ---------------------------------------------------------------------------
function updatePlayerNameTag(client) {
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
//logToConsole(LOG_DEBUG, `[Asshat.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
triggerNetworkEvent("ag.nametag", null, client.name, getPlayerNameForNameTag(client), getPlayerColour(client), false, client.ping);
}
@@ -84,7 +84,7 @@ function updateAllPlayerNameTags() {
// ---------------------------------------------------------------------------
function updatePlayerPing(client) {
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
//logToConsole(LOG_DEBUG, `[Asshat.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
triggerNetworkEvent("ag.ping", null, client.name, client.ping);
}
@@ -187,8 +187,10 @@ function syncPlayerProperties(client) {
// ---------------------------------------------------------------------------
function updatePlayerSnowState(client) {
if(doesGameHaveSnow(getServerGame())) {
logToConsole(LOG_DEBUG, `[Asshat.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`);
triggerNetworkEvent("ag.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow);
}
}
// ---------------------------------------------------------------------------
@@ -444,14 +446,14 @@ function sendPlayerSetHeading(client, heading) {
// ---------------------------------------------------------------------------
function sendPlayerSetInterior(client, interior) {
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
triggerNetworkEvent("ag.interior", client, interior);
}
// ---------------------------------------------------------------------------
function sendPlayerFrozenState(client, state) {
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
triggerNetworkEvent("ag.frozen", client, state);
}

View File

@@ -245,7 +245,11 @@ function selectCharacter(client, characterId = -1) {
logToConsole(LOG_DEBUG, `[Asshat.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
//setPlayerCameraLookAt(client, getPosBehindPos(spawnPosition, spawnHeading, 5), spawnPosition);
if(getServerGame() == GAME_GTA_IV) {
spawnPlayer(client, spawnPosition, spawnHeading, skin);
} else {
spawnPlayer(client, spawnPosition, spawnHeading, skin, spawnInterior, spawnDimension);
}
//spawnPlayer(p(0), getServerConfig().newCharacter.spawnPosition, 0.0, 26);
logToConsole(LOG_DEBUG, `[Asshat.SubAccount] Spawned ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);

View File

@@ -14,9 +14,9 @@ mexui.native.loadImage = function(imageFilePath, imageName)
var parts = imageFilePath.split('.');
var ext = parts[parts.length - 1].toLowerCase();
if(ext == 'png')
image = graphics.loadPNG(file);
image = drawing.loadPNG(file);
else if(ext == 'bmp')
image = graphics.loadBMP(file);
image = drawing.loadBMP(file);
else
{
logToConsole(LOG_DEBUG, 'ERROR [IMAGE LOAD] - Unsupported image file path extension. Currently only supports PNG or BMP.');
@@ -93,7 +93,7 @@ mexui.native.drawRectangleBackground = function(position, size, styles)
if(backgroundColour == null || backgroundColour == 'none')
return;
graphics.drawRectangle(null, position, size, backgroundColour, backgroundColour, backgroundColour, backgroundColour);
drawing.drawRectangle(null, position, size, backgroundColour, backgroundColour, backgroundColour, backgroundColour);
};
mexui.native.drawRectangleBorder = function(position, size, styles)
@@ -133,7 +133,7 @@ mexui.native.drawAALine = function(point1, point2, styles)
if(lineColour == null || lineColour == 'none')
return;
graphics.drawRectangle(null, point1, new Vec2((point2.x - point1.x) + styles.lineWeight, (point2.y - point1.y) + styles.lineWeight), lineColour, lineColour, lineColour, lineColour);
drawing.drawRectangle(null, point1, new Vec2((point2.x - point1.x) + styles.lineWeight, (point2.y - point1.y) + styles.lineWeight), lineColour, lineColour, lineColour, lineColour);
};
mexui.native.drawText = function(position, size, text, styles)
@@ -149,6 +149,6 @@ mexui.native.drawText = function(position, size, text, styles)
mexui.native.drawImage = function(position, size, image, styles)
{
graphics.drawRectangle(image, position, size);
drawing.drawRectangle(image, position, size);
};

View File

@@ -287,6 +287,7 @@ mexui.isAnyWindowShown = function()
mexui.setInput = function(showInput)
{
gui.showCursor(showInput, !showInput);
if(gta.game != GAME_GTA_IV) {
if(localPlayer)
{
if(showInput)
@@ -294,5 +295,6 @@ mexui.setInput = function(showInput)
else
gta.restoreCamera(false);
}
}
};