Escape Wanteds done Client Side.
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
export default function playerBlips() {
|
||||
import { afkStatus } from '../Player/antiafk';
|
||||
import { getWantedCount } from './wanteds';
|
||||
|
||||
export default function playerBlips() {
|
||||
var playerBlipMap: Map<PlayerMp, BlipMp>;
|
||||
var ready = false;
|
||||
var escapeTimer = null;
|
||||
|
||||
const PD_BLIP = 38;
|
||||
const FIB_BLIP = 63;
|
||||
|
||||
setInterval(() => {
|
||||
if (!ready) return;
|
||||
@@ -9,7 +16,7 @@
|
||||
mp.players.forEachInStreamRange(
|
||||
(player) => {
|
||||
if (mp.players.local == player)
|
||||
return;
|
||||
return;
|
||||
|
||||
if (!playerBlipMap.has(player)) {
|
||||
let pBlip = mp.blips.new(1, player.position, {
|
||||
@@ -43,8 +50,29 @@
|
||||
|
||||
pBlip.setColour(isNaN(color) ? 0 : color);
|
||||
pBlip.setPosition(player.position.x, player.position.y, player.position.z);
|
||||
|
||||
if ((color == PD_BLIP || color == FIB_BLIP || afkStatus)) {
|
||||
if (escapeTimer) {
|
||||
mp.events.call("SERVER:SetWantedFlash", false);
|
||||
clearInterval(escapeTimer);
|
||||
escapeTimer = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!escapeTimer && !afkStatus && getWantedCount() > 0) {
|
||||
mp.events.call("SERVER:SetWantedFlash", true);
|
||||
escapeTimer = setInterval(() => {
|
||||
if (getWantedCount() == 0) {
|
||||
clearInterval(escapeTimer);
|
||||
escapeTimer = null;
|
||||
return;
|
||||
}
|
||||
|
||||
mp.events.callRemote("CLIENT:EscapeWanted");
|
||||
}, 300000); //120000 -> 2 min , 300000 -> 5min
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}, 50);
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
export default function antiAfk(globalData: IGlobalData) {
|
||||
export let afkStatus: boolean = false;
|
||||
|
||||
export default function antiAfk(globalData: IGlobalData) {
|
||||
let lastPosition: Vector3Mp = mp.players.local.position;
|
||||
let afkCounter: number = 0;
|
||||
|
||||
let afkStatus: boolean = false;
|
||||
|
||||
setInterval(checkAfkPosition, 1000 * 10);
|
||||
|
||||
function checkAfkPosition() {
|
||||
|
||||
if (!globalData.LoggedIn) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user