mirror of
https://github.com/sergeyyarkov/altv-copchase-mod.git
synced 2026-10-11 10:19:42 +03:00
fixes
This commit is contained in:
parent
4a2b1f5736
commit
d706cad988
@ -4,6 +4,7 @@ import * as NativeUI from './includes/nativeui/nativeui.min.js'
|
||||
|
||||
import './ui.mjs'
|
||||
|
||||
|
||||
alt.setMsPerGameMinute(30000)
|
||||
|
||||
alt.onServer('player:death', () => {
|
||||
|
||||
@ -26,5 +26,7 @@ registerCmd('copchase', player => {
|
||||
return alt.emitClient(player, 'player:showMidsizedMessage', '~b~Ожидание игроков...', '')
|
||||
}
|
||||
|
||||
if (copchase.isTimeToStartStarted) return
|
||||
|
||||
copchase.startGame()
|
||||
})
|
||||
@ -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
|
||||
|
||||
@ -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(() => {
|
||||
|
||||
@ -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~Добро пожаловать на сервер!')
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user