kuzin1998q Posted February 15, 2019 Posted February 15, 2019 Здравствуйте. Ни как не получается разобраться с системой домов, скачал готовый сервер, и столкнулся с командой создания дома, а именно: /addhouse [rare] [coast] [interior] [garage] [max_cars]. Не где информации по этому поводу не нашёл. Может кто подскажет?
TheRetr0Doc Posted February 15, 2019 Posted February 15, 2019 Как бы существует переводчик голое можно перевести команду. /addhouse [частый дом?] [цена] [ид интерьера дома] [есть ли гараж] [максимальное количество машин доступное у дома]
#YokoKimura Posted February 16, 2019 Posted February 16, 2019 Может стоит скинуть сюда кусок кода отвечающий за создание дома, и, возможно, тогда тебе помогут? 😬 1
kuzin1998q Posted February 16, 2019 Author Posted February 16, 2019 Цитата Если надо, то держите. "addhouse": (player, args) => { if(player.customData.admin < 6) return player.call("alert", "error" , "У Вас недостаточно полномочий"); if (isNaN(parseInt(rare = args[1])) || isNaN(parseInt(coast = args[2])) || isNaN(interior = parseInt(args[3])) || isNaN(parseInt(garage = args[4])) || isNaN(max_cars = parseInt(args[5]))) return player.call("alert", "error" , "Используйте: /addhouse [rare] [coast] [interior] [garage] [max_cars]"); if(parseInt(rare) >= 0 && parseInt(coast) >= 0 && parseInt(interior) >= 0 && parseInt(garage) >= 0 && max_cars >= 1) { let get_id = 0; let get_count = 0; mysql.connection.query('SELECT COUNT(*) AS count FROM houses', [], function (error, results, fields) { get_count = results[0].count; let array_max_cars = new Array(parseInt(max_cars)); let array_gen = {x: 'NONE', y: 'NONE', z: 'NONE'}; for(let i = 0; i < max_cars; i++) { array_max_cars = array_gen; } let max_cars_pos = JSON.stringify(array_max_cars); var query = mysql.connection.query('INSERT INTO houses SET pos_x = ?, pos_y = ?, pos_z = ?, pos_heading = ?, rare = ?, coast = ?, interior = ?, garage = ?, garage_enter_pos_x = ?, garage_enter_pos_y = ?, garage_enter_pos_z = ?, garage_enter_pos_r = ?, max_cars_count = ?, max_cars_pos = ?', [player.position.x, player.position.y, player.position.z, player.heading, rare, coast, interior, garage, 0, 0, 0, 0, max_cars, max_cars_pos], function (error, results, fields) { console.log(error); }); configure.housesblips[get_count] = mp.blips.new(40, new mp.Vector3(parseFloat(player.position.x), parseFloat(player.position.y), parseFloat(player.position.z)), { name: "Дом", scale: 1, color: 2, drawDistance: 100, shortRange: 100, rotation: 0, dimension: 0, }); configure.housesmarkers[get_count] = mp.markers.new(0, new mp.Vector3(parseFloat(player.position.x), parseFloat(player.position.y), parseFloat(player.position.z)), 1, { direction: new mp.Vector3(0,0,0), rotation: new mp.Vector3(0,0,0), visible: true, dimension: 0 }); configure.housesmarkers[get_count].setColor(255, 247, 0, 255); configure.housescolshapes[get_count] = mp.colshapes.newRectangle(player.position.x, player.position.y, 1, 1); configure.housesnumber[get_count] = get_count; configure.housestate[get_count] = 0; configure.housesrare[get_count] = parseInt(rare); configure.housesowner[get_count] = "NONE"; configure.housescoast[get_count] = parseInt(coast); configure.housesinterior[get_count] = parseInt(interior); configure.housesgarage[get_count] = parseInt(garage); player.call("alert", "success", "Дом установлен!"); if(parseInt(garage) >= 1) { player.call("alert", "information", "Для установки точки выезда/въезда в гараж используйте: /setgarage"); } //logger.write("[" + namepos + "]: " + "X: " + get_pos.x + "; Y: " + get_pos.y + "; Z: " + get_pos.z + ";"); }); } else { player.call("alert", "error", "Для установки дома, необходимо выбрать следующее параметры:"); player.call("alert", "error", "Классы домов: 0 [H], 1 [M], 2 [R], 3 [A]"); player.call("alert", "information", "[/addhouse]: [rare] [coast] [interior] [garage] [max_cars]"); } },
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now