mirror of
https://github.com/sergeyyarkov/altv-copchase-mod.git
synced 2026-10-11 10:19:42 +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'
|
import './ui.mjs'
|
||||||
|
|
||||||
|
const blips = {}
|
||||||
|
|
||||||
alt.setMsPerGameMinute(30000)
|
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', () => {
|
alt.onServer('player:death', () => {
|
||||||
native.animpostfxPlay('DeathFailNeutralIn', 5000, false)
|
native.animpostfxPlay('DeathFailNeutralIn', 5000, false)
|
||||||
NativeUI.BigMessage.ShowWastedMessage('Мертв', 'Вы умерли', NativeUI.HudColor.HUD_COLOUR_RED, 5000)
|
NativeUI.BigMessage.ShowWastedMessage('Мертв', 'Вы умерли', NativeUI.HudColor.HUD_COLOUR_RED, 5000)
|
||||||
|
|||||||
@ -59,7 +59,6 @@ class Copchase {
|
|||||||
this.players = []
|
this.players = []
|
||||||
this.waitingPlayers = []
|
this.waitingPlayers = []
|
||||||
this.cars = []
|
this.cars = []
|
||||||
this.blips = {}
|
|
||||||
this.suspect = null
|
this.suspect = null
|
||||||
this.positions = {
|
this.positions = {
|
||||||
suspect: [
|
suspect: [
|
||||||
@ -80,7 +79,6 @@ class Copchase {
|
|||||||
this.isStarted = false
|
this.isStarted = false
|
||||||
this.suspect = null
|
this.suspect = null
|
||||||
this.players = []
|
this.players = []
|
||||||
this.blips = {}
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.cars.forEach(car => car.destroy())
|
this.cars.forEach(car => car.destroy())
|
||||||
@ -151,28 +149,19 @@ class Copchase {
|
|||||||
_player.model = skins[Math.floor(Math.random() * (430 - 1 - 422) + 422)]
|
_player.model = skins[Math.floor(Math.random() * (430 - 1 - 422) + 422)]
|
||||||
alt.emitClient(_player, 'player:delInvincible')
|
alt.emitClient(_player, 'player:delInvincible')
|
||||||
alt.emitClient(_player, 'player:showMidsizedMessage', '~r~Вы саспект!', 'Уйдите от полицейских.', 5000)
|
alt.emitClient(_player, 'player:showMidsizedMessage', '~r~Вы саспект!', 'Уйдите от полицейских.', 5000)
|
||||||
|
alt.emitClient(_player, 'player:createBlip', _player)
|
||||||
// this.blips[_player.id] = new alt.PointBlip(1, suspectPosition.x, suspectPosition.y, suspectPosition.z)
|
alt.Player.all.forEach(_player => alt.emitClient(_player, 'player:createBlipPlayers', this.suspect))
|
||||||
// this.blips[_player.id].name = this.suspect.name
|
|
||||||
// this.blips[_player.id].dimension = this.dimension
|
|
||||||
// this.blips[_player.id].color = 1
|
|
||||||
} else {
|
} else {
|
||||||
_player.pos = {
|
_player.pos = {
|
||||||
x: this.positions.police[suspectRandomNumber].x + 2,
|
x: this.positions.police[suspectRandomNumber].x + 2,
|
||||||
y: this.positions.police[suspectRandomNumber].y,
|
y: this.positions.police[suspectRandomNumber].y,
|
||||||
z: this.positions.police[suspectRandomNumber].z
|
z: this.positions.police[suspectRandomNumber].z
|
||||||
}
|
}
|
||||||
// _player.heading = 260
|
|
||||||
_player.dimension = this.dimension
|
_player.dimension = this.dimension
|
||||||
_player.model = 's_m_y_cop_01'
|
_player.model = 's_m_y_cop_01'
|
||||||
_player.giveWeapon('0x3656C8C1', 100, true)
|
_player.giveWeapon('0x3656C8C1', 100, true)
|
||||||
alt.emitClient(_player, 'player:delInvincible')
|
alt.emitClient(_player, 'player:delInvincible')
|
||||||
alt.emitClient(_player, 'player:showMidsizedMessage', `~w~Саспект: ~r~${this.suspect.name}`, 'Нейтрализуйте саспекта.', 5000)
|
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.spawnPlayers()
|
||||||
this.spawnCars()
|
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
|
let timeRemaining = this.timeRemaining
|
||||||
this.timeRemainingInterval = setInterval(() => {
|
this.timeRemainingInterval = setInterval(() => {
|
||||||
timeRemaining = timeRemaining - 1
|
timeRemaining = timeRemaining - 1
|
||||||
@ -264,20 +244,15 @@ class Copchase {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
this.midsizedMessageToWaitingPlayers(timeToStart, '', 1000)
|
this.midsizedMessageToWaitingPlayers(timeToStart, '', 1000)
|
||||||
// this.messageToWaitingPlayers(`[COPCHASE]: Игра начнется через: ${timeToStart}`)
|
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
stopGame({ winner }) {
|
stopGame({ winner }) {
|
||||||
|
|
||||||
clearInterval(this.timeRemainingInterval)
|
clearInterval(this.timeRemainingInterval)
|
||||||
|
|
||||||
this.players.forEach(_player => {
|
alt.Player.all.forEach(_player => alt.emitClient(_player, 'player:deleteBlipPlayers'))
|
||||||
// if (this.blips[_player.id]) {
|
|
||||||
// this.blips[_player.id].destroy();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
this.players.forEach(_player => {
|
||||||
_player.removeAllWeapons()
|
_player.removeAllWeapons()
|
||||||
|
|
||||||
alt.setTimeout(() => {
|
alt.setTimeout(() => {
|
||||||
@ -318,7 +293,7 @@ const copchase = new Copchase({
|
|||||||
waitingRoomDimension: 5,
|
waitingRoomDimension: 5,
|
||||||
maxPlayers: 11,
|
maxPlayers: 11,
|
||||||
minPlayers: 2,
|
minPlayers: 2,
|
||||||
timeRemaining: 2,
|
timeRemaining: 10,
|
||||||
timeToStart: 5
|
timeToStart: 5
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -4,16 +4,26 @@ import { broadcast } from 'chat'
|
|||||||
import config from '../../config.mjs'
|
import config from '../../config.mjs'
|
||||||
import skins from '../../skins.json'
|
import skins from '../../skins.json'
|
||||||
|
|
||||||
|
|
||||||
alt.on('playerConnect', (player) => {
|
alt.on('playerConnect', (player) => {
|
||||||
broadcast(`{EE9A00}[SERVER]: {1CD8FD}👋 ${player.name} {FFF}присоеденился к серверу`)
|
broadcast(`{EE9A00}[SERVER]: {1CD8FD}👋 ${player.name} {FFF}присоеденился к серверу`)
|
||||||
const date = new Date()
|
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.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.model = skins[Math.floor(Math.random() * (skins.length - 1 - 0) + 0)]
|
||||||
player.spawn(config.spawn.x, config.spawn.y,config.spawn.z)
|
player.spawn(config.spawn.x, config.spawn.y,config.spawn.z)
|
||||||
player.dimension = 0
|
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:setInvincible')
|
||||||
alt.emitClient(player, 'player:notify', '~g~Добро пожаловать на сервер!')
|
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