working version

This commit is contained in:
Sergey Yarkov 2020-08-03 23:30:50 +03:00
commit 8141cb7708
20 changed files with 6453 additions and 0 deletions

BIN
client_packages/.listcache Normal file

Binary file not shown.

View File

@ -0,0 +1,92 @@
require('./ui/index') // setup nativeui
mp.gui.cursor.visible = false;
let freeze = true
let showHud = false
//mp.game.ui.displayHud(showHud);
mp.voiceChat.muted = false
mp.events.add('render', () => {
// Default ui
mp.game.graphics.drawText("copchase server", [0.9, 0.005], {
font: 2,
color: [255, 255, 255, 1000],
scale: [0.8, 0.8],
outline: true
})
mp.game.graphics.drawText("RageMP v1.1", [0.947, 0.050], {
font: 4,
color: [255, 255, 255, 1000],
scale: [0.5, 0.5],
outline: true
})
mp.game.graphics.drawText(`${new Date().getHours()}:${new Date().getMinutes()}:${new Date().getSeconds()}`, [0.24, 0.95], {
font: 4,
color: [255, 255, 255, 1000],
scale: [0.6, 0.6],
outline: true
})
if (mp.players.local.vehicle) {
mp.game.graphics.drawText(`Engine health: ${mp.players.local.vehicle.getEngineHealth().toFixed()}`, [0.54, 0.95], {
font: 7,
color: [255, 255, 255, 1000],
scale: [0.6, 0.6],
outline: true
})
}
})
mp.events.add('setCarHealth', () => {
if (mp.players.local.vehicle.getEngineHealth().toFixed() <= 500) {
return false
}
mp.players.local.vehicle.setEngineHealth(500)
})
/*
Admin events
*/
mp.events.add('onGodMode', (player, godmode) => player.setInvincible(godmode))
/*
Player events
*/
mp.events.add("playerDeath", (player, reason, killer) => {
mp.game.graphics.startScreenEffect("DeathFailNeutralIn", 3000, false)
mp.game.gameplay.setFadeOutAfterDeath(false)
mp.game.ui.displayHud(true)
mp.game.ui.resetHudComponentValues(0)
})
mp.game.ui.displayHud(true)
mp.events.add('setInv', (player) => player.setInvincible(true))
mp.events.add('delInv', (player) => player.setInvincible(false))
mp.events.add("playerJoin", (player, message) => {
player.freezePosition(freeze)
mp.events.callRemote('onPlayerDamage')
mp.gui.chat.push(message)
})
mp.events.add('login', player => {
player.freezePosition(!freeze)
//mp.game.ui.displayHud(!showHud)
})
// mp.keys.bind(0x58, true, function() {
// mp.events.callRemote("voiceEnable", [mp.players.local]);
// mp.players.local.voiceVolume = 1.0
// })
// mp.keys.bind(0x58, false, function() {
// mp.events.callRemote("voiceDisable", [mp.players.local]);
// })

View File

@ -0,0 +1,11 @@
{
"name": "copchase",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}

1
client_packages/index.js Normal file
View File

@ -0,0 +1 @@
require('./copchase/index')

File diff suppressed because one or more lines are too long

1104
client_packages/ui/index.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,44 @@
const copchaseConfig = require('../copchase-config')
class API {
constructor(players) {
this.players = players
this.authenticatedPlayers = []
this.blips = {}
}
authenticatedPlayers() {
return this.authenticatedPlayers
}
addAuthPlayer(player) {
this.authenticatedPlayers.push({
id: player.id,
name: player.name
})
}
delAuthPlayer(player) {
const index = this.authenticatedPlayers.findIndex(_player => _player.name === player.name)
if (index != -1) this.authenticatedPlayers.splice(index, 1)
}
isPlayerLoggedIn(player) {
if (this.authenticatedPlayers.find(_player => _player.name === player.name)) {
return true
} else {
return false
}
}
isPlayerAdmin(candidate) {
if (copchaseConfig.admins.find(admin => candidate.name === admin.name)) {
return true
} else {
return false
}
}
}
module.exports = API

View File

@ -0,0 +1,258 @@
const copchaseConfig = require('../../copchase-config')
require('../../events/skin')
module.exports = ({ api }) => {
mp.events.addCommand('skin', (player, model) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
if (model >= 722 || !model || isNaN(model)) player.outputChatBox('!{orange}[SERVER]: !{white}/skin [0-722]')
player.model = ped.skin[model]
})
/*
Check if player admin
!auth
*/
mp.events.addCommand('admin', (player) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
player.call('onShowAdminPanel')
})
/*
Ban player
*/
mp.events.addCommand('ban', (player, target) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
let newTarget = mp.players.at(target);
if(!target || isNaN(target)) return player.outputChatBox("!{orange}[SERVER]: /ban [id игрока]");
if(newTarget === undefined) return player.outputChatBox("!{orange}[SERVER]: !{red}Игрока с таким ID не найдено.")
newTarget.outputChatBox("!{orange}[SERVER]: !{red}Вы были заблокированы на этом сервере.");
newTarget.ban('Заблокирован!');
})
/*
Teleport to location
*/
mp.events.addCommand('to', (player, location) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
const findLocation = Object.keys(copchaseConfig.locations).find(_location => _location === location)
if (findLocation === undefined) {
player.outputChatBox('!{orange}[SERVER]: !{red}Локация не найдена')
return false
}
player.position = copchaseConfig.locations[location]
})
/*
Teleport to player
*/
mp.events.addCommand('tp', (player, target) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
let newTarget = mp.players.at(target);
if(!target || isNaN(target)) return player.outputChatBox("!{orange}[SERVER]: !{white}/tp [id игрока]");
if(newTarget === undefined) return player.outputChatBox("!{orange}[SERVER]: !{red}Игрока с таким ID не найдено.")
player.position = newTarget.position
})
/*
Teleport to player to admin
*/
mp.events.addCommand('gethere', (player, target) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
let newTarget = mp.players.at(target);
if(!target || isNaN(target)) return player.outputChatBox("!{orange}[SERVER]: !{white}/gethere [id игрока]");
if(newTarget === undefined) return player.outputChatBox("!{orange}[SERVER]: !{red}Игрока с таким ID не найдено.")
newTarget.spawn(player.position)
})
/*
Kick player
*/
mp.events.addCommand('kick', (player, target) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
let newTarget = mp.players.at(target);
if(!target || isNaN(target)) return player.outputChatBox("!{orange}[SERVER]: !{white}/kick [id игрока]");
if (newTarget === undefined) return player.outputChatBox("!{orange}[SERVER]: !{red}Игрока с таким ID не найдено.")
mp.players.forEach(_player => _player.outputChatBox(`!{orange}[SERVER]: !{white}Игрок !{1CD8FD}${newTarget.name} !{white}был кикнут с сервера`))
newTarget.notify('Вы были кикнуты с сервера')
setTimeout(() => newTarget.kick('Кикнут.'), 300)
});
/*
Get position
!auth
*/
mp.events.addCommand('pos', player => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
player.outputChatBox(`Pos: ${player.position}`)
})
/*
Create car on Spawn
*/
mp.events.addCommand('car', (player, carRef) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
if (carRef === undefined) {
player.outputChatBox('!{orange}[SERVER]: !{white}/car [reference машины]')
return false
}
const car = mp.vehicles.new(mp.joaat(carRef), player.position)
car.setColor(0, 0, 0)
car.numberPlate = 'ADMIN'
car.dimension = player.dimension
setTimeout(() => player.putIntoVehicle(car, 0), 200)
})
mp.events.addCommand('carHealth', (player, string, health) => {
if(player.vehicle) {
if(!string) {
return player.outputChatBox("!{orange}[SERVER]: !{white}/carHealth [value]");
}
player.eval(`mp.players.local.vehicle.setEngineHealth(${health})`)
} else {
return player.outputChatBox("!{orange}[SERVER]: !{red}Вы должны находться в машине!");
}
});
/*
Kill player by id
*/
mp.events.addCommand('kill', (player, target) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
let newTarget = mp.players.at(target);
if(!target || isNaN(target)) return player.outputChatBox("/kill [id игрока]");
if (newTarget === undefined) {
return player.outputChatBox("!{red}Игрока с таким ID не найдено.")
}
newTarget.health = 0
newTarget.outputChatBox(`!{orange}Вы были убиты администратором: !{gold}${player.name}`)
})
mp.events.addCommand('weather', (player, weather) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
if (weather === undefined) return player.outputChatBox(`!{orange}[SERVER]: !{white}/weather [name]`)
mp.world.weather = weather.toLowerCase()
})
}

