Есть здесь скриптеры на гта 5?

shuzaru

Потрачен
Автор темы
162
37
Если есть то посмотрите ИИ Правильно ли написал скрипт на полет.
function ShuSprint(source, args, rawCommand) -- Проверяем, является ли игрок оператором сервера if IsPlayerAceAllowed(source, "command") then -- Проверяем, является ли игрок в игре и находится ли он на земле local player = GetPlayerPed(source) if player ~= nil and player ~= -1 and not IsPedInAnyVehicle(player, false) and IsPedOnFoot(player) then -- Устанавливаем скорость бега в 1.5 раза больше стандартного значения SetRunSprintMultiplierForPlayer(source, 1.5) TriggerClientEvent('chat:addMessage', -1, { args = { '^4' .. GetPlayerName(source) .. '^7', 'активировал быстрый бег.' } }) else TriggerClientEvent('chat:message', source, 'Вы не можете активировать быстрый бег.') end else TriggerClientEvent('chat:message', source, 'У вас нет доступа к этой команде.') end end -- Задаем команду /shu, которая активирует быстрый бег RegisterCommand('shu', ShuSprint) -- Указываем префикс команды TriggerEvent('chat:addSuggestion', '/shu', 'Активировать быстрый бег', {})
 
  • Ха-ха
  • Эм
Реакции: YarikVL, Sadow и MLycoris

yano

Новичок
3
0
звучит и выглядит как шелуха полная, используй этот, бинды в самом начале

JavaScript:
const controlsIds = {
  F4: 0x73,
  W: 32,
  S: 33,
  A: 34,
  D: 35,
  LCtrl: 326,
  Shift: 21,
  Q: 44,
  E: 38,
};

global.fly = {
  flying: false,
  f: 2.0,
  w: 2.0,
  h: 2.0,
  point_distance: 1000,
};
global.gameplayCam = mp.cameras.new('gameplay');

let direction = null;
let coords = null;

function pointingAt(distance) {
  const farAway = new mp.Vector3(
    direction.x * distance + coords.x,
    direction.y * distance + coords.y,
    direction.z * distance + coords.z
  );

  const result = mp.raycasting.testPointToPoint(coords, farAway, [1, 16]);
  if (result === undefined) {
    return 'undefined';
  }
  return result;
}

mp.keys.bind(controlsIds.F4, false, function () {
  const controls = mp.game.controls;
  const fly = global.fly;
  direction = global.gameplayCam.getDirection();
  coords = global.gameplayCam.getCoord();

  fly.flying = !fly.flying;

  const player = mp.players.local;

  player.setInvincible(fly.flying);
  player.freezePosition(fly.flying);
  player.setAlpha(fly.flying ? 0 : 255);

  if (!fly.flying && !controls.isControlPressed(0, controlsIds.Space)) {
    const position = mp.players.local.position;
    position.z = mp.game.gameplay.getGroundZFor3dCoord(
      position.x,
      position.y,
      position.z,
      0.0,
      false
    );
    mp.players.local.setCoordsNoOffset(
      position.x,
      position.y,
      position.z,
      false,
      false,
      false
    );
  }

  mp.events.callRemote('invisible', fly.flying);
  mp.game.graphics.notify(
    fly.flying ? '~g~Полёт включен' : '~r~Полёт выключен'
  );
});

mp.events.add('render', () => {
  if (fly.flying) {
    const controls = mp.game.controls;
    const fly = global.fly;
    direction = global.gameplayCam.getDirection();
    coords = global.gameplayCam.getCoord();

    let updated = false;
    const position = mp.players.local.position;
    var speed;
    if (controls.isControlPressed(0, controlsIds.Shift)) speed = 1.0;
    else if (controls.isControlPressed(0, controlsIds.LCtrl)) speed = 0.02;
    else speed = 0.2;
    if (controls.isControlPressed(0, controlsIds.W)) {
      if (fly.f < 8.0) fly.f *= 1.025;
      position.x += direction.x * fly.f * speed;
      position.y += direction.y * fly.f * speed;
      position.z += direction.z * fly.f * speed;
      updated = true;
    } else if (controls.isControlPressed(0, controlsIds.S)) {
      if (fly.f < 8.0) fly.f *= 1.025;
      position.x -= direction.x * fly.f * speed;
      position.y -= direction.y * fly.f * speed;
      position.z -= direction.z * fly.f * speed;
      updated = true;
    } else fly.f = 2.0;
    if (controls.isControlPressed(0, controlsIds.A)) {
      if (fly.l < 8.0) fly.l *= 1.025;
      position.x += -direction.y * fly.l * speed;
      position.y += direction.x * fly.l * speed;
      updated = true;
    } else if (controls.isControlPressed(0, controlsIds.D)) {
      if (fly.l < 8.0) fly.l *= 1.05;
      position.x -= -direction.y * fly.l * speed;
      position.y -= direction.x * fly.l * speed;
      updated = true;
    } else fly.l = 2.0;
    if (controls.isControlPressed(0, controlsIds.E)) {
      if (fly.h < 8.0) fly.h *= 1.025;
      position.z += fly.h * speed;
      updated = true;
    } else if (controls.isControlPressed(0, controlsIds.Q)) {
      if (fly.h < 8.0) fly.h *= 1.05;
      position.z -= fly.h * speed;
      updated = true;
    } else fly.h = 2.0;
    if (updated)
      mp.players.local.setCoordsNoOffset(
        position.x,
        position.y,
        position.z,
        false,
        false,
        false
      );
  }
});

