Map loaded net event

This commit is contained in:
Vortrex
2022-09-20 02:24:48 -05:00
parent a077699648
commit 5ce4bd15a3

View File

@@ -9,14 +9,14 @@
// =========================================================================== // ===========================================================================
function initNetworkEventsScript() { function initNetworkEventsScript() {
logToConsole(LOG_DEBUG, "[VRR.NetEvents]: Initializing network events script ..."); logToConsole(LOG_DEBUG, "[AGRP.NetEvents]: Initializing network events script ...");
logToConsole(LOG_INFO, "[VRR.NetEvents]: Network events script initialized!"); logToConsole(LOG_INFO, "[AGRP.NetEvents]: Network events script initialized!");
} }
// =========================================================================== // ===========================================================================
function addAllNetworkEventHandlers() { function addAllNetworkEventHandlers() {
logToConsole(LOG_DEBUG, "[VRR.Client]: Adding network handlers ..."); logToConsole(LOG_DEBUG, "[AGRP.Client]: Adding network handlers ...");
// KeyBind // KeyBind
addNetworkEventHandler("agrp.useKeyBind", playerUsedKeyBind); addNetworkEventHandler("agrp.useKeyBind", playerUsedKeyBind);
@@ -74,19 +74,20 @@ function addAllNetworkEventHandlers() {
addNetworkEventHandler("agrp.vehBuyState", receiveVehiclePurchaseStateUpdateFromClient); addNetworkEventHandler("agrp.vehBuyState", receiveVehiclePurchaseStateUpdateFromClient);
addNetworkEventHandler("agrp.playerPedId", receivePlayerPedNetworkId); addNetworkEventHandler("agrp.playerPedId", receivePlayerPedNetworkId);
addNetworkEventHandler("agrp.playerCop", setPlayerAsCopState); addNetworkEventHandler("agrp.playerCop", setPlayerAsCopState);
addNetworkEventHandler("agrp.mapLoaded", playerMapLoaded);
} }
// =========================================================================== // ===========================================================================
function updatePlayerNameTag(client) { function updatePlayerNameTag(client) {
//logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`); //logToConsole(LOG_DEBUG, `[AGRP.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
sendNetworkEventToPlayer("agrp.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client)); sendNetworkEventToPlayer("agrp.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client));
} }
// =========================================================================== // ===========================================================================
function updateAllPlayerNameTags() { function updateAllPlayerNameTags() {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated nametags to all players`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending updated nametags to all players`);
let clients = getClients(); let clients = getClients();
for (let i in clients) { for (let i in clients) {
updatePlayerNameTag(clients[i]); updatePlayerNameTag(clients[i]);
@@ -96,7 +97,7 @@ function updateAllPlayerNameTags() {
// =========================================================================== // ===========================================================================
function updatePlayerPing(client) { function updatePlayerPing(client) {
//logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`); //logToConsole(LOG_DEBUG, `[AGRP.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
sendNetworkEventToPlayer("agrp.ping", null, getPlayerName(client), getPlayerPing(client)); sendNetworkEventToPlayer("agrp.ping", null, getPlayerName(client), getPlayerPing(client));
} }
@@ -104,7 +105,7 @@ function updatePlayerPing(client) {
function playerClientReady(client) { function playerClientReady(client) {
playerResourceReady[client.index] = true; playerResourceReady[client.index] = true;
logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s client resources are downloaded and ready! Started: ${getYesNoFromBool(playerResourceStarted[client.index])}`); logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are downloaded and ready! Started: ${getYesNoFromBool(playerResourceStarted[client.index])}`);
if (playerResourceStarted[client.index] == true && playerInitialized[client.index] == false) { if (playerResourceStarted[client.index] == true && playerInitialized[client.index] == false) {
initClient(client); initClient(client);
} }
@@ -114,14 +115,14 @@ function playerClientReady(client) {
function playerGUIReady(client) { function playerGUIReady(client) {
playerGUI[client.index] = true; playerGUI[client.index] = true;
logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`); logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
} }
// =========================================================================== // ===========================================================================
function playerClientStarted(client) { function playerClientStarted(client) {
playerResourceStarted[client.index] = true; playerResourceStarted[client.index] = true;
logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s client resources are started and running! Ready: ${getYesNoFromBool(playerResourceReady[client.index])}`); logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are started and running! Ready: ${getYesNoFromBool(playerResourceReady[client.index])}`);
if (playerResourceReady[client.index] == true && playerInitialized[client.index] == false) { if (playerResourceReady[client.index] == true && playerInitialized[client.index] == false) {
initClient(client); initClient(client);
} }
@@ -130,7 +131,7 @@ function playerClientStarted(client) {
// =========================================================================== // ===========================================================================
function playerClientStopped(client) { function playerClientStopped(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?). Kicking them from the server ...`); logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?). Kicking them from the server ...`);
getPlayerData(client).customDisconnectReason = `Kicked - Client script verification failed.`; getPlayerData(client).customDisconnectReason = `Kicked - Client script verification failed.`;
disconnectPlayer(client); disconnectPlayer(client);
} }
@@ -138,7 +139,7 @@ function playerClientStopped(client) {
// =========================================================================== // ===========================================================================
function showSmallGameMessage(client, text, colour, duration, fontName = "Pricedown") { function showSmallGameMessage(client, text, colour, duration, fontName = "Pricedown") {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`); logToConsole(LOG_DEBUG, `[AGRP.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
sendNetworkEventToPlayer("agrp.smallGameMessage", client, text, colour, duration, fontName); sendNetworkEventToPlayer("agrp.smallGameMessage", client, text, colour, duration, fontName);
} }
@@ -149,7 +150,7 @@ function enableCityAmbienceForPlayer(client, clearElements = false) {
// return false; // return false;
//} //}
//logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`); //logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
//sendNetworkEventToPlayer("agrp.ambience", client, true); //sendNetworkEventToPlayer("agrp.ambience", client, true);
} }
@@ -160,21 +161,21 @@ function disableCityAmbienceForPlayer(client, clearElements = false) {
// return false; // return false;
//} //}
//logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`); //logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
//sendNetworkEventToPlayer("agrp.ambience", client, false, clearElements); //sendNetworkEventToPlayer("agrp.ambience", client, false, clearElements);
} }
// =========================================================================== // ===========================================================================
function clearPlayerOwnedPeds(client) { function clearPlayerOwnedPeds(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.clearPeds", client); sendNetworkEventToPlayer("agrp.clearPeds", client);
} }
// =========================================================================== // ===========================================================================
function updatePlayerSpawnedState(client, state) { function updatePlayerSpawnedState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`);
getPlayerData(client).spawned = true; getPlayerData(client).spawned = true;
sendNetworkEventToPlayer("agrp.spawned", client, state); sendNetworkEventToPlayer("agrp.spawned", client, state);
} }
@@ -182,21 +183,21 @@ function updatePlayerSpawnedState(client, state) {
// =========================================================================== // ===========================================================================
function setPlayerControlState(client, state) { function setPlayerControlState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`);
sendNetworkEventToPlayer("agrp.control", client, state, !state); sendNetworkEventToPlayer("agrp.control", client, state, !state);
} }
// =========================================================================== // ===========================================================================
function updatePlayerShowLogoState(client, state) { function updatePlayerShowLogoState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
sendNetworkEventToPlayer("agrp.logo", client, state); sendNetworkEventToPlayer("agrp.logo", client, state);
} }
// =========================================================================== // ===========================================================================
function restorePlayerCamera(client) { function restorePlayerCamera(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`); logToConsole(LOG_DEBUG, `[AGRP.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
sendNetworkEventToPlayer("agrp.restoreCamera", client); sendNetworkEventToPlayer("agrp.restoreCamera", client);
} }
@@ -209,7 +210,7 @@ function setPlayer2DRendering(client, hudState = false, labelState = false, smal
// =========================================================================== // ===========================================================================
function syncPlayerProperties(client) { function syncPlayerProperties(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
sendNetworkEventToPlayer("agrp.syncElement", null, getPlayerPed(client).id); sendNetworkEventToPlayer("agrp.syncElement", null, getPlayerPed(client).id);
} }
@@ -217,7 +218,7 @@ function syncPlayerProperties(client) {
function updatePlayerSnowState(client) { function updatePlayerSnowState(client) {
if (isSnowSupported(getGame())) { if (isSnowSupported(getGame())) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`); logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`);
sendNetworkEventToPlayer("agrp.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow); sendNetworkEventToPlayer("agrp.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow);
} }
} }
@@ -225,7 +226,7 @@ function updatePlayerSnowState(client) {
// =========================================================================== // ===========================================================================
function updatePlayerHotBar(client) { function updatePlayerHotBar(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
let tempHotBarItems = []; let tempHotBarItems = [];
for (let i in getPlayerData(client).hotBarItems) { for (let i in getPlayerData(client).hotBarItems) {
let itemImage = ""; let itemImage = "";
@@ -248,14 +249,14 @@ function updatePlayerHotBar(client) {
// =========================================================================== // ===========================================================================
function setPlayerWeaponDamageEnabled(client, state) { function setPlayerWeaponDamageEnabled(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`);
sendNetworkEventToPlayer("agrp.weaponDamageEnabled", null, getPlayerName(client), state); sendNetworkEventToPlayer("agrp.weaponDamageEnabled", null, getPlayerName(client), state);
} }
// =========================================================================== // ===========================================================================
function setPlayerWeaponDamageEvent(client, eventType) { function setPlayerWeaponDamageEvent(client, eventType) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`);
sendNetworkEventToPlayer("agrp.weaponDamageEvent", null, getPlayerName(client), eventType); sendNetworkEventToPlayer("agrp.weaponDamageEvent", null, getPlayerName(client), eventType);
getPlayerData(client).weaponDamageEvent = eventType; getPlayerData(client).weaponDamageEvent = eventType;
} }
@@ -263,259 +264,259 @@ function setPlayerWeaponDamageEvent(client, eventType) {
// =========================================================================== // ===========================================================================
function sendJobRouteLocationToPlayer(client, position, colour) { function sendJobRouteLocationToPlayer(client, position, colour) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending job route location data to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending job route location data to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showJobRouteLocation", client, position, colour); sendNetworkEventToPlayer("agrp.showJobRouteLocation", client, position, colour);
} }
// =========================================================================== // ===========================================================================
function showPlayerLoginSuccessGUI(client) { function showPlayerLoginSuccessGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.loginSuccess", client); sendNetworkEventToPlayer("agrp.loginSuccess", client);
} }
// =========================================================================== // ===========================================================================
function showPlayerLoginFailedGUI(client, errorMessage) { function showPlayerLoginFailedGUI(client, errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.loginFailed", client, errorMessage); sendNetworkEventToPlayer("agrp.loginFailed", client, errorMessage);
} }
// =========================================================================== // ===========================================================================
function showPlayerRegistrationSuccessGUI(client) { function showPlayerRegistrationSuccessGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.registrationSuccess", client); sendNetworkEventToPlayer("agrp.registrationSuccess", client);
} }
// =========================================================================== // ===========================================================================
function showPlayerRegistrationFailedGUI(client, errorMessage) { function showPlayerRegistrationFailedGUI(client, errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.registrationFailed", client, errorMessage); sendNetworkEventToPlayer("agrp.registrationFailed", client, errorMessage);
} }
// =========================================================================== // ===========================================================================
function sendPlayerGUIColours(client) { function sendPlayerGUIColours(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.guiColour", client, getServerConfig().guiColourPrimary[0], getServerConfig().guiColourPrimary[1], getServerConfig().guiColourPrimary[2], getServerConfig().guiColourSecondary[0], getServerConfig().guiColourSecondary[1], getServerConfig().guiColourSecondary[2], getServerConfig().guiTextColourPrimary[0], getServerConfig().guiTextColourPrimary[1], getServerConfig().guiTextColourPrimary[2]); sendNetworkEventToPlayer("agrp.guiColour", client, getServerConfig().guiColourPrimary[0], getServerConfig().guiColourPrimary[1], getServerConfig().guiColourPrimary[2], getServerConfig().guiColourSecondary[0], getServerConfig().guiColourSecondary[1], getServerConfig().guiColourSecondary[2], getServerConfig().guiTextColourPrimary[0], getServerConfig().guiTextColourPrimary[1], getServerConfig().guiTextColourPrimary[2]);
} }
// =========================================================================== // ===========================================================================
function sendPlayerGUIInit(client) { function sendPlayerGUIInit(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.guiInit", client); sendNetworkEventToPlayer("agrp.guiInit", client);
} }
// =========================================================================== // ===========================================================================
function showPlayerLoginGUI(client, errorMessage = "") { function showPlayerLoginGUI(client, errorMessage = "") {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showLogin", client); sendNetworkEventToPlayer("agrp.showLogin", client);
} }
// =========================================================================== // ===========================================================================
function showPlayerRegistrationGUI(client, errorMessage = "") { function showPlayerRegistrationGUI(client, errorMessage = "") {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showRegistration", client); sendNetworkEventToPlayer("agrp.showRegistration", client);
} }
// =========================================================================== // ===========================================================================
function showPlayerNewCharacterGUI(client) { function showPlayerNewCharacterGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showNewCharacter", client); sendNetworkEventToPlayer("agrp.showNewCharacter", client);
} }
// =========================================================================== // ===========================================================================
function showPlayerChangePasswordGUI(client, errorMessage = "") { function showPlayerChangePasswordGUI(client, errorMessage = "") {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showChangePassword", client, errorMessage); sendNetworkEventToPlayer("agrp.showChangePassword", client, errorMessage);
} }
// =========================================================================== // ===========================================================================
function showPlayerResetPasswordCodeInputGUI(client) { function showPlayerResetPasswordCodeInputGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show reset password code input GUI signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show reset password code input GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showResetPasswordCodeInput", client); sendNetworkEventToPlayer("agrp.showResetPasswordCodeInput", client);
} }
// =========================================================================== // ===========================================================================
function showPlayerResetPasswordEmailInputGUI(client) { function showPlayerResetPasswordEmailInputGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show reset password email input GUI signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show reset password email input GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showResetPasswordEmailInput", client); sendNetworkEventToPlayer("agrp.showResetPasswordEmailInput", client);
} }
// =========================================================================== // ===========================================================================
function showPlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) { function showPlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin); sendNetworkEventToPlayer("agrp.showCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
} }
// =========================================================================== // ===========================================================================
function updatePlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) { function updatePlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.switchCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin); sendNetworkEventToPlayer("agrp.switchCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
} }
// =========================================================================== // ===========================================================================
function showPlayerCharacterSelectSuccessGUI(client) { function showPlayerCharacterSelectSuccessGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.characterSelectSuccess", client); sendNetworkEventToPlayer("agrp.characterSelectSuccess", client);
} }
// =========================================================================== // ===========================================================================
function showPlayerCharacterSelectFailedGUI(client) { function showPlayerCharacterSelectFailedGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.characterSelectFailed", client); sendNetworkEventToPlayer("agrp.characterSelectFailed", client);
} }
// =========================================================================== // ===========================================================================
function showPlayerPromptGUI(client, promptMessage, promptTitle, yesButtonText = "Yes", noButtonText = "No") { function showPlayerPromptGUI(client, promptMessage, promptTitle, yesButtonText = "Yes", noButtonText = "No") {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage}, YesButton: ${yesButtonText}, NoButton: ${noButtonText})`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage}, YesButton: ${yesButtonText}, NoButton: ${noButtonText})`);
sendNetworkEventToPlayer("agrp.showPrompt", client, promptMessage, promptTitle, yesButtonText, noButtonText); sendNetworkEventToPlayer("agrp.showPrompt", client, promptMessage, promptTitle, yesButtonText, noButtonText);
} }
// =========================================================================== // ===========================================================================
function showPlayerInfoGUI(client, infoMessage, infoTitle, buttonText = "OK") { function showPlayerInfoGUI(client, infoMessage, infoTitle, buttonText = "OK") {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`);
sendNetworkEventToPlayer("agrp.showInfo", client, infoMessage, infoTitle, buttonText); sendNetworkEventToPlayer("agrp.showInfo", client, infoMessage, infoTitle, buttonText);
} }
// =========================================================================== // ===========================================================================
function showPlayerErrorGUI(client, errorMessage, errorTitle, buttonText = "OK") { function showPlayerErrorGUI(client, errorMessage, errorTitle, buttonText = "OK") {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`);
sendNetworkEventToPlayer("agrp.showError", client, errorMessage, errorTitle, buttonText); sendNetworkEventToPlayer("agrp.showError", client, errorMessage, errorTitle, buttonText);
} }
// =========================================================================== // ===========================================================================
function sendRunCodeToClient(client, code, returnTo) { function sendRunCodeToClient(client, code, returnTo) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`);
sendNetworkEventToPlayer("agrp.runCode", client, code, getPlayerId(returnTo)); sendNetworkEventToPlayer("agrp.runCode", client, code, getPlayerId(returnTo));
} }
// =========================================================================== // ===========================================================================
function sendPlayerWorkingState(client, state) { function sendPlayerWorkingState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.working", client, state); sendNetworkEventToPlayer("agrp.working", client, state);
} }
// =========================================================================== // ===========================================================================
function sendPlayerJobType(client, jobType) { function sendPlayerJobType(client, jobType) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.jobType", client, jobType); sendNetworkEventToPlayer("agrp.jobType", client, jobType);
} }
// =========================================================================== // ===========================================================================
function sendPlayerStopJobRoute(client) { function sendPlayerStopJobRoute(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.hideJobRouteLocation", client); sendNetworkEventToPlayer("agrp.hideJobRouteLocation", client);
} }
// =========================================================================== // ===========================================================================
function sendPlayerMouseCameraToggle(client) { function sendPlayerMouseCameraToggle(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.mouseCamera", client); sendNetworkEventToPlayer("agrp.mouseCamera", client);
} }
// =========================================================================== // ===========================================================================
function setPlayerMouseCameraState(client, state) { function setPlayerMouseCameraState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.mouseCameraForce", client, state); sendNetworkEventToPlayer("agrp.mouseCameraForce", client, state);
} }
// =========================================================================== // ===========================================================================
function sendPlayerMouseCursorToggle(client) { function sendPlayerMouseCursorToggle(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.mouseCursor", client); sendNetworkEventToPlayer("agrp.mouseCursor", client);
} }
// =========================================================================== // ===========================================================================
function sendAddAccountKeyBindToClient(client, key, keyState) { function sendAddAccountKeyBindToClient(client, key, keyState) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
sendNetworkEventToPlayer("agrp.addKeyBind", client, toInteger(key), (keyState) ? KEYSTATE_DOWN : KEYSTATE_UP); sendNetworkEventToPlayer("agrp.addKeyBind", client, toInteger(key), (keyState) ? KEYSTATE_DOWN : KEYSTATE_UP);
} }
// =========================================================================== // ===========================================================================
function sendClearKeyBindsToClient(client, key, keyState) { function sendClearKeyBindsToClient(client, key, keyState) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
sendNetworkEventToPlayer("agrp.clearKeyBinds", client); sendNetworkEventToPlayer("agrp.clearKeyBinds", client);
} }
// =========================================================================== // ===========================================================================
function sendRemoveAccountKeyBindToClient(client, key) { function sendRemoveAccountKeyBindToClient(client, key) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`);
sendNetworkEventToPlayer("agrp.delKeyBind", client, toInteger(key)); sendNetworkEventToPlayer("agrp.delKeyBind", client, toInteger(key));
} }
// =========================================================================== // ===========================================================================
function sendPlayerSetPosition(client, position) { function sendPlayerSetPosition(client, position) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`);
sendNetworkEventToPlayer("agrp.position", client, position); sendNetworkEventToPlayer("agrp.position", client, position);
} }
// =========================================================================== // ===========================================================================
function sendPlayerSetHeading(client, heading) { function sendPlayerSetHeading(client, heading) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`);
sendNetworkEventToPlayer("agrp.heading", client, heading); sendNetworkEventToPlayer("agrp.heading", client, heading);
} }
// =========================================================================== // ===========================================================================
function sendPlayerSetInterior(client, interior) { function sendPlayerSetInterior(client, interior) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
sendNetworkEventToPlayer("agrp.interior", client, interior); sendNetworkEventToPlayer("agrp.interior", client, interior);
} }
// =========================================================================== // ===========================================================================
function sendPlayerFrozenState(client, state) { function sendPlayerFrozenState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
sendNetworkEventToPlayer("agrp.frozen", client, state); sendNetworkEventToPlayer("agrp.frozen", client, state);
} }
// =========================================================================== // ===========================================================================
function clearPlayerWeapons(client, clearData = true) { function clearPlayerWeapons(client, clearData = true) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
sendNetworkEventToPlayer("agrp.clearWeapons", client, clearData); sendNetworkEventToPlayer("agrp.clearWeapons", client, clearData);
} }
// =========================================================================== // ===========================================================================
function showPlayerNewCharacterFailedGUI(client, errorMessage) { function showPlayerNewCharacterFailedGUI(client, errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.newCharacterFailed", client, errorMessage); sendNetworkEventToPlayer("agrp.newCharacterFailed", client, errorMessage);
} }
// =========================================================================== // ===========================================================================
function sendPlayerRemoveFromVehicle(client) { function sendPlayerRemoveFromVehicle(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.removeFromVehicle", client); sendNetworkEventToPlayer("agrp.removeFromVehicle", client);
} }
@@ -533,10 +534,10 @@ function showPlayerItemTakeDelay(client, itemId) {
if (getItemData(itemId)) { if (getItemData(itemId)) {
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay; let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
if (delay > 0) { if (delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay); sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else { } else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`); logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client); playerItemActionDelayComplete(client);
} }
} }
@@ -548,10 +549,10 @@ function showPlayerItemUseDelay(client, itemSlot) {
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) { if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).useDelay; let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).useDelay;
if (delay > 0) { if (delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay); sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else { } else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`); logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client); playerItemActionDelayComplete(client);
} }
} }
@@ -563,10 +564,10 @@ function showPlayerItemDropDelay(client, itemSlot) {
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) { if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).dropDelay; let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).dropDelay;
if (delay > 0) { if (delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay); sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else { } else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`); logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client); playerItemActionDelayComplete(client);
} }
} }
@@ -578,10 +579,10 @@ function showPlayerItemPickupDelay(client, itemId) {
if (getItemData(itemId)) { if (getItemData(itemId)) {
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay; let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
if (delay > 0) { if (delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay); sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else { } else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`); logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client); playerItemActionDelayComplete(client);
} }
} }
@@ -593,10 +594,10 @@ function showPlayerItemPutDelay(client, itemSlot) {
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) { if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).putDelay; let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).putDelay;
if (delay > 0) { if (delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay); sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else { } else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`); logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client); playerItemActionDelayComplete(client);
} }
} }
@@ -609,18 +610,18 @@ function showPlayerItemSwitchDelay(client, itemSlot) {
if (getPlayerData(client).hotBarItems[itemSlot] != -1) { if (getPlayerData(client).hotBarItems[itemSlot] != -1) {
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay; let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay;
if (delay > 0) { if (delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`); logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay); sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else { } else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`); logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client); playerItemActionDelayComplete(client);
} }
} else { } else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`); logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client); playerItemActionDelayComplete(client);
} }
} else { } else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`); logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerSwitchItem(client, itemSlot); playerSwitchItem(client, itemSlot);
} }
} }
@@ -628,14 +629,14 @@ function showPlayerItemSwitchDelay(client, itemSlot) {
// =========================================================================== // ===========================================================================
function sendPlayerDrunkEffect(client, amount, duration) { function sendPlayerDrunkEffect(client, amount, duration) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`); logToConsole(LOG_DEBUG, `[AGRP.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`);
sendNetworkEventToPlayer("agrp.drunkEffect", client, amount, duration); sendNetworkEventToPlayer("agrp.drunkEffect", client, amount, duration);
} }
// =========================================================================== // ===========================================================================
function sendPlayerClearPedState(client) { function sendPlayerClearPedState(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.clearPedState", client); sendNetworkEventToPlayer("agrp.clearPedState", client);
} }
@@ -645,29 +646,29 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
let damagerEntity = getPlayerFromParams(damagerEntityName); let damagerEntity = getPlayerFromParams(damagerEntityName);
if (isNull(damagerEntity)) { if (isNull(damagerEntity)) {
logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`); logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`);
return false; return false;
} }
logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)} was damaged by ${damagerEntity}`); logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)} was damaged by ${damagerEntity}`);
if (isNull(damagerEntity)) { if (isNull(damagerEntity)) {
logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager client is INVALID`); logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager client is INVALID`);
return false; return false;
} }
if (!getPlayerData(damagerEntity) || !getPlayerData(client)) { if (!getPlayerData(damagerEntity) || !getPlayerData(client)) {
logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager's client data is INVALID`); logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager's client data is INVALID`);
return false; return false;
} }
logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager is ${getPlayerDisplayForConsole(damagerEntity)}`); logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager is ${getPlayerDisplayForConsole(damagerEntity)}`);
switch (getPlayerData(damagerEntity).weaponDamageEvent) { switch (getPlayerData(damagerEntity).weaponDamageEvent) {
case AGRP_WEAPON_DAMAGE_EVENT_TAZER: case AGRP_WEAPON_DAMAGE_EVENT_TAZER:
logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} is using a tazer`); logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} is using a tazer`);
if (!isPlayerTazed(client) && !isPlayerHandCuffed(client) && !isPlayerInAnyVehicle(client)) { if (!isPlayerTazed(client) && !isPlayerHandCuffed(client) && !isPlayerInAnyVehicle(client)) {
logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)} was not previously tazed, binded, or in a vehicle. Taze successful`); logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)} was not previously tazed, binded, or in a vehicle. Taze successful`);
meActionToNearbyPlayers(damagerEntity, `electrifies ${getCharacterFullName(client)} with their tazer`); meActionToNearbyPlayers(damagerEntity, `electrifies ${getCharacterFullName(client)} with their tazer`);
tazePlayer(client); tazePlayer(client);
} }
@@ -680,10 +681,10 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
break; break;
case AGRP_WEAPON_DAMAGE_EVENT_NORMAL: case AGRP_WEAPON_DAMAGE_EVENT_NORMAL:
logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`); logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
let remainingDamage = healthLoss * getPlayerData(client).incomingDamageMultiplier; let remainingDamage = healthLoss * getPlayerData(client).incomingDamageMultiplier;
if (getPlayerArmour(client) > 0) { if (getPlayerArmour(client) > 0) {
//logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s armour was ${getPlayerArmour(client)}, so it was reduced by ${healthLoss}`); //logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s armour was ${getPlayerArmour(client)}, so it was reduced by ${healthLoss}`);
if (getPlayerArmour(client) - remainingDamage < 0) { if (getPlayerArmour(client) - remainingDamage < 0) {
setPlayerArmour(client, 0); setPlayerArmour(client, 0);
remainingDamage = remainingDamage - getPlayerArmour(client); remainingDamage = remainingDamage - getPlayerArmour(client);
@@ -695,7 +696,7 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
break; break;
default: default:
logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`); logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
setPlayerHealth(client, getPlayerHealth(client) - (healthLoss * getPlayerData(client).incomingDamageMultiplier)); setPlayerHealth(client, getPlayerHealth(client) - (healthLoss * getPlayerData(client).incomingDamageMultiplier));
break; break;
} }
@@ -955,21 +956,21 @@ function sendPlayerChatAutoHideDelay(client, delay) {
// =========================================================================== // ===========================================================================
function playRadioStreamForPlayer(client, streamURL, loop = true, volume = 0, element = false) { function playRadioStreamForPlayer(client, streamURL, loop = true, volume = 0, element = false) {
logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`);
sendNetworkEventToPlayer("agrp.radioStream", client, streamURL, loop, volume, element); sendNetworkEventToPlayer("agrp.radioStream", client, streamURL, loop, volume, element);
} }
// =========================================================================== // ===========================================================================
function playAudioFileForPlayer(client, audioName, loop = true, volume = 0, element = false) { function playAudioFileForPlayer(client, audioName, loop = true, volume = 0, element = false) {
logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to play audio ${audioName}`); logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to play audio ${audioName}`);
sendNetworkEventToPlayer("agrp.audioFileStream", client, audioName, loop, volume); sendNetworkEventToPlayer("agrp.audioFileStream", client, audioName, loop, volume);
} }
// =========================================================================== // ===========================================================================
function stopRadioStreamForPlayer(client) { function stopRadioStreamForPlayer(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`); logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`);
sendNetworkEventToPlayer("agrp.stopRadioStream", client); sendNetworkEventToPlayer("agrp.stopRadioStream", client);
} }
@@ -1096,14 +1097,14 @@ function setPlayerInfiniteRun(client, state) {
// ========================================================================== // ==========================================================================
function sendBusinessToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) { function sendBusinessToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, hasItems) {
sendNetworkEventToPlayer("agrp.business", client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems); sendNetworkEventToPlayer("agrp.business", client, businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, hasItems);
} }
// ========================================================================== // ==========================================================================
function sendHouseToPlayer(client, houseId, description, entrancePosition, blipModel, pickupModel, hasInterior) { function sendHouseToPlayer(client, houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior) {
sendNetworkEventToPlayer("agrp.house", client, houseId, description, entrancePosition, blipModel, pickupModel, hasInterior); sendNetworkEventToPlayer("agrp.house", client, houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior);
} }
// ========================================================================== // ==========================================================================
@@ -1123,7 +1124,7 @@ function sendVehicleToPlayer(client, vehicleId, model, position, heading, colour
function sendAllBusinessesToPlayer(client) { function sendAllBusinessesToPlayer(client) {
let businesses = getServerData().businesses; let businesses = getServerData().businesses;
for (let i in businesses) { for (let i in businesses) {
sendBusinessToPlayer(client, businesses[i].index, businesses[i].name, businesses[i].entrancePosition, businesses[i].entranceBlipModel, businesses[i].entrancePickupModel, businesses[i].hasInterior, false); sendBusinessToPlayer(client, businesses[i].index, businesses[i].name, businesses[i].entrancePosition, businesses[i].entranceBlipModel, businesses[i].entrancePickupModel, businesses[i].buyPrice, businesses[i].rentPrice, businesses[i].hasInterior, doesBusinessHaveAnyItemsToBuy(i));
} }
} }
@@ -1132,7 +1133,7 @@ function sendAllBusinessesToPlayer(client) {
function sendAllHousesToPlayer(client) { function sendAllHousesToPlayer(client) {
let houses = getServerData().houses; let houses = getServerData().houses;
for (let i in houses) { for (let i in houses) {
sendHouseToPlayer(client, houses[i].index, houses[i].entrancePosition, houses[i].entranceBlipModel, houses[i].entrancePickupModel, houses[i].hasInterior); sendHouseToPlayer(client, houses[i].index, houses[i].entrancePosition, houses[i].entranceBlipModel, houses[i].entrancePickupModel, houses[i].buyPrice, houses[i].rentPrice, houses[i].hasInterior);
} }
} }
@@ -1288,3 +1289,10 @@ function sendMapChangeWarningToPlayer(client, changingToNight) {
} }
// ========================================================================== // ==========================================================================
function playerMapLoaded(client, mapName) {
//updateAllInteriorVehiclesForPlayer(client, propertyData.exitInterior, propertyData.exitDimension);
}
// ==========================================================================