View File

@ -0,0 +1,159 @@
const bcrypt = require('bcryptjs')
const { Player } = require('../../models/index')
const copchaseConfig = require('../../copchase-config')
module.exports = ({ api, copchase }) => {
/*
Show Online
!auth
*/
mp.events.addCommand('online', player => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
player.outputChatBox(`!{orange}[SERVER]: !{white}Онлайн сейчас: !{1CD8FD}${mp.players.length}`)
})
/*
Register Player
!auth
*/
mp.events.addCommand('reg', (player, message) => {
const candidate = api.players.filter(_player => _player.name === player.name)
if (candidate.length > 0) {
player.outputChatBox(copchaseConfig.messages.accountRegistered)
return false
}
if (api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.authenticated)
return false
}
if (message === undefined) {
player.outputChatBox('!{orange}[SERVER]: !{red}Введите пароль для регистрации')
return false
}
const passwords = message.split(' ')
if (passwords[0] === passwords[1]) {
try {
if (candidate.length <= 0) {
player.outputChatBox('!{orange}[SERVER]: !{white}Регистируем аккаунт...')
const newPlayer = new Player({
name: player.name,
password: bcrypt.hashSync(message.split(' ')[0], bcrypt.genSaltSync(10))
})
newPlayer.save().then((data) => api.players.push(data))
player.notify('~g~Аккаунт зарегистрирован!')
player.outputChatBox(`!{orange}[SERVER]: !{white}/login [пароль] !{green}для авторизации.`)
console.log(`Игрок с ником ${player.name} зарегистрировался!`)
} else {
player.notify('~r~Вы уже зарегистрированы!')
}
} catch (error) {
player.notify('~r~Произошла ошибка!')
}
} else {
player.notify('~r~Пароли не совпадают!')
}
})
/*
Login Player
!auth
*/
mp.events.addCommand('login', (player, message) => {
if (api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.authenticated)
return false
}
const candidatePassword = message
const currentPlayer = api.players.filter(currentPlayer => currentPlayer.name === player.name)
if (currentPlayer.length <= 0) {
player.notify('~r~Вы еще не зарегистрировали аккаунт!')
return false
}
if (message === undefined) {
player.notify('~r~Введите пароль!')
return false
}
bcrypt.compare(candidatePassword, currentPlayer[0].password, function(err, res) {
if (err){
player.notify('~r~Произошла ошибка при авторизации!')
}
if (res) {
player.notify('~g~Вы авторизовались!')
player.call('login', [player]) // выключить фриз
api.addAuthPlayer(player)
console.log(api.authenticatedPlayers)
} else {
player.notify('~r~Неверный пароль!')
}
})
})
/*
Spawn
!auth
*/
mp.events.addCommand('spawn', player => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (copchase.isPlayerInWaitingRoom(player)) return false
if (copchase.isPlayerInGame(player)) return false
player.dimension = 0
player.position = copchaseConfig.spawn
})
mp.events.addCommand('copchase', player => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (copchase.isPlayerInWaitingRoom(player)) return false
if (copchase.isPlayerInGame(player)) return false
player.dimension = copchase.waitingRoomDimension
player.position = copchaseConfig.waitingRoom
copchase.addPlayerToWaitingRoom(player) // добавить игрока в комнату ожидания
player.call('setInv', [player])
if (copchase.isStarted && copchase.players.length > 0) {
return player.outputChatBox('!{orange}[SERVER]: !{blue}Игра уже начата! Ожидание игроков...')
}
if (copchase.waitingPlayers.length < copchase.minPlayers) {
return player.outputChatBox('!{orange}[SERVER]: !{blue}Ожидание игроков...')
}
copchase.startGame()
})
}

View File

@ -0,0 +1,25 @@
module.exports = {
spawn: { x: -425.446, y: 1123.767, z: 325.854 },
waitingRoom: { x: 135.901, y: -749.107, z: 258.152 },
locations: {
airport: { x: -1329.613, y: -3038.4901286875747, z: 13.938 },
spawn: { x: 135.901, y: -749.107, z: 258.152 },
fibroof: { x:150.126, y:-754.591, z:262.865 },
policestation: { x:436.491, y: -982.172, z: 30.699 },
epsilon: { x:-695.025, y: 82.955, z: 55.855},
yankton: { x: 5331.8583, y: -5181.8349609375, z: 82.77088928222656 }
},
admins: [
{ name: 'kinguinmlg' },
{ name: 'Dynya' },
{ name: 'Dynya1' },
{ name: 'ch3ks1' }
],
messages: {
register: '!{orange}[SERVER]: !{green}Регистрация: !{white}/reg [пароль] [пароль]',
accountRegistered: '!{orange}[SERVER]: !{red}Аккаунт уже зарегистрирован!',
authenticated: '!{orange}[SERVER]: !{red}Вы уже авторизованы!',
notAuthenticated: '!{orange}[SERVER]: !{red}Авторизуйтесь!',
notAvailable: '!{orange}[SERVER]: !{red}Вам недоступна эта команда'
}
}

View File