mp.events.add('getCamCoords', (name) => {
  mp.events.callRemote(
    'saveCamCoords',
    JSON.stringify(coords),
    JSON.stringify(pointingAt(fly.point_distance)),
    name
  );
});
 

shuzaru

Потрачен
Автор темы
162
37
звучит и выглядит как шелуха полная, используй этот, бинды в самом начале

JavaScript:
const controlsIds = {
  F4: 0x73,
  W: 32,
  S: 33,
  A: 34,
  D: 35,
  LCtrl: 326,
  Shift: 21,
  Q: 44,
  E: 38,
};

global.fly = {
  flying: false,
  f: 2.0,
  w: 2.0,
  h: 2.0,
  point_distance: 1000,
};
global.gameplayCam = mp.cameras.new('gameplay');

let direction = null;
let coords = null;

function pointingAt(distance) {
  const farAway = new mp.Vector3(
    direction.x * distance + coords.x,
    direction.y * distance + coords.y,
    direction.z * distance + coords.z
  );

  const result = mp.raycasting.testPointToPoint(coords, farAway, [1, 16]);
  if (result === undefined) {
    return 'undefined';
  }
  return result;
}

mp.keys.bind(controlsIds.F4, false, function () {
  const controls = mp.game.controls;
  const fly = global.fly;
  direction = global.gameplayCam.getDirection();
  coords = global.gameplayCam.getCoord();

  fly.flying = !fly.flying;

  const player = mp.players.local;

  player.setInvincible(fly.flying);
  player.freezePosition(fly.flying);
  player.setAlpha(fly.flying ? 0 : 255);

  if (!fly.flying && !controls.isControlPressed(0, controlsIds.Space)) {
    const position = mp.players.local.position;
    position.z = mp.game.gameplay.getGroundZFor3dCoord(
      position.x,
      position.y,
      position.z,
      0.0,
      false
    );
    mp.players.local.setCoordsNoOffset(
      position.x,
      position.y,
      position.z,
      false,
      false,
      false
    );
  }

  mp.events.callRemote('invisible', fly.flying);
  mp.game.graphics.notify(
    fly.flying ? '~g~Полёт включен' : '~r~Полёт выключен'
  );
});

mp.events.add('render', () => {
  if (fly.flying) {
    const controls = mp.game.controls;
    const fly = global.fly;
    direction = global.gameplayCam.getDirection();
    coords = global.gameplayCam.getCoord();

    let updated = false;
    const position = mp.players.local.position;
    var speed;
    if (controls.isControlPressed(0, controlsIds.Shift)) speed = 1.0;
    else if (controls.isControlPressed(0, controlsIds.LCtrl)) speed = 0.02;
    else speed = 0.2;
    if (controls.isControlPressed(0, controlsIds.W)) {
      if (fly.f < 8.0) fly.f *= 1.025;
      position.x += direction.x * fly.f * speed;
      position.y += direction.y * fly.f * speed;
      position.z += direction.z * fly.f * speed;
      updated = true;
    } else if (controls.isControlPressed(0, controlsIds.S)) {
      if (fly.f < 8.0) fly.f *= 1.025;
      position.x -= direction.x * fly.f * speed;
      position.y -= direction.y * fly.f * speed;
      position.z -= direction.z * fly.f * speed;
      updated = true;
    } else fly.f = 2.0;
    if (controls.isControlPressed(0, controlsIds.A)) {
      if (fly.l < 8.0) fly.l *= 1.025;
      position.x += -direction.y * fly.l * speed;
      position.y += direction.x * fly.l * speed;
      updated = true;
    } else if (controls.isControlPressed(0, controlsIds.D)) {
      if (fly.l < 8.0) fly.l *= 1.05;
      position.x -= -direction.y * fly.l * speed;
      position.y -= direction.x * fly.l * speed;
      updated = true;
    } else fly.l = 2.0;
    if (controls.isControlPressed(0, controlsIds.E)) {
      if (fly.h < 8.0) fly.h *= 1.025;
      position.z += fly.h * speed;
      updated = true;
    } else if (controls.isControlPressed(0, controlsIds.Q)) {
      if (fly.h < 8.0) fly.h *= 1.05;
      position.z -= fly.h * speed;
      updated = true;
    } else fly.h = 2.0;
    if (updated)
      mp.players.local.setCoordsNoOffset(
        position.x,
        position.y,
        position.z,
        false,
        false,
        false
      );
  }
});

mp.events.add('getCamCoords', (name) => {
  mp.events.callRemote(
    'saveCamCoords',
    JSON.stringify(coords),
    JSON.stringify(pointingAt(fly.point_distance)),
    name
  );
});
спасибо
 

YarikVL

Известный
Проверенный
4,798
1,814
Мог бы сам ответить что ИИ никогда не напишет полностью рабочий скрипт.

То что скинул первый комментатор - выглядит убедительнее, но мне казалось, что код бота на полет должен быть больше🤔
 

yano

Новичок
3
0
Мог бы сам ответить что ИИ никогда не напишет полностью рабочий скрипт.

То что скинул первый комментатор - выглядит убедительнее, но мне казалось, что код бота на полет должен быть больше🤔
он работает, но это обычный полет в невидимке, а атм я допиливать буду (делаю всю админку) которая получает координаты земли и при выключении полета появлялся на земле, а не в воздухе