Move AFK events to event script

This commit is contained in:
Vortrex
2021-03-30 21:45:00 -05:00
parent bf63bcba2a
commit ed73c260b2

View File

@@ -8,21 +8,26 @@
// TYPE: Client (JavaScript)
// ===========================================================================
// -------------------------------------------------------------------------
function initAFKScript() {
logToConsole(LOG_DEBUG, "[Asshat.AFK]: Initializing AFK script ...");
logToConsole(LOG_DEBUG, "[Asshat.AFK]: AFK script initialized!");
}
addEventHandler("OnLostFocus", function(event) {
triggerNetworkEvent("ag.afk", true);
// ===========================================================================
function processLostFocusAFK(event) {
sendServerNewAFKStatus(true);
if(localPlayer != null) {
localPlayer.collisionsEnabled = false;
gta.setCiviliansEnabled(false);
gta.setTrafficEnabled(false);
}
});
}
// -------------------------------------------------------------------------
// ===========================================================================
addEventHandler("OnFocus", function(event) {
triggerNetworkEvent("ag.afk", false);
function processFocusAFK(event) {
sendServerNewAFKStatus(false);
if(localPlayer != null) {
localPlayer.collisionsEnabled = true;
if(gta.game != GAME_GTA_SA) {
@@ -30,6 +35,6 @@ addEventHandler("OnFocus", function(event) {
}
gta.setTrafficEnabled(true);
}
});
}
// -------------------------------------------------------------------------
// ===========================================================================