@ -0,0 +1,290 @@
const copchaseConfig = require('./copchase-config')
class Copchase {
constructor({ dimension, waitingRoomDimension, minPlayers, maxPlayers, timeRemaining, timeToStart }) {
this.dimension = dimension
this.waitingRoomDimension = waitingRoomDimension
this.minPlayers = minPlayers
this.maxPlayers = maxPlayers
this.timeRemaining = timeRemaining
this.timeRemainingInterval = null
this.timeToStart = timeToStart
this.isStarted = false
this.suspectCars = [
'asea',
'bison',
'bobcatxl',
'burrito',
'emperor',
'emperor2',
'ardent',
'ingot',
'journey',
'clique',
'vamos',
'tulip',
'stafford',
'cheburek',
'streiter',
'nebula',
'hellion',
'gauntlet4'
]
this.weather = [
'EXTRASUNNY',
'CLEAR',
'CLOUDS',
'SMOG',
'FOGGY',
'OVERCAST',
'RAIN',
'THUNDER',
'CLEARING',
'NEUTRAL',
'SNOW',
'BLIZZARD',
'SNOWLIGHT',
'XMAS',
'HALLOWEEN'
]
this.players = []
this.waitingPlayers = []
this.cars = []
this.blips = {}
this.suspect = null
this.positions = {
suspect: [
{ x: 395.185, y: -999.645, z: 28.755 },
{ x: 404.691, y: -1907.0604, z: 24.723 },
{ x: 2619.436, y: 3374.145, z: 55.619 }
],
police: [
{ x: 442.308, y: -1025.066, z: 28.231 },
{ x: 348.865, y: -1966.507, z:24.133 },
{ x: 2678.454, y: 3459.637, z: 55.340 }
]
}
}
pushWaitingPlayersToGame(waitingPlayers) {
waitingPlayers.forEach(_player => this.players.push(_player))
this.waitingPlayers = []
}
messageToWaitingPlayers(message) {
this.waitingPlayers.forEach(_player => _player.outputChatBox(message))
}
messageToPlayersInGame(message) {
this.players.forEach(_player => _player.outputChatBox(message))
}
notifyPolicePlayers(message) {
this.players.forEach(_player => _player.name !== this.suspect.name ? _player.notify(message) : false)
}
notifySuspectPlayer(message) {
this.suspect.notify(message)
}
addPlayerToWaitingRoom(player) {
this.waitingPlayers.push(player)
}
setDefaultState() {
this.timeRemainingInterval = null
this.isStarted = false
this.suspect = null
this.players = []
this.waitingPlayers = []
this.blips = {}
setTimeout(() => {
this.cars.forEach(car => car.destroy())
this.cars = []
}, 3000)
}
isPlayerInGame(player) {
if(this.players.find(_player => _player.name === player.name) !== undefined) {
player.outputChatBox('!{orange}[COPCHASE]: !{red}Дождитесь окончания игры!')
return true
} else {
return false
}
}
isPlayerInWaitingRoom(player) {
if(this.waitingPlayers.find(_player => _player.name === player.name) !== undefined) {
player.outputChatBox('!{orange}[COPCHASE]: !{red}Вы уже в комнате ожидания!')
return true
} else {
return false
}
}
selectSuspect() {
this.suspect = this.players[Math.floor(Math.random() * (this.players.length - 1 - 0 + 1) + 0)]
}
startGame() {
let timeToStart = this.timeToStart
const interval = setInterval(() => {
timeToStart = timeToStart - 1
if (timeToStart <= 0) {
this.isStarted = true
this.pushWaitingPlayersToGame(this.waitingPlayers)
this.selectSuspect()
this.messageToPlayersInGame(`!{orange}[COPCHASE]: !{blue}Игра началась!`)
this.messageToPlayersInGame(`!{orange}[COPCHASE]: !{white}Саспект: !{red}${this.suspect.name}`)
this.notifyPolicePlayers(`~w~ Остановите саспекта!`)
this.notifySuspectPlayer(`~w~ Уйдите от полицейских!`)
// spawn cars and players
this.spawnPlayers().then(() => {
setTimeout(() => this.spawnCars(), 1000)
})
setInterval(() => {
this.players.forEach((player, id) => {
if (this.blips[player.id] && player.health > 0) {
this.blips[player.id].position = player.position;
}
})
}, 1000)
mp.world.weather = this.weather[Math.floor(Math.random() * (this.weather.length - 1 - 0) + 0)]
let timeRemaining = this.timeRemaining
this.timeRemainingInterval = setInterval(() => {
timeRemaining = timeRemaining - 1
if (timeRemaining !== 0) {
this.messageToPlayersInGame(`!{orange}[COPCHASE]: !{white}Время до окончания: !{blue}${timeRemaining} !{white}мин.`)
}
if (timeRemaining <= 0) {
this.stopGame('suspect')
clearInterval(this.timeRemainingInterval)
return true
}
}, 60000)
clearInterval(interval)
return true
}
this.messageToWaitingPlayers(`!{orange}[COPCHASE]: !{blue}Игра начнется через: !{white}${timeToStart}`)
}, 1000)
}
stopGame(type) {
clearInterval(this.timeRemainingInterval)
this.players.forEach(_player => {
if (this.blips[_player.id]) {
this.blips[_player.id].destroy();
}
setTimeout(() => {
_player.dimension = 0
_player.health = 100
_player.position = copchaseConfig.spawn
_player.removeAllWeapons()
_player.call('setInv', [_player])
}, 3000)
})
this.setDefaultState()
if (type === 'police') {
mp.players.forEach(_player => {
_player.outputChatBox(`!{orange}[COPCHASE]: !{blue}Игра закончилась. Полиция выиграла!`)
_player.outputChatBox(`!{orange}[COPCHASE]: !{white}/copchase !{blue} для повторной игры`)
})
console.log(`[COPCHASE]: Игра закончилась! Полиция выиграла!`)
}
if (type === 'suspect') {
mp.players.forEach(_player => {
_player.outputChatBox(`!{orange}[COPCHASE]: !{blue}Игра закончилась. Саспект выиграл!`)
_player.outputChatBox(`!{orange}[COPCHASE]: !{blue}/copchase !{white} для повторной игры`)
})
console.log(`[COPCHASE]: Игра закончилась! Саспект выиграл!`)
}
}
spawnPlayers() {
let suspectRandomNumber = Math.floor(Math.random() * this.positions.suspect.length)
let suspectPosition = this.positions.suspect[suspectRandomNumber]
return new Promise((resolve, reject) => {
this.players.forEach(_player => {
if (_player.name === this.suspect.name) {
_player.position = suspectPosition
_player.dimension = this.dimension
_player.model = ped.skin[Math.floor(Math.random() * (435 - 432) + 432)]
_player.call('delInv', [_player])
this.blips[_player.id] = mp.blips.new(1, suspectPosition)
this.blips[_player.id].name = _player.name
this.blips[_player.id].dimension = this.dimension
this.blips[_player.id].color = 1
} else {
_player.position = {
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 = ped.skin[625]
_player.call('delInv', [_player])
_player.giveWeapon(mp.joaat('weapon_stungun'), 99999)
this.blips[_player.id] = mp.blips.new(1, suspectPosition)
this.blips[_player.id].name = _player.name
this.blips[_player.id].dimension = this.dimension
this.blips[_player.id].color = 38
}
})
resolve()
})
}
spawnCars() {
this.players.forEach(_player => {
if (_player.name === this.suspect.name) {
const carSuspect = mp.vehicles.new(mp.joaat(this.suspectCars[Math.floor(Math.random() * (this.suspectCars.length - 1 - 0) + 0)]), _player.position, {
dimension: this.dimension
})
carSuspect.setColor(0, 0, 0)
carSuspect.numberPlate = 'suspect'
_player.putIntoVehicle(carSuspect, 0)
this.cars.push(carSuspect)
} else {
const carPolice = mp.vehicles.new(mp.joaat('police3'), _player.position, {
dimension: this.dimension
})
carPolice.setColor(0, 0, 0)
carPolice.numberPlate = 'police'
_player.putIntoVehicle(carPolice, 0)
this.cars.push(carPolice)
}
})
}
}
module.exports = Copchase

View File

@ -0,0 +1,153 @@
const copchaseConfig = require('../../copchase-config')
module.exports = ({ api }) => {
mp.events.add('[ui:showAdminPanel]', player => {
if (api.isPlayerLoggedIn(player) && api.isPlayerAdmin(player)) player.call('onShowAdminPanel')
})
mp.events.add('[ui:kickPlayer]', (player, targetName) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
const target = mp.players.toArray().find(_player => _player.name === targetName)
if (target === undefined) return player.outputChatBox("!{orange}[SERVER]: !{red}Игрока с таким ID не найдено.")
mp.players.forEach(_player => _player.outputChatBox(`!{orange}[SERVER]: !{white}Игрок !{1CD8FD}${target.name} !{white}был кикнут с сервера`))
target.notify('Вы были кикнуты с сервера')
setTimeout(() => target.kick('Кикнут.'), 300)
player.call('updatePlayers')
})
mp.events.add('[ui:banPlayer]', (player, targetName) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
const target = mp.players.toArray().find(_player => _player.name === targetName)
if (target === undefined) return player.outputChatBox("!{orange}[SERVER]: !{red}Игрока с таким ID не найдено.")
mp.players.forEach(_player => _player.outputChatBox(`!{orange}[SERVER]: !{white}Игрок !{1CD8FD}${target.name} !{white}был заблокирован`))
target.notify('Вы были заблокированы на этом сервере')
setTimeout(() => target.ban('Заблокирован.'), 300)
})
mp.events.add('[ui:killPlayer]', (player, targetName) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
const target = mp.players.toArray().find(_player => _player.name === targetName)
if (target === undefined) return player.outputChatBox("!{orange}[SERVER]: !{red}Игрока с таким ID не найдено.")
target.notify('Вы были убиты администратором сервера')
target.health = 0
})
mp.events.add('[ui:teleportToPlayer]', (player, targetName) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
const target = mp.players.toArray().find(_player => _player.name === targetName)
if (target === undefined) return player.outputChatBox("!{orange}[SERVER]: !{red}Игрока с таким ID не найдено.")
player.notify(`Вы телепортировались к игроку ${target.name}`)
player.position = target.position
})
mp.events.add('[ui:teleportToMe]', (player, targetName) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
if (!api.isPlayerAdmin(player)) {
player.outputChatBox(copchaseConfig.messages.notAvailable)
return false
}
const target = mp.players.toArray().find(_player => _player.name === targetName)
if (target === undefined) return player.outputChatBox("!{orange}[SERVER]: !{red}Игрока с таким ID не найдено.")
player.notify(`Игрок ${target.name} был телепортирован к вам`)
target.notify(`Вы были телепортированы администратором`)
target.position = player.position
})
mp.events.add('[ui:spawnCar]', (player, carRef) => {
if (api.isPlayerLoggedIn(player) && api.isPlayerAdmin(player)) {
const car = mp.vehicles.new(mp.joaat(carRef), player.position)
car.setColor(0, 0, 0)
car.numberPlate = 'ADMIN'
car.dimension = player.dimension
setTimeout(() => player.putIntoVehicle(car, 0), 200)
}
})
mp.events.add('[ui:teleportToLocation]', (player, location) => {
if (api.isPlayerLoggedIn(player) && api.isPlayerAdmin(player)) {
const findLocation = Object.keys(copchaseConfig.locations).find(_location => _location === location)
if (findLocation === undefined) {
player.outputChatBox('!{orange}[SERVER]: !{red}Локация не найдена')
return false
}
player.position = copchaseConfig.locations[location]
}
})
mp.events.add('[ui:godMode]', (player, godmode) => {
if (api.isPlayerLoggedIn(player) && api.isPlayerAdmin(player)) {
player.call('onGodMode', [player, godmode])
godmode ? player.notify(`Режим неуязвимости: вкл`) : player.notify(`Режим неуязвимости: выкл`)
}
})
mp.events.add('[ui:getHealth]', player => {
if (api.isPlayerLoggedIn(player) && api.isPlayerAdmin(player)) {
player.health = 100
player.notify(`Ваше здоровье было восстановлено!`)
}
})
mp.events.add('[ui:giveWeapon]', (player, weaponRef) => {
if (api.isPlayerLoggedIn(player) && api.isPlayerAdmin(player)) {
if (weaponRef === 'parachute') {
player.giveWeapon(mp.joaat(`gadget_${weaponRef}`), 99999)
return false
}
player.giveWeapon(mp.joaat(`weapon_${weaponRef}`), 99999)
}
})
}

