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
abbce246ac
commit
d209203930
@ -37,7 +37,7 @@ const dateComponent = new DateComponent({ id: 'date' })
|
|||||||
const engineHealthComponent = new EngineHealthComponent({ id: 'engineHealth' })
|
const engineHealthComponent = new EngineHealthComponent({ id: 'engineHealth' })
|
||||||
|
|
||||||
if ('alt' in window) {
|
if ('alt' in window) {
|
||||||
alt.on('display:engineHealth', engineHealth => engineHealthComponent.renderEngineHealth(engineHealth))
|
alt.on('display:engineHealth', ({ engineHealth }) => engineHealthComponent.renderEngineHealth(engineHealth))
|
||||||
alt.on('displayClear:engineHealth', () => engineHealthComponent.clearDisplay())
|
alt.on('displayClear:engineHealth', () => engineHealthComponent.clearDisplay())
|
||||||
alt.emit('ready')
|
alt.emit('ready')
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -58,9 +58,21 @@ alt.onServer('admin:setInvincible', toggle => {
|
|||||||
native.setEntityInvincible(alt.Player.local.scriptID, toggle)
|
native.setEntityInvincible(alt.Player.local.scriptID, toggle)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
alt.everyTick(() => {
|
||||||
|
if (alt.Player.local.vehicle) {
|
||||||
|
native.setEntityMaxSpeed(alt.Player.local.scriptID, 20000)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
alt.onServer('webview:load', () => {
|
alt.onServer('webview:load', () => {
|
||||||
webview.on('ready', () => {
|
webview.on('ready', () => {
|
||||||
|
alt.everyTick(() => {
|
||||||
|
let vehicle = alt.Player.local.vehicle
|
||||||
|
|
||||||
|
if (vehicle) {
|
||||||
|
webview.emit('display:engineHealth', { engineHealth: native.getEntityHealth(vehicle.scriptID) })
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -28,7 +28,7 @@ alt.onServer('player:createBlipPlayers', ({ players, color }) => {
|
|||||||
|
|
||||||
alt.onServer('player:deleteBlipPlayers', () => {
|
alt.onServer('player:deleteBlipPlayers', () => {
|
||||||
alt.Player.all.forEach(_player => {
|
alt.Player.all.forEach(_player => {
|
||||||
if (_player.blip) {
|
if (_player.blip && _player.blip !== null) {
|
||||||
_player.blip.destroy()
|
_player.blip.destroy()
|
||||||
_player.blip = null
|
_player.blip = null
|
||||||
}
|
}
|
||||||
@ -36,7 +36,7 @@ alt.onServer('player:deleteBlipPlayers', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
alt.onServer('player:deleteBlipPlayer', player => {
|
alt.onServer('player:deleteBlipPlayer', player => {
|
||||||
if (player.blip) {
|
if (player.blip && player.blip !== null) {
|
||||||
player.blip.destroy()
|
player.blip.destroy()
|
||||||
player.blip = null
|
player.blip = null
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import './modules/events/ui/admin/teleportToMe.mjs'
|
|||||||
import './modules/events/playerConnect.mjs'
|
import './modules/events/playerConnect.mjs'
|
||||||
import './modules/events/playerDisconnect.mjs'
|
import './modules/events/playerDisconnect.mjs'
|
||||||
import './modules/events/playerDeath.mjs'
|
import './modules/events/playerDeath.mjs'
|
||||||
|
import './modules/events/playerEnteredVehicle.mjs'
|
||||||
import './modules/events/playerLeftVehicle.mjs'
|
import './modules/events/playerLeftVehicle.mjs'
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -15,6 +15,7 @@ class Copchase {
|
|||||||
this.timeToStart = timeToStart
|
this.timeToStart = timeToStart
|
||||||
this.isStarted = false
|
this.isStarted = false
|
||||||
this.isTimeToStartStarted = false
|
this.isTimeToStartStarted = false
|
||||||
|
this.isSuspectLeavesCar = false
|
||||||
this.suspectCars = [
|
this.suspectCars = [
|
||||||
'asea',
|
'asea',
|
||||||
'tornado',
|
'tornado',
|
||||||
@ -87,6 +88,7 @@ class Copchase {
|
|||||||
|
|
||||||
setDefaultState() {
|
setDefaultState() {
|
||||||
this.timeRemainingInterval = null
|
this.timeRemainingInterval = null
|
||||||
|
this.isSuspectLeavesCar = false
|
||||||
this.isStarted = false
|
this.isStarted = false
|
||||||
this.suspect = null
|
this.suspect = null
|
||||||
this.players = []
|
this.players = []
|
||||||
@ -174,7 +176,7 @@ class Copchase {
|
|||||||
setTimeout(() => _player.health = 200, 300)
|
setTimeout(() => _player.health = 200, 300)
|
||||||
_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)
|
|
||||||
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)
|
||||||
alt.emitClient(_player, 'player:createBlipPlayers', {
|
alt.emitClient(_player, 'player:createBlipPlayers', {
|
||||||
|
|||||||
8
server/modules/events/playerEnteredVehicle.mjs
Normal file
8
server/modules/events/playerEnteredVehicle.mjs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import alt from 'alt-server'
|
||||||
|
import { copchase } from '../copchase.mjs'
|
||||||
|
|
||||||
|
alt.on('playerEnteredVehicle', player => {
|
||||||
|
if (copchase.isStarted && player.id !== copchase.suspect.id) {
|
||||||
|
player.removeWeapon(0x3656C8C1)
|
||||||
|
}
|
||||||
|
})
|
||||||
@ -3,7 +3,10 @@ import { copchase } from '../copchase.mjs'
|
|||||||
|
|
||||||
alt.on('playerLeftVehicle', player => {
|
alt.on('playerLeftVehicle', player => {
|
||||||
if (copchase.isStarted && player.id === copchase.suspect.id) {
|
if (copchase.isStarted && player.id === copchase.suspect.id) {
|
||||||
player.giveWeapon('0x1B06D571', 25, true);
|
|
||||||
|
if (!copchase.isSuspectLeavesCar) {
|
||||||
|
copchase.isSuspectLeavesCar = true
|
||||||
|
player.giveWeapon('0x1B06D571', 25, true)
|
||||||
|
|
||||||
copchase.players.forEach(_player => {
|
copchase.players.forEach(_player => {
|
||||||
if (_player.id !== copchase.suspect.id) {
|
if (_player.id !== copchase.suspect.id) {
|
||||||
@ -11,4 +14,9 @@ alt.on('playerLeftVehicle', player => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (copchase.isStarted && player.id !== copchase.suspect.id) {
|
||||||
|
player.giveWeapon('0x3656C8C1', 100, false)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user