Arizona Нужна помощь со скриптом по удалению транспорта

Статус
В этой теме нельзя размещать новые ответы.

Oleg1337228

Участник
Автор темы
348
17
Версия SA-MP
  1. CR-MP 0.3.7
Приветствую, прошу пожалуйста скинуть скрипт который по команде удаляет весь транспорт для меня но кроме того в котором я сижу, либо кто разбирается переделайте пожалуйста этот скрипт который я скинул.
 

Вложения

  • HideCars.lua
    995 байт · Просмотры: 2
Решение
Lua:
script_name('HideCars')
script_author('xSpiridon')

local sampev = require('samp.events')
local BitStreamIO = require('samp.events.bitstream_io')

local toggle = false

function main()
  if not isSampLoaded() or not isSampfuncsLoaded() then return end
  while not isSampAvailable() do wait(2000) end

  sampRegisterChatCommand('hidecars', hideAllVehicles)
  wait(-1)
end

function sampev.onVehicleStreamIn()
  if toggle then
    return false
  end
end

function hideAllVehicles()
  toggle = not toggle
  if toggle then
    sampAddChatMessage('[HideCars] {FFFFFF}Activated.', 0xFF3F33)
    local vehicles = getAllVehicles()
    for _, veh in pairs(vehicles) do
      local exist, vehId = sampGetVehicleIdByCarHandle(veh)
      if exist and veh ~= 1...

kyrtion

Известный
1,057
380
Lua:
script_name('HideCars')
script_author('xSpiridon')

local sampev = require('samp.events')
local BitStreamIO = require('samp.events.bitstream_io')

local toggle = false

function main()
  if not isSampLoaded() or not isSampfuncsLoaded() then return end
  while not isSampAvailable() do wait(2000) end

  sampRegisterChatCommand('hidecars', hideAllVehicles)
  wait(-1)
end

function sampev.onVehicleStreamIn()
  if toggle then
    return false
  end
end

function hideAllVehicles()
  toggle = not toggle
  if toggle then
    sampAddChatMessage('[HideCars] {FFFFFF}Activated.', 0xFF3F33)
    local vehicles = getAllVehicles()
    for _, veh in pairs(vehicles) do
      local exist, vehId = sampGetVehicleIdByCarHandle(veh)
      if exist and veh ~= 1 and not isCharInCar(PLAYER_PED, veh) then
        hideCar(vehId)
      end
    end
  else
    sampAddChatMessage('[HideCars] {FFFFFF}Deactivated.', 0xFF3F33)
  end
end

function hideCar(id)
  local bs_write = BitStreamIO.bs_write
  local bs = raknetNewBitStream()
  bs_write.int16(bs, id)
  raknetEmulRpcReceiveBitStream(165, bs)
end
Немного рефакторил чтобы ты понял
Ответ в конце поста
 

Oleg1337228

Участник
Автор темы
348
17
Lua:
script_name('HideCars')
script_author('xSpiridon')

local sampev = require('samp.events')
local BitStreamIO = require('samp.events.bitstream_io')

local toggle = false

function main()
  if not isSampLoaded() or not isSampfuncsLoaded() then return end
  while not isSampAvailable() do wait(2000) end

  sampRegisterChatCommand('hidecars', hideAllVehicles)
  wait(-1)
end

function sampev.onVehicleStreamIn()
  if toggle then
    return false
  end
end

function hideAllVehicles()
  toggle = not toggle
  if toggle then
    sampAddChatMessage('[HideCars] {FFFFFF}Activated.', 0xFF3F33)
    local vehicles = getAllVehicles()
    for _, veh in pairs(vehicles) do
      local exist, vehId = sampGetVehicleIdByCarHandle(veh)
      if exist and veh ~= 1 and not isCharInCar(PLAYER_PED, veh) then
        hideCar(vehId)
      end
    end
  else
    sampAddChatMessage('[HideCars] {FFFFFF}Deactivated.', 0xFF3F33)
  end
end

function hideCar(id)
  local bs_write = BitStreamIO.bs_write
  local bs = raknetNewBitStream()
  bs_write.int16(bs, id)
  raknetEmulRpcReceiveBitStream(165, bs)
end
Немного рефакторил чтобы ты понял
Ответ в конце поста
Спасибо чекну. Что рефакторил чтобы я понял, я не пишу скрипты не разбираюсь?
 
Статус
В этой теме нельзя размещать новые ответы.