View File

@ -0,0 +1,164 @@
const copchaseConfig = require('../../copchase-config');
const { getDistance } = require('../../helpers/getDistance')
module.exports = ({ api, copchase }) => {
const putIntoVehicleKey = Symbol('putIntoVehicle');
mp.events.add('entityCreated', entity => {
if (entity.type !== 'player') {
return;
}
entity[putIntoVehicleKey] = entity.putIntoVehicle;
entity.putIntoVehicle = (vehicle, seat) => {
setTimeout(() => {
entity[putIntoVehicleKey](vehicle, seat);
}, 400);
};
})
mp.events.add("playerExitVehicle", (player, vehicle, seat) => {
if (copchase.isStarted && player.name === copchase.suspect.name) {
player.giveWeapon(mp.joaat('weapon_pistol'), 25);
copchase.players.forEach(_player => {
if (_player.name !== copchase.suspect.name) {
_player.giveWeapon(mp.joaat('weapon_pistol'), 50);
}
})
}
})
mp.events.add('playerEnterVehicle', (player, vehicle, seat) => {
if (copchase.isStarted && player.name === copchase.suspect.name && seat === 0) {
player.call('setCarHealth')
}
return false
})
/*
Player has been joined to the server
*/
mp.events.add('playerJoin', player => {
const candidate = api.players.filter(_player => _player.name === player.name)
console.log(`[SERVER]: ${player.name} присоеденился к серверу!`);
mp.players.forEach(_player => _player.outputChatBox(`!{orange}[SERVER]: !{1CD8FD}✋ [${player.id}: ${player.name}] !{white}присоеденился`))
player.spawn(copchaseConfig.spawn)
player.dimension = 0
player.model = ped.skin[Math.floor(Math.random() * (722 - 35) + 35)]
candidate <= 0
? player.call('playerJoin', [player, copchaseConfig.messages.register])
: player.call('playerJoin', [player, `!{orange}[SERVER]: !{white}/login [пароль] !{green}для авторизации`])
})
mp.events.add("playerQuit", player => {
if (copchase.isStarted) {
if (player.name === copchase.suspect.name) copchase.stopGame('police')
const policemanIndex = copchase.players.findIndex(_player => _player.name === player.name && _player.name !== copchase.suspect.name)
if (policemanIndex !== -1) copchase.players.splice(policemanIndex, 1)
if (copchase.players.length <= 1 && copchase.suspect !== null) copchase.stopGame('suspect')
}
api.delAuthPlayer(player) // удаляем игрока из массива с авторизованными игроками
console.log(`[SERVER]: игрок ${player.name} отсоеденился`)
console.log(api.authenticatedPlayers)
mp.players.forEach(_player => _player.outputChatBox(`!{orange}[SERVER]: !{1CD8FD}[${player.name}] !{white}покинул нас`))
})
/*
When player send message to the chat
*/
mp.events.add("playerChat", (player, message) => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
mp.players.forEach(_player => _player.outputChatBox(`!{orange}[${player.id}]: !{1CD8FD}${player.name} !{white}${message}`))
})
/*
Unknown command in chat
*/
mp.events.add('playerCommand', (player, command) => {
if (player.health <= 0) return false
player.outputChatBox(`!{orange}[SERVER]: !{red}Команды "${command}" не существует`)
player.outputChatBox(`!{orange}[SERVER]: !{red}Нажмите !{1CD8FD}H !{red}для помощи`)
})
mp.events.add('onPlayerDamage', (player) => {
if (copchase.isStarted) {
return false
}
player.call('setInv', [player])
})
/*
On Player death
*/
mp.events.add('playerDeath', player => {
if (copchase.isStarted) {
if (player.name === copchase.suspect.name) copchase.stopGame('police')
const policemanIndex = copchase.players.findIndex(_player => _player.name === player.name && _player.name !== copchase.suspect.name)
if (policemanIndex !== -1) copchase.players.splice(policemanIndex, 1)
if (copchase.players.length <= 1 && copchase.suspect !== null) copchase.stopGame('suspect')
}
player.removeAllWeapons()
mp.players.forEach(_player => _player.notify(`Игрок ${player.name} погиб`))
setTimeout(() => {
// player.health = 100
// player.position = copchaseConfig.spawn
player.spawn(copchaseConfig.spawn)
player.dimension = 0
player.call('setInv', [player])
}, 3000)
})
mp.events.add('voiceEnable', player => {
mp.players.forEach(_player => {
let distance = getDistance(_player.position, player.position)
if(player == _player) return false;
if (distance <= 10) {
player.enableVoiceTo(_player);
console.log(`${player.name} что-то говорит`)
}
})
})
mp.events.add('voiceDisable', player => {
mp.players.forEach(_player => {
if(player == _player) return false;
player.disableVoiceTo(_player);
console.log(`${player.name} перестал говорить`)
})
})
mp.events.add('[ui:showHelpPanel]', player => {
if (!api.isPlayerLoggedIn(player)) {
player.outputChatBox(copchaseConfig.messages.notAuthenticated)
return false
}
player.call('onShowHelpPanel')
})
}

