diff --git a/client/index.mjs b/client/index.mjs index 3b36e8b..2b462c5 100644 --- a/client/index.mjs +++ b/client/index.mjs @@ -4,6 +4,7 @@ import * as NativeUI from './includes/nativeui/nativeui.min.js' import './ui.mjs' + alt.setMsPerGameMinute(30000) alt.onServer('player:death', () => { diff --git a/server/modules/commands/player/copchase.mjs b/server/modules/commands/player/copchase.mjs index 3dc073d..973467f 100644 --- a/server/modules/commands/player/copchase.mjs +++ b/server/modules/commands/player/copchase.mjs @@ -26,5 +26,7 @@ registerCmd('copchase', player => { return alt.emitClient(player, 'player:showMidsizedMessage', '~b~Ожидание игроков...', '') } + if (copchase.isTimeToStartStarted) return + copchase.startGame() }) \ No newline at end of file diff --git a/server/modules/commands/player/spawn.mjs b/server/modules/commands/player/spawn.mjs index 63a7a20..ce38434 100644 --- a/server/modules/commands/player/spawn.mjs +++ b/server/modules/commands/player/spawn.mjs @@ -1,10 +1,14 @@ -import { registerCmd } from 'chat' +import { registerCmd, send } from 'chat' import { copchase } from '../../copchase.mjs' import config from '../../../config.mjs' registerCmd('spawn', player => { - if (copchase.isPlayerInWaitingRoom(player)) return false + if (copchase.isPlayerInWaitingRoom(player)) { + send(player, '{EE9A00}[COPCHASE]: {FF0000}Вы в комнате ожидания!') + send(player, '{EE9A00}[COPCHASE]: {FF0000}/exit чтобы выйти') + return false + } if (copchase.isPlayerInGame(player)) return false player.pos = config.spawn diff --git a/server/modules/copchase.mjs b/server/modules/copchase.mjs index ba89d10..8c1827a 100644 --- a/server/modules/copchase.mjs +++ b/server/modules/copchase.mjs @@ -14,6 +14,7 @@ class Copchase { this.timeRemainingInterval = null this.timeToStart = timeToStart this.isStarted = false + this.isTimeToStartStarted = false this.suspectCars = [ 'asea', 'bison', @@ -151,8 +152,8 @@ class Copchase { alt.emitClient(_player, 'player:delInvincible') alt.emitClient(_player, 'player:showMidsizedMessage', '~r~Вы саспект!', 'Уйдите от полицейских.', 5000) - // this.blips[_player.id] = mp.blips.new(1, suspectPosition) - // this.blips[_player.id].name = _player.name + // 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 } else { @@ -168,7 +169,7 @@ class Copchase { alt.emitClient(_player, 'player:delInvincible') alt.emitClient(_player, 'player:showMidsizedMessage', `~w~Саспект: ~r~${this.suspect.name}`, 'Нейтрализуйте саспекта.', 5000) - // this.blips[_player.id] = mp.blips.new(1, suspectPosition) + // 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 @@ -210,6 +211,7 @@ class Copchase { startGame() { let timeToStart = this.timeToStart + this.isTimeToStartStarted = true const interval = setInterval(() => { timeToStart = timeToStart - 1 @@ -223,6 +225,7 @@ class Copchase { if (timeToStart <= 0) { this.isStarted = true + this.isTimeToStartStarted = false this.pushWaitingPlayersToGame(this.waitingPlayers) this.selectSuspect() @@ -232,13 +235,15 @@ class Copchase { this.spawnPlayers() this.spawnCars() - // setInterval(() => { - // this.players.forEach((player, id) => { - // if (this.blips[player.id] && player.health > 0) { - // this. [player.id].position = player.position; - // } - // }) - // }, 1000) + + 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(() => { diff --git a/server/modules/events/playerConnect.mjs b/server/modules/events/playerConnect.mjs index 0b59d09..6386856 100644 --- a/server/modules/events/playerConnect.mjs +++ b/server/modules/events/playerConnect.mjs @@ -7,14 +7,13 @@ 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:setInvincible') alt.emitClient(player, 'player:notify', '~g~Добро пожаловать на сервер!') })