mirror of
https://github.com/sergeyyarkov/altv-copchase-mod.git
synced 2026-10-11 18:29:35 +03:00
added blips
This commit is contained in:
parent
d706cad988
commit
31c66cbc2b
@ -4,9 +4,49 @@ import * as NativeUI from './includes/nativeui/nativeui.min.js'
|
||||
|
||||
import './ui.mjs'
|
||||
|
||||
const blips = {}
|
||||
|
||||
alt.setMsPerGameMinute(30000)
|
||||
|
||||
alt.everyTick(() => {
|
||||
alt.Player.all.forEach(_player => {
|
||||
if (blips[_player.id]) {
|
||||
blips[_player.id].pos = _player.pos
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
alt.onServer('player:createBlip', player => {
|
||||
// blips[player.id] = new alt.PointBlip(player.pos.x, player.pos.y, player.pos.z)
|
||||
// blips[player.id].name = player.name
|
||||
// blips[player.id].color = 0
|
||||
|
||||
alt.emitServer('player:createBlipPlayers', blips)
|
||||
})
|
||||
|
||||
alt.onServer('player:createBlipPlayers', (suspectPlayer) => {
|
||||
alt.Player.all.forEach(_player => {
|
||||
if (suspectPlayer.name === _player.name) {
|
||||
blips[_player.id] = new alt.PointBlip(_player.pos.x, _player.pos.y, _player.pos.z)
|
||||
blips[_player.id].name = _player.name
|
||||
blips[_player.id].color = 1
|
||||
} else {
|
||||
blips[_player.id] = new alt.PointBlip(_player.pos.x, _player.pos.y, _player.pos.z)
|
||||
blips[_player.id].name = _player.name
|
||||
blips[_player.id].color = 38
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
alt.onServer('player:deleteBlipPlayers', () => {
|
||||
alt.Player.all.forEach(_player => {
|
||||
if (blips[_player.id]) {
|
||||
blips[_player.id].destroy()
|
||||
blips[_player.id] = null
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
alt.onServer('player:death', () => {
|
||||
native.animpostfxPlay('DeathFailNeutralIn', 5000, false)
|
||||
NativeUI.BigMessage.ShowWastedMessage('Мертв', 'Вы умерли', NativeUI.HudColor.HUD_COLOUR_RED, 5000)
|
||||
|
||||
@ -59,7 +59,6 @@ class Copchase {
|
||||
this.players = []
|
||||
this.waitingPlayers = []
|
||||
this.cars = []
|
||||
this.blips = {}
|
||||
this.suspect = null
|
||||
this.positions = {
|
||||
suspect: [
|
||||
@ -80,7 +79,6 @@ class Copchase {
|
||||
this.isStarted = false
|
||||
this.suspect = null
|
||||
this.players = []
|
||||
this.blips = {}
|
||||
|
||||
setTimeout(() => {
|
||||
this.cars.forEach(car => car.destroy())
|
||||
@ -151,28 +149,19 @@ class Copchase {
|
||||
_player.model = skins[Math.floor(Math.random() * (430 - 1 - 422) + 422)]
|
||||
alt.emitClient(_player, 'player:delInvincible')
|
||||
alt.emitClient(_player, 'player:showMidsizedMessage', '~r~Вы саспект!', 'Уйдите от полицейских.', 5000)
|
||||
|
||||
// this.blips[_player.id] = new alt.PointBlip(1, suspectPosition.x, suspectPosition.y, suspectPosition.z)
|
||||
// this.blips[_player.id].name = this.suspect.name
|
||||
// this.blips[_player.id].dimension = this.dimension
|
||||
// this.blips[_player.id].color = 1
|
||||
alt.emitClient(_player, 'player:createBlip', _player)
|
||||
alt.Player.all.forEach(_player => alt.emitClient(_player, 'player:createBlipPlayers', this.suspect))
|
||||
} else {
|
||||
_player.pos = {
|
||||
x: this.positions.police[suspectRandomNumber].x + 2,
|
||||
y: this.positions.police[suspectRandomNumber].y,
|
||||
z: this.positions.police[suspectRandomNumber].z
|
||||
}
|
||||
// _player.heading = 260
|
||||
_player.dimension = this.dimension
|
||||
_player.model = 's_m_y_cop_01'
|
||||
_player.giveWeapon('0x3656C8C1', 100, true)
|
||||
alt.emitClient(_player, 'player:delInvincible')
|
||||
alt.emitClient(_player, 'player:showMidsizedMessage', `~w~Саспект: ~r~${this.suspect.name}`, 'Нейтрализуйте саспекта.', 5000)
|
||||
|
||||
// this.blips[_player.id] = new alt.PointBlip(1, this.positions.police[suspectRandomNumber].x + 2, this.positions.police[suspectRandomNumber].y, this.positions.police[suspectRandomNumber].z)
|
||||
// this.blips[_player.id].name = _player.name
|
||||
// this.blips[_player.id].dimension = this.dimension
|
||||
// this.blips[_player.id].color = 38
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -236,15 +225,6 @@ class Copchase {
|
||||
this.spawnPlayers()
|
||||
this.spawnCars()
|
||||
|
||||
alt.setInterval(() => {
|
||||
this.players.forEach((player, id) => {
|
||||
if (this.blips[player.id]) {
|
||||
console.log(this.blips[player.id].pos)
|
||||
this.blips[player.id].pos = new alt.Vector3(player.pos.x, player.pos.y, player.pos.z);
|
||||
}
|
||||
})
|
||||
}, 1000)
|
||||
|
||||
let timeRemaining = this.timeRemaining
|
||||
this.timeRemainingInterval = setInterval(() => {
|
||||
timeRemaining = timeRemaining - 1
|
||||
@ -264,20 +244,15 @@ class Copchase {
|
||||
return true
|
||||
}
|
||||
this.midsizedMessageToWaitingPlayers(timeToStart, '', 1000)
|
||||
// this.messageToWaitingPlayers(`[COPCHASE]: Игра начнется через: ${timeToStart}`)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
stopGame({ winner }) {
|
||||
|
||||
clearInterval(this.timeRemainingInterval)
|
||||
|
||||
alt.Player.all.forEach(_player => alt.emitClient(_player, 'player:deleteBlipPlayers'))
|
||||
|
||||
this.players.forEach(_player => {
|
||||
// if (this.blips[_player.id]) {
|
||||
// this.blips[_player.id].destroy();
|
||||
// }
|
||||
|
||||
|
||||
_player.removeAllWeapons()
|
||||
|
||||
alt.setTimeout(() => {
|
||||
@ -318,7 +293,7 @@ const copchase = new Copchase({
|
||||
waitingRoomDimension: 5,
|
||||
maxPlayers: 11,
|
||||
minPlayers: 2,
|
||||
timeRemaining: 2,
|
||||
timeRemaining: 10,
|
||||
timeToStart: 5
|
||||
})
|
||||
|
||||
|
||||
@ -4,16 +4,26 @@ import { broadcast } from 'chat'
|
||||
import config from '../../config.mjs'
|
||||
import skins from '../../skins.json'
|
||||
|
||||
|
||||
alt.on('playerConnect', (player) => {
|
||||
broadcast(`{EE9A00}[SERVER]: {1CD8FD}👋 ${player.name} {FFF}присоеденился к серверу`)
|
||||
const date = new Date()
|
||||
// new alt.PointBlip(1, config.spawn.x, config.spawn.y,config.spawn.z)
|
||||
player.setSyncedMeta('NAME', `[${player.id}]: ${player.name}`);
|
||||
|
||||
player.setDateTime(date.getDay(), date.getMonth(), date.getFullYear(), date.getHours(), date.getMinutes(), date.getSeconds())
|
||||
player.model = skins[Math.floor(Math.random() * (skins.length - 1 - 0) + 0)]
|
||||
player.spawn(config.spawn.x, config.spawn.y,config.spawn.z)
|
||||
player.dimension = 0
|
||||
|
||||
//alt.emitClient(player, 'player:createBlip', player)
|
||||
//alt.Player.all.forEach(_player => alt.emitClient(_player, 'player:createBlipPlayers'))
|
||||
alt.emitClient(player, 'player:setInvincible')
|
||||
alt.emitClient(player, 'player:notify', '~g~Добро пожаловать на сервер!')
|
||||
})
|
||||
|
||||
// setInterval(() => {
|
||||
// alt.Player.all.forEach(_player => {
|
||||
// if (blips[_player.id]) {
|
||||
// blips[_player.id].pos = _player.pos
|
||||
// }
|
||||
// })
|
||||
// }, 1000)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user