View File

@ -0,0 +1,725 @@
global.ped = {
skin: mp.joaat(["A_C_Boar",
"A_C_Chickenhawk",
"A_C_Chimp",
"A_C_Chop",
"A_C_Cormorant",
"A_C_Cow",
"A_C_Coyote",
"A_C_Crow",
"A_C_Deer",
"A_C_Fish",
"A_C_Hen",
"A_C_Husky",
"A_C_MtLion",
"A_C_ig",
"A_C_igeon",
"A_C_Rat",
"A_C_Retriever",
"A_C_Rhesus",
"A_C_Rottweiler",
"A_C_Seagull",
"A_C_SharkTiger",
"A_C_shepherd",
"A_F_M_Beach_01",
"A_F_M_BevHills_01",
"A_F_M_BevHills_02",
"A_F_M_BodyBuild_01",
"A_F_M_Business_02",
"A_F_M_Downtown_01",
"A_F_M_EastSA_01",
"A_F_M_EastSA_02",
"A_F_M_FatBla_01",
"A_F_M_FatCult_01",
"A_F_M_FatWhite_01",
"A_F_M_KTown_01",
"A_F_M_KTown_02",
"A_F_M_rolHost_01",
"A_F_M_Salton_01",
"A_F_M_SkidRow_01",
"A_F_M_SouCent_01",
"A_F_M_SouCent_02",
"A_F_M_SouCentMC_01",
"A_F_M_Tourist_01",
"A_F_M_Tramp_01",
"A_F_M_TrampBeac_01",
"A_F_O_DesStreet_01",
"A_F_O_GenStreet_01",
"A_F_O_Indian_01",
"A_F_O_KTown_01",
"A_F_O_Salton_01",
"A_F_O_SouCent_01",
"A_F_O_SouCent_02",
"A_F_Y_Beach_01",
"A_F_Y_BevHills_01",
"A_F_Y_BevHills_02",
"A_F_Y_BevHills_03",
"A_F_Y_BevHills_04",
"A_F_Y_Business_01",
"A_F_Y_Business_02",
"A_F_Y_Business_03",
"A_F_Y_Business_04",
"A_F_Y_EastSA_01",
"A_F_Y_EastSA_02",
"A_F_Y_EastSA_03",
"A_F_Y_Epsilon_01",
"A_F_Y_Fitness_01",
"A_F_Y_Fitness_02",
"A_F_Y_GenAsian01",
"A_F_Y_GenHot_01",
"A_F_Y_Golfer_01",
"A_F_Y_Hiker_01",
"A_F_Y_Hippie_01",
"A_F_Y_Hipster_01",
"A_F_Y_Hipster_02",
"A_F_Y_Hipster_03",
"A_F_Y_Hipster_04",
"A_F_Y_Indian_01",
"A_F_Y_Juggalo_01",
"A_F_Y_Runner_01",
"A_F_Y_RurMeth_01",
"A_F_Y_SCDressy_01",
"A_F_Y_SilverHip_01",
"A_F_Y_Skater_01",
"A_F_Y_Skivill_02",
"A_F_Y_SouCent_01",
"A_F_Y_SouCent_02",
"A_F_Y_SouCent_03",
"A_F_Y_Streetlady",
"A_F_Y_Tennis_01",
"A_F_Y_Topless_01",
"A_F_Y_Tourist_01",
"A_F_Y_Tourist_02",
"A_F_Y_Vinewood_01",
"A_F_Y_Vinewood_02",
"A_F_Y_Vinewood_03",
"A_F_Y_Vinewood_04",
"A_F_Y_Yoga_01",
"A_M_M_ACult_01",
"A_M_M_AfriAmer_01",
"A_M_M_Beach_01",
"A_M_M_Beach_02",
"A_M_M_BevHills_01",
"A_M_M_BevHills_02",
"A_M_M_Business_01",
"A_M_M_DesBeg_01",
"A_M_M_DesRebel_02",
"A_M_M_DesRebel_04",
"A_M_M_EastSA_01",
"A_M_M_EastSA_02",
"A_M_M_Farmer_01",
"A_M_M_FatLatin_01",
"A_M_M_GenFat_01",
"A_M_M_GenFat_02",
"A_M_M_Golfer_01",
"A_M_M_HasJew_01",
"A_M_M_Hillbilly_01",
"A_M_M_Hillbilly_02",
"A_M_M_Indian_01",
"A_M_M_KTown_01",
"A_M_M_Malibu_01",
"A_M_M_MexCntry_01",
"A_M_M_MexLabor_01",
"A_M_M_OG_Boss_01",
"A_M_M_aparazzi_01",
"A_M_M_olynesian_01",
"A_M_M_rolHost_01",
"A_M_M_RurMeth_01",
"A_M_M_Salton_01",
"A_M_M_Salton_02",
"A_M_M_Salton_03",
"A_M_M_Salton_04",
"A_M_M_Skater_01",
"A_M_M_Skidrow_01",
"A_M_M_SkiVill_07",
"A_M_M_SoCenLat_01",
"A_M_M_SouCent_01",
"A_M_M_SouCent_02",
"A_M_M_SouCent_03",
"A_M_M_SouCent_04",
"A_M_M_StLat_02",
"A_M_M_Tennis_01",
"A_M_M_Tourist_01",
"A_M_M_Tramp_01",
"A_M_M_TrampBeac_01",
"A_M_M_TranVest_01",
"A_M_M_TranVest_02",
"A_M_O_ACult_01",
"A_M_O_ACult_02",
"A_M_O_Beach_01",
"A_M_O_DesStreet_01",
"A_M_O_GenStreet_01",
"A_M_O_KTown_01",
"A_M_O_Salton_01",
"A_M_O_SouCent_01",
"A_M_O_SouCent_02",
"A_M_O_SouCent_03",
"A_M_O_Tramp_01",
"A_M_Y_ACult_01",
"A_M_Y_ACult_02",
"A_M_Y_Beach_01",
"A_M_Y_Beach_02",
"A_M_Y_Beach_03",
"A_M_Y_BeachVesp_01",
"A_M_Y_BeachVesp_02",
"A_M_Y_BevHills_01",
"A_M_Y_BevHills_02",
"A_M_Y_BreakDance_01",
"A_M_Y_BusiCas_01",
"A_M_Y_Business_01",
"A_M_Y_Business_02",
"A_M_Y_Business_03",
"A_M_Y_Cyclist_01",
"A_M_Y_DesRebel_01",
"A_M_Y_DesStreet_01",
"A_M_Y_DHill_01",
"A_M_Y_Downtown_01",
"A_M_Y_EastSA_01",
"A_M_Y_EastSA_02",
"A_M_Y_Epsilon_01",
"A_M_Y_Epsilon_02",
"A_M_Y_Gay_01",
"A_M_Y_Gay_02",
"A_M_Y_GenStreet_01",
"A_M_Y_GenStreet_02",
"A_M_Y_Golfer_01",
"A_M_Y_HasJew_01",
"A_M_Y_Hiker_01",
"A_M_Y_Hippy_01",
"A_M_Y_Hipster_01",
"A_M_Y_Hipster_02",
"A_M_Y_Hipster_03",
"A_M_Y_Indian_01",
"A_M_Y_Jetski_01",
"A_M_Y_Juggalo_01",
"A_M_Y_KTown_01",
"A_M_Y_KTown_02",
"A_M_Y_Latino_01",
"A_M_Y_MethHead_01",
"A_M_Y_MexThug_01",
"A_M_Y_MotoX_01",
"A_M_Y_MotoX_02",
"A_M_Y_MusclBeac_01",
"A_M_Y_MusclBeac_02",
"A_M_Y_olynesian_01",
"A_M_Y_RoadCyc_01",
"A_M_Y_Runner_01",
"A_M_Y_Runner_02",
"A_M_Y_Salton_01",
"A_M_Y_Skater_01",
"A_M_Y_Skater_02",
"A_M_Y_SouCent_01",
"A_M_Y_SouCent_02",
"A_M_Y_SouCent_03",
"A_M_Y_SouCent_04",
"A_M_Y_StBla_01",
"A_M_Y_StBla_02",
"A_M_Y_StLat_01",
"A_M_Y_StWhi_01",
"A_M_Y_StWhi_02",
"A_M_Y_Sunbathe_01",
"A_M_Y_Surfer_01",
"A_M_Y_VinDouche_01",
"A_M_Y_Vinewood_01",
"A_M_Y_Vinewood_02",
"A_M_Y_Vinewood_03",
"A_M_Y_Vinewood_04",
"A_M_Y_Yoga_01",
"comp_eds_helmets_moped",
"comp_eds_helmets_motox",
"comp_eds_helmets_shorty",
"comp_eds_helmets_sports",
"comp_eds_marine",
"CS_AmandaTownley",
"CS_Andreas",
"CS_ashley",
"CS_Bankman",
"CS_Barry",
"CS_Beverly",
"CS_Brad",
"CS_BradCadaver",
"CS_Carbuyer",
"CS_Casey",
"CS_ChengSr",
"CS_ChrisFormage",
"CS_Clay",
"CS_Dale",
"CS_DaveNorton",
"CS_debra",
"CS_denise",
"CS_Devin",
"CS_Dom",
"CS_Dreyfuss",
"CS_DrFriedlander",
"CS_Fabien",
"CS_fabien",
"CS_FBISuit_01",
"CS_Floyd",
"CS_Guadalope",
"CS_gurk",
"CS_Hunter",
"CS_Janet",
"CS_JewelAss",
"CS_JimmyBoston",
"CS_JimmyDiSanto",
"CS_JoeMinuteMan",
"CS_JohnnyKlebitz",
"CS_Josef",
"CS_Josh",
"CS_LamarDavis",
"CS_Lazlow",
"CS_LesterCrest",
"CS_LifeInvad_01",
"CS_Magenta",
"CS_Manuel",
"CS_Marnie",
"CS_MartinMadrazo",
"CS_MaryAnn",
"CS_Michelle",
"CS_Milton",
"CS_Molly",
"CS_MovPremF_01",
"CS_MovPremMale",
"CS_MRK",
"CS_MRS_Thornhill",
"CS_MrsPhillips",
"CS_Natalia",
"CS_NervousRon",
"CS_Nigel",
"CS_Old_Man1A",
"CS_Old_Man2",
"CS_Omega",
"CS_Orleans",
"CS_aper",
"CS_atricia",
"CS_riest",
"CS_rolSec_02",
"CS_RussianDrunk",
"CS_SiemonYetarian",
"CS_Solomon",
"CS_SteveHains",
"CS_Stretch",
"CS_Tanisha",
"CS_TaoCheng",
"CS_TaosTranslator",
"CS_TennisCoach",
"CS_Terry",
"CS_Tom",
"CS_TomEpsilon",
"CS_TracyDiSanto",
"CS_Wade",
"CS_Zimbor",
"CSB_Abigail",
"CSB_Anita",
"CSB_Anton",
"CSB_BallasOG",
"CSB_Bride",
"CSB_BurgerDrug",
"CSB_Car3guy1",
"CSB_Car3guy2",
"CSB_Chef",
"CSB_Chin_goon",
"CSB_Cletus",
"CSB_Cop",
"CSB_Customer",
"CSB_Denise_friend",
"CSB_FOS_rep",
"CSB_G",
"CSB_Groom",
"CSB_Grove_str_dlr",
"CSB_Hao",
"CSB_Hugh",
"CSB_Imran",
"CSB_Janitor",
"CSB_Maude",
"CSB_MWeather",
"CSB_Ortega",
"CSB_Oscar",
"CSB_ornDudes",
"CSB_rologueDriver",
"CSB_rolSec",
"CSB_Ramp_Gang",
"CSB_Ramp_hic",
"CSB_Ramp_hipster",
"CSB_Ramp_Marine",
"CSB_Ramp_Mex",
"CSB_Reporter",
"CSB_RoccoPelosi",
"CSB_Screen_Writer",
"CSB_Stripper_01",
"CSB_Stripper_02",
"CSB_Tonya",
"CSB_TrafficWarden",
"G_F_Y_ballas_01",
"G_F_Y_Families_01",
"G_F_Y_Lost_01",
"G_F_Y_Vagos_01",
"G_M_M_AlpHench_01",
"G_M_M_AlpHench_02",
"G_M_M_ArmBoss_01",
"G_M_M_ArmGoon_01",
"G_M_M_ArmLieut_01",
"G_M_M_ChemWork_01",
"G_M_M_ChiBoss_01",
"G_M_M_ChiCold_01",
"G_M_M_ChiGoon_01",
"G_M_M_ChiGoon_02",
"G_M_M_KorBoss_01",
"G_M_M_MexBoss_01",
"G_M_M_MexBoss_02",
"G_M_O_DesOfficer",
"G_M_Y_AlpHeli_01",
"G_M_Y_ArmGoon_02",
"G_M_Y_Azteca_01",
"G_M_Y_BallaEast_01",
"G_M_Y_BallaOrig_01",
"G_M_Y_BallaSout_01",
"G_M_Y_Black01",
"G_M_Y_Const_01",
"G_M_Y_DesArmy_01",
"G_M_Y_DesArmy_02",
"G_M_Y_DesArmy_05",
"G_M_Y_DesHench_02",
"G_M_Y_DesHench_03",
"G_M_Y_DesMilit_03",
"G_M_Y_FamCA_01",
"G_M_Y_FamDNF_01",
"G_M_Y_FamFor_01",
"G_M_Y_Famfor_01",
"G_M_Y_Korean_01",
"G_M_Y_Korean_02",
"G_M_Y_KorLieut_01",
"G_M_Y_Latino01",
"G_M_Y_Lost_01",
"G_M_Y_Lost_02",
"G_M_Y_Lost_03",
"G_M_Y_MexGang_01",
"G_M_Y_MexGoon_01",
"G_M_Y_MexGoon_02",
"G_M_Y_MexGoon_03",
"G_M_Y_oloGoon_01",
"G_M_Y_oloGoon_02",
"G_M_Y_SalvaBoss_01",
"G_M_Y_SalvaGoon_01",
"G_M_Y_SalvaGoon_02",
"G_M_Y_SalvaGoon_03",
"G_M_Y_SciHench_01",
"G_M_Y_ScuHench_02",
"G_M_Y_SpaceHench_01",
"G_M_Y_SPACHENCH_02",
"G_M_Y_StrPunk_01",
"G_M_Y_StrPunk_02",
"G_M_Y_SubHench_01",
"G_M_Y_White01",
"HC_Driver",
"HC_Gunman",
"HC_Hacker",
"IG_Abigail",
"IG_AmandaTownley",
"IG_Andreas",
"IG_Ashley",
"IG_BallasOG",
"IG_Bankman",
"IG_Barry",
"IG_BestMen",
"IG_Beverly",
"IG_Brad",
"IG_Bride",
"IG_Car3guy1",
"IG_Car3guy2",
"IG_Casey",
"IG_Chef",
"IG_ChengSr",
"IG_ChrisFormage",
"IG_Clay",
"IG_ClayPain",
"IG_Cletus",
"IG_Dale",
"IG_DaveNorton",
"IG_Denise",
"IG_Devin",
"IG_Dom",
"IG_Dreyfuss",
"IG_DrFriedlander",
"IG_Fabien",
"IG_FBISuit_01",
"IG_Floyd",
"IG_Groom",
"IG_Hao",
"IG_Hunter",
"IG_Janet",
"IG_JAY_Norris",
"IG_JewelAss",
"IG_JimmyBoston",
"IG_JimmyDiSanto",
"IG_JoeMinuteMan",
"IG_JohnnyKlebitz",
"IG_Josef",
"IG_Josh",
"IG_KerryMcIntosh",
"IG_LamarDavis",
"IG_Lazlow",
"IG_LesterCrest",
"IG_LifeInvad_01",
"IG_LifeInvad_02",
"IG_Magenta",
"IG_Manuel",
"IG_Marnie",
"IG_MaryAnn",
"IG_Maude",
"IG_Michelle",
"IG_Milton",
"IG_Molly",
"IG_MRK",
"IG_MRS_Thornhill",
"IG_MrsPhillips",
"IG_Natalia",
"IG_NervousRon",
"IG_Nigel",
"IG_Old_Man1A",
"IG_Old_Man2",
"IG_Omega",
"IG_ONeil",
"IG_Orleans",
"IG_Ortega",
"IG_aper",
"IG_atricia",
"IG_riest",
"IG_rolSec_02",
"IG_Ramp_Gang",
"IG_Ramp_Hic",
"IG_Ramp_Hipster",
"IG_Ramp_Mex",
"IG_RoccoPelosi",
"IG_RussianDrunk",
"IG_Screen_Writer",
"IG_SiemonYetarian",
"IG_Solomon",
"IG_SteveHains",
"IG_Stretch",
"IG_Talina",
"IG_Tanisha",
"IG_TaoCheng",
"IG_TaosTranslator",
"IG_TennisCoach",
"IG_Terry",
"IG_TomEpsilon",
"IG_Tonya",
"IG_TracyDiSanto",
"IG_TrafficWarden",
"IG_TylerDix",
"IG_Wade",
"IG_Zimbor",
"MP_F_Cop_01",
"MP_F_DeadHooker",
"MP_F_Freemode_01",
"MP_F_Misty_01",
"MP_F_StripperLite",
"MP_G_F_Mexican_01",
"MP_G_F_Vagos_01",
"MP_G_M_Black_01",
"MP_G_M_Mexican_01",
"MP_G_M_ros_01",
"MP_G_M_Vagos_01",
"MP_HeadTargets",
"MP_M_Claude_01",
"MP_M_Cop_01",
"MP_M_ExArmy_01",
"MP_M_FamDD_01",
"MP_M_FIBSec_01",
"MP_M_Freemode_01",
"MP_M_Marston_01",
"MP_M_Niko_01",
"MP_M_ShopKeep_01",
"MP_S_M_Armoured_01",
"player",
"Player_One",
"Player_Two",
"Player_Zero",
"S_F_M_Fembarber",
"S_F_M_Maid_01",
"S_F_M_MAID_02",
"S_F_M_Shop_HIGH",
"S_F_M_SweatShop_01",
"S_F_Y_AirHostess_01",
"S_F_Y_Bartender_01",
"S_F_Y_Baywatch_01",
"S_F_Y_Cop_01",
"S_F_Y_Factory_01",
"S_F_Y_Hooker_01",
"S_F_Y_Hooker_02",
"S_F_Y_Hooker_03",
"S_F_Y_Migrant_01",
"S_F_Y_MovPrem_01",
"S_F_Y_Ranger_01",
"S_F_Y_Scrubs_01",
"S_F_Y_Sheriff_01",
"S_F_Y_Shop_LOW",
"S_F_Y_Shop_MID",
"S_F_Y_Snowcop_01",
"S_F_Y_Stripper_01",
"S_F_Y_Stripper_02",
"S_F_Y_StripperLite",
"S_F_Y_SweatShop_01",
"S_M_M_Alpstall",
"S_M_M_AmmuCountry",
"S_M_M_Armoured_01",
"S_M_M_Armoured_02",
"S_M_M_AutoShop_01",
"S_M_M_AutoShop_02",
"S_M_M_Bouncer_01",
"S_M_M_ChemSec_01",
"S_M_M_CIASec_01",
"S_M_M_CntryBar_01",
"S_M_M_DockWork_01",
"S_M_M_Doctor_01",
"S_M_M_FIBOffice_01",
"S_M_M_FIBOffice_02",
"S_M_M_Gaffer_01",
"S_M_M_Gardener_01",
"S_M_M_GenTransport",
"S_M_M_HairDress_01",
"S_M_M_HighSec_01",
"S_M_M_HighSec_02",
"S_M_M_INTWork",
"S_M_M_Janitor",
"S_M_M_LatHandy_01",
"S_M_M_LifeInvad_01",
"S_M_M_Linecook",
"S_M_M_LSMetro_01",
"S_M_M_Mariachi_01",
"S_M_M_Marine_01",
"S_M_M_Marine_02",
"S_M_M_Migrant_01",
"S_M_M_MovAlien_01",
"S_M_M_MovPrem_01",
"S_M_M_MovSpace_01",
"S_M_M_aramedic_01",
"S_M_M_ilot_01",
"S_M_M_ilot_02",
"S_M_M_ostal_01",
"S_M_M_ostal_02",
"S_M_M_risGuard_01",
"S_M_M_Scientist_01",
"S_M_M_Security_01",
"S_M_M_SnowCop_01",
"S_M_M_StrPerf_01",
"S_M_M_StrPreach_01",
"S_M_M_StrVend_01",
"S_M_M_Trucker_01",
"S_M_M_UPS_01",
"S_M_M_UPS_02",
"S_M_O_Busker_01",
"S_M_O_Snowcop_01",
"S_M_Y_AirWorker",
"S_M_Y_AmmuCity_01",
"S_M_Y_ArmyMech_01",
"S_M_Y_Autopsy_01",
"S_M_Y_Barman_01",
"S_M_Y_BayWatch_01",
"S_M_Y_BlackOps_01",
"S_M_Y_BlackOps_02",
"S_M_Y_BusBoy_01",
"S_M_Y_Chef_01",
"S_M_Y_Clown_01",
"S_M_Y_Construct_01",
"S_M_Y_Construct_02",
"S_M_Y_Cop_01",
"S_M_Y_Dealer_01",
"S_M_Y_DevinSec_01",
"S_M_Y_DockWork_01",
"S_M_Y_Doorman_01",
"S_M_Y_DWService_01",
"S_M_Y_DWService_02",
"S_M_Y_Factory_01",
"S_M_Y_Fireman_01",
"S_M_Y_Garbage",
"S_M_Y_Grip_01",
"S_M_Y_HwayCop_01",
"S_M_Y_Marine_01",
"S_M_Y_Marine_02",
"S_M_Y_Marine_03",
"S_M_Y_Mime",
"S_M_Y_estCont_01",
"S_M_Y_ilot_01",
"S_M_Y_risMuscl_01",
"S_M_Y_risoner_01",
"S_M_Y_Ranger_01",
"S_M_Y_Robber_01",
"S_M_Y_Scrubs_01",
"S_M_Y_Sheriff_01",
"S_M_Y_Shop_MASK",
"S_M_Y_StrVend_01",
"S_M_Y_Swat_01",
"S_M_Y_USCG_01",
"S_M_Y_Valet_01",
"S_M_Y_Waiter_01",
"S_M_Y_WinClean_01",
"S_M_Y_XMech_01",
"S_M_Y_XMech_02",
"slod_human",
"slod_large_quadped",
"slod_small_quadped",
"strm_eds_mpShare",
"strm_eds_mpTattRTs",
"U_F_M_Corpse_01",
"U_F_M_Miranda",
"U_F_M_roMourn_01",
"U_F_O_MovieStar",
"U_F_O_rolHost_01",
"U_F_Y_BikerChic",
"U_F_Y_COMJane",
"U_F_Y_corpse_01",
"U_F_Y_corpse_02",
"U_F_Y_HotPosh_01",
"U_F_Y_JewelAss_01",
"U_F_Y_Mistress",
"U_F_Y_oppyMich",
"U_F_Y_rincess",
"U_F_Y_SpyActress",
"U_M_M_Aldinapoli",
"U_M_M_BankMan",
"U_M_M_BikeHire_01",
"U_M_M_FIBArchitect",
"U_M_M_FilmDirector",
"U_M_M_GlenStank_01",
"U_M_M_Griff_01",
"U_M_M_Jesus_01",
"U_M_M_JewelSec_01",
"U_M_M_JewelThief",
"U_M_M_MarkFost",
"U_M_M_artyTarget",
"U_M_M_rolSec_01",
"U_M_M_roMourn_01",
"U_M_M_RivalPap",
"U_M_M_SpyActor",
"U_M_M_WillyFist",
"U_M_O_FinGuru_01",
"U_M_O_TapHillBilly",
"U_M_O_Tramp_01",
"U_M_Y_Abner",
"U_M_Y_AntonB",
"U_M_Y_BabyD",
"U_M_Y_Baygor",
"U_M_Y_BurgerDrug_01",
"U_M_Y_Chip",
"U_M_Y_Cyclist_01",
"U_M_Y_FIBMugger_01",
"U_M_Y_Guido_01",
"U_M_Y_GunVend_01",
"U_M_Y_Hippie_01",
"U_M_Y_ImpoRage",
"U_M_Y_Justin",
"U_M_Y_Mani",
"U_M_Y_MilitaryBum",
"U_M_Y_aparazzi",
"U_M_Y_arty_01",
"U_M_Y_ogo_01",
"U_M_Y_risoner_01",
"U_M_Y_rolDriver_01",
"U_M_Y_RSRanger_01",
"U_M_Y_SBike",
"U_M_Y_StagGrm_01",
"U_M_Y_Tattoo_01",
"U_M_Y_Zombie_01"])
}

View File

@ -0,0 +1,5 @@
const getDistance = function (v1, v2){
return Math.abs(Math.sqrt(Math.pow((v2.x - v1.x),2) + Math.pow((v2.y - v1.y), 2)));
}
module.exports = { getDistance }

View File

@ -0,0 +1,47 @@
const mongoose = require('mongoose')
const { Player } = require('./models')
const API = require('./api')
const Copchase = require('./copchase')
const startServer = async () => {
try {
await mongoose.connect('mongodb+srv://sergeyyarkov:1234@cluster0.erqpg.mongodb.net/copchase-db?retryWrites=true&w=majority', {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
})
console.log('Database connected!')
const players = await Player.find({})
const api = new API(players)
const copchase = new Copchase({
dimension: 10,
waitingRoomDimension: 5,
maxPlayers: 11,
minPlayers: 1,
timeRemaining: 10,
timeToStart: 3
})
/*
Commands
*/
require('./commands/admin/admin')({ api })
require('./commands/player/player')({ api, copchase })
/*
Events
*/
require('./events/admin/admin')({ api })
require('./events/player/player')({ api, copchase })
} catch (error) {
console.log('Error!', error)
}
}
startServer()

View File

@ -0,0 +1,8 @@
const mongoose = require('mongoose')
const playerSchema = mongoose.Schema({
name: String,
password: String
})
module.exports = mongoose.model('Player', playerSchema)

View File

@ -0,0 +1,5 @@
const Player = require('./Player')
module.exports = {
Player
}

3341
packages/copchase/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
{
"name": "copchase",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"bcryptjs": "^2.4.3",
"install": "^0.13.0",
"mongoose": "^5.9.26",
"npm": "^6.14.7",
"or": "^0.2.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}