Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script_name('LaniTheft')
- script_version('1')
- script_properties('work-in-pause')
- local script = 'lanitheft'
- local data = {
- ['breakcar'] = true;
- ['active'] = true;
- ['chat'] = true;
- ['findugon'] = true;
- ['ugon'] = true;
- ['iszlata'] = true;
- ['carslist'] = {};
- ['markerslist'] = {}
- }
- local as_action = require('moonloader').audiostream_state
- local memory = require 'memory'
- local ffi = require 'ffi'
- local sampev = require 'lib.samp.events'
- local dlstatus = require('moonloader').download_status
- --~ local limgui, imgui = pcall(require, 'imgui')
- local bNotf, notf = pcall(import, "lanisoft/imgui_notf.lua")
- function main()
- if not isSampLoaded() and not isSampfuncsLoaded() then return end
- while not isSampAvailable() do wait(0) end
- --~ if not data['activation'] then checkactive() end
- if not doesDirectoryExist('moonloader/lanisoft') then createDirectory('moonloader/lanisoft') end
- if not doesDirectoryExist('moonloader/lanisoft/sounds') then createDirectory('moonloader/lanisoft/sounds') end
- if not doesFileExist('moonloader/lanisoft/imgui_notf.lua') then
- wait(500)
- download_id = downloadUrlToFile( 'https://lanisoft.ru/mysql/imgui_notf.lua', 'moonloader/lanisoft/imgui_notf.lua', download_handler)
- wait(1500)
- thisScript():reload()
- end
- wait(200)
- getSoundStatus()
- while not musiccomplete do wait(0) end
- commandsRegistration()
- while true do wait(200)
- while data['carslist'] == nil do wait(0) end
- local vehicles = getAllVehicles()
- for _, h in pairs(vehicles) do
- local car = getCarModel(h)
- if car then
- pedincar = getDriverOfCar(h)
- end
- if data['carslist'][car] and pedincar ~= playerPed then
- lua_thread.create(function()
- local _, carid = sampGetVehicleIdByCarHandle(h)
- local carplates = sampGetLicensePlateText(carid)
- if carplates == '-' or carplates:match('^([A-Z]%d%d%d[A-Z][A-Z])$') then
- data['carslist'][car] = false
- data['markerslist'][car] = addBlipForCar(h)
- changeBlipColour(data['markerslist'][car], 0x99FFCCBB)
- if not data['chat'] then
- MSG(1, 'Найден транспорт: ' .. objectCars[tostring(car)].name .. '\n\nНад транспортом поставлен маркер, на карте - метка. Введите /findcar чтобы убрать маркер/метку', 5, 'blat')
- elseif data['chat'] then
- MSG(1, 'Найден транспорт: ' .. objectCars[tostring(car)].name, 5, 'blat')
- MSG(2, 'Над транспортом поставлен маркер, на карте - метка. Введите /findcar чтобы убрать маркер/метку', 5, 'notif')
- end
- while data['carslist'][car] == false do wait(0)
- if isCharInAnyCar(PLAYER_PED) and storeCarCharIsInNoSave(PLAYER_PED) == h then
- removeBlip(data['markerslist'][car])
- data['markerslist'][car] = nil
- while isCharInAnyCar(PLAYER_PED) do wait(0) end
- data['carslist'][car] = true
- end
- if not doesVehicleExist(h) then
- data['markerslist'][car] = nil
- data['carslist'][car] = true
- end
- end
- end
- end)
- end
- end
- end
- end
- function commandsRegistration()
- sampRegisterChatCommand(script, function()
- if not data['active'] then checkactive()
- elseif data['active'] then
- MSG(2, 'Вы выключили ' ..thisScript().name, 5, 'kapec')
- data['active'] = false
- end
- end)
- sampRegisterChatCommand(script.. '_active', function(arg)
- if not data['active'] then
- theft_active(arg)
- end
- end)
- sampRegisterChatCommand(script.. '_chat', function(arg)
- if not data['active'] then MSG(3, 'Вы не авторизованы. Для активации скрипта введите \n/' ..script.. '_active <ключ>', 3, 'kapec') return end
- data['chat'] = not data['chat']
- MSG(2, 'Вы '..(data['chat'] and 'включили' or 'выключили')..' отображение сообщений в чате', 4, (data['chat'] and 'horosho' or 'ogo'))
- end)
- sampRegisterChatCommand('findcar', function(arg)
- if not data['active'] then MSG(3, 'Вы не авторизованы. Для активации скрипта введите \n/' ..script.. '_active <ключ>', 3, 'kapec') return end
- findcar(arg)
- end)
- sampRegisterChatCommand('findugon', function()
- if not data['active'] then MSG(3, 'Вы не авторизованы. Для активации скрипта введите \n/' ..script.. '_active <ключ>', 3, 'kapec') return end
- data['findugon'] = true
- sampSendChat('/theft')
- end)
- sampRegisterChatCommand('ugon', function()
- if not data['active'] then MSG(3, 'Вы не авторизованы. Для активации скрипта введите \n/' ..script.. '_active <ключ>', 3, 'kapec') return end
- data['ugon'] = true
- sampSendChat('/theft')
- end)
- sampRegisterChatCommand('breakcar', function()
- if not data['active'] then MSG(3, 'Вы не авторизованы. Для активации скрипта введите \n/' ..script.. '_active <ключ>', 3, 'blat') return end
- iscartut = false
- isallcar = false
- isarenda = false
- lua_thread.create(function()
- carhandle, _ = storeClosestEntities(playerPed)
- for key, value in pairs(objectCars) do
- carplatesvalid = false
- modelid = key
- if carhandle ~= -1 and carhandle ~= nil and carhandle ~= '' then
- isallcar = true
- carresult = isCarModel(carhandle, modelid)
- if carresult == true then
- _resu, carid = sampGetVehicleIdByCarHandle(carhandle)
- carplates = sampGetLicensePlateText(carid)
- if carplates ~= '' and carplates ~= nil then
- if carplates:match('^[A-Z]%d%d%d[A-Z][A-Z]$') then
- carplatesvalid = true
- end
- end
- if carplates ~= '' and carplates ~= nil and carplatesvalid and carplatesvalid ~= nil then
- carplatesvalid = true
- x1, y1, z1 = getCharCoordinates(playerPed)
- x2, y2, z2 = getCarCoordinates(carhandle)
- distance = getDistanceBetweenCoords3d(x1, y1, z1, x2, y2, z2)
- carname = value.name
- iscartut = true
- if distance < 3 then
- data['breakcar'] = true
- breakcarid = key
- sampSendChat('/device')
- else
- if not data['chat'] then
- MSG(3, 'Вы находитесь слишком далеко от \n' ..carname, 3, 'kapec')
- elseif data['chat'] then
- MSG(3, 'Вы находитесь слишком далеко от ' ..carname, 3, 'kapec')
- end
- end
- elseif carplates ~= '' and carplates ~= nil and carplates == '-' then
- carplatesvalid = true
- x1, y1, z1 = getCharCoordinates(playerPed)
- x2, y2, z2 = getCarCoordinates(carhandle)
- distance = getDistanceBetweenCoords3d(x1, y1, z1, x2, y2, z2)
- carname = value.name
- iscartut = true
- if distance < 3 then
- data['breakcar'] = true
- breakcarid = key
- sampSendChat('/device')
- else
- MSG(3, 'Вы находитесь слишком далеко от ' ..carname, 3, 'kapec')
- end
- elseif not carplatesvalid then
- MSG(3, 'Взлому подлежат только личные транспортные средства', 3, 'kapec')
- isarenda = true
- end
- end
- end
- end
- if not carplatesvalid then
- carisnotvalid = true
- end
- if not iscartut and carisnotvalid and isallcar and not isarenda then
- MSG(3, 'Это транспортное средство не подлежит взлому', 3, 'kapec')
- carisnotvalid = false
- end
- if not isallcar then
- MSG(3, 'Рядом с Вами нет транспорта', 3, 'kapec')
- end
- end)
- end)
- end
- --------------------------------------------------------------------------------------------------------------------------------------------
- function findcar(arg)
- local arg = arg:match('%s*(.+)')
- if arg ~= nil then
- data["carslist"] = {}
- for a, b in pairs(data["markerslist"]) do
- removeBlip(b)
- end
- data["markerslist"] = {}
- for line in arg:gmatch("[^%|]+") do
- if tonumber(line) ~= nil then
- local line = tonumber(line)
- if line >= 400 and line <= 611 then
- if objectCars[tostring(line)] ~= nil then
- table.insert(data["carslist"], line, true)
- else
- MSG(3, 'Транспорт ' ..line.. ' нельзя взломать, либо Вы неверно указали его название.', 3, 'kapec')
- end
- else
- MSG(3, 'ID транспорта не может быть меньше 400 и больше 611. Вы ввели: '.. line, 3, 'kapec')
- end
- else
- for i = 400, 612 do
- if i == 612 then MSG(3, 'Транспорт ' ..line.. ' нельзя взломать, либо Вы неверно указали его название.', 3, 'kapec') break end
- if objectCars[tostring(i)] ~= nil then
- if string.lower(objectCars[tostring(i)].name):find(string.lower(line)) then
- table.insert(data["carslist"], i, true)
- break
- end
- end
- end
- end
- end
- local carscount = 0
- for a, b in pairs(data["carslist"]) do
- carscount = carscount + 1
- end
- if carscount == 1 then
- for a, b in pairs(data["carslist"]) do
- local thiscarname = objectCars[tostring(a)].name
- MSG(2, 'Активирован поиск транспорта ' .. thiscarname .. '\n\nДля отключения поиска введите /findcar', 5, 'horosho')
- end
- elseif carscount > 1 then
- local lcarslist = ''
- for a, b in pairs(data["carslist"]) do
- lcarslist = objectCars[tostring(a)].name..', '.. lcarslist
- end
- MSG(2, 'Активирован поиск следующих транспортных средств:\n' .. lcarslist:match('(.*), $') .. '.\n\nДля отключения поиска введите /findcar', 5, 'horosho')
- end
- else
- local carscount = 0
- for a, b in pairs(data["carslist"]) do
- carscount = carscount + 1
- end
- if carscount == 0 then
- if data["chat"] then
- MSG(3, 'Используйте {cccccc}/findcar <ID/Название>', 5, 'kapec')
- elseif not data["chat"] then
- MSG(3, 'Используйте /findcar <ID/Название>', 3, 'kapec')
- end
- else
- data["carslist"] = {}
- for a, b in pairs(data["markerslist"]) do
- removeBlip(b)
- end
- data["markerslist"] = {}
- MSG(2, 'Поиск отменён', 3, 'kapec')
- end
- end
- end
- function getSoundStatus()
- local soundlist = {
- 'ban',
- 'blat',
- 'horosho',
- 'kapec',
- 'ogo',
- 'siren',
- 'notif'
- }
- for a, b in pairs(soundlist) do
- if not doesFileExist('moonloader/lanisoft/sounds/'.. b ..'.mp3') then
- sampAddChatMessage('• {00CC00}[Успешно] {ffffff}Загружаю необходимые звуки', -1)
- download_id = downloadUrlToFile( 'https://lanisoft.ru/mysql/' .. soundlist[1] .. '.mp3', 'moonloader/lanisoft/sounds/'.. soundlist[1] ..'.mp3', download_handler)
- download_id = downloadUrlToFile( 'https://lanisoft.ru/mysql/' .. soundlist[2] .. '.mp3', 'moonloader/lanisoft/sounds/'.. soundlist[2] ..'.mp3', download_handler)
- download_id = downloadUrlToFile( 'https://lanisoft.ru/mysql/' .. soundlist[3] .. '.mp3', 'moonloader/lanisoft/sounds/'.. soundlist[3] ..'.mp3', download_handler)
- download_id = downloadUrlToFile( 'https://lanisoft.ru/mysql/' .. soundlist[4] .. '.mp3', 'moonloader/lanisoft/sounds/'.. soundlist[4] ..'.mp3', download_handler)
- download_id = downloadUrlToFile( 'https://lanisoft.ru/mysql/' .. soundlist[5] .. '.mp3', 'moonloader/lanisoft/sounds/'.. soundlist[5] ..'.mp3', download_handler)
- download_id = downloadUrlToFile( 'https://lanisoft.ru/mysql/' .. soundlist[6] .. '.mp3', 'moonloader/lanisoft/sounds/'.. soundlist[6] ..'.mp3', download_handler)
- download_id = downloadUrlToFile( 'https://lanisoft.ru/mysql/' .. soundlist[7] .. '.mp3', 'moonloader/lanisoft/sounds/'.. soundlist[7] ..'.mp3', download_handler)
- break
- end
- end
- musiccomplete = true
- end
- function download_handler(id, status, p1, p2)
- if stop_downloading then
- stop_downloading = false
- download_id = nil
- print('Загрузка отменена.')
- return false -- прервать загрузку
- end
- if p1 > 1 and p2 == 0 then
- print("Превышено время ожидания конца загрузки.")
- elseif status == dlstatus.STATUS_DOWNLOADINGDATA then
- print(string.format('Загружено %d КБ из %d КБ.', p1, p2))
- elseif status == dlstatus.STATUS_ENDDOWNLOADDATA then
- print('Загрузка файла завершена.')
- end
- end
- function theft_active(arg)
- arg = arg:match('%s*(.+)')
- if arg ~= '' and arg ~= nil then
- math.randomseed(os.time())
- local fpath = math.random(50, 256) ^ 2
- ip, port = sampGetCurrentServerAddress()
- local surl = http_build_query({server = ip, win = getSerialNumber(), proc = getProcessorName(), script = script, pass = arg})
- downloadUrlToFile('https://lanisoft.ru/mysql/addaccess.php?'.. surl, os.getenv('TEMP') .. '\\'.. fpath ..'.txt', function(id, status, p1, p2) lua_thread.create(function()
- if status == dlstatus.STATUS_ENDDOWNLOADDATA then
- wait(50)
- local win = getSerialNumber()
- local f = io.open(os.getenv('TEMP') .. '\\'.. fpath ..'.txt', 'r')
- result = f:read('*a')
- if result then
- if result == 'error' then
- MSG(3, 'Ключ ' ..arg .. ' не существует', 3, 'blat')
- elseif result == 'okey' then
- MSG(1, 'Вы активировали ' ..thisScript().name, 3, 'blat')
- checkactive()
- elseif result == 'errorkey' then
- MSG(3, 'Ключ ' ..arg .. ' не существует', 3, 'blat')
- end
- f:close()
- else
- MSG(2, 'Произошла ошибка.', 3, 'blat')
- end
- os.remove(fpath)
- end
- end)
- end)
- end
- end
- --------------------------------------------------------------------------------------------------------------------------------------------
- function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
- if data['ugon'] then
- if title:find('Угон автомобилей$') then
- data['ugon'] = false
- carstring = 'Текущий транспорт:\n'
- for linetext in text:gmatch('[^\r\n]+') do
- carexist = 0
- if not linetext:find('Расположение') then
- theftcarname, theftcartime1, theftcartime2 = linetext:match('(.*)%s+(%d+)%:(%d+).*')
- theftcartime = theftcartime1.. ':' ..theftcartime2
- for key, value in pairs(objectCars) do
- if value.name == theftcarname then
- theftcarmodelid = key
- theftcarprice = tonumber(value.price)
- theftcarclass = tonumber(value.class)
- if theftcarclass == 1 then
- rate = 5000
- percent = 0.025
- carclass = 'Эконом класс'
- elseif theftcarclass == 2 then
- rate = 25000
- percent = 0.0125
- carclass = 'Средний класс'
- elseif theftcarclass == 3 then
- rate = 50000
- percent = 0.005
- carclass = 'Спорт класс'
- elseif theftcarclass == 4 then
- rate = 50000
- percent = 0.005
- carclass = 'Мотоцикл'
- end
- money = rate + (theftcarprice * percent)
- money = math.floor(money)
- carstring = carstring.. '\n' ..carclass.. ' • ' ..theftcarname.. '\nВремя: ' ..theftcartime.. '\nГос. цена: ' ..theftcarprice.. '$\nНаграда: ' ..money.. '$\n'
- if data['chat'] then
- MSG(2, carclass.. ' • ' ..theftcarname.. ' • Время: ' ..theftcartime.. ' • Гос. цена: ' ..theftcarprice.. '$ • Награда: ' ..money.. '$', 8, 'blat')
- end
- end
- end
- end
- end
- if not data['chat'] then
- MSG(2, carstring, 8, 'blat')
- end
- sampSendDialogResponse(dialogId, 1, 0, '')
- return false
- end
- end
- if data['findugon'] then
- if title:find('Угон автомобилей$') then
- local c2list = {}
- for linetext in text:gmatch('[^\r\n]+') do
- if not linetext:find('Расположение') then
- local theftcarname, theftcartime1, theftcartime2 = linetext:match('(.*)%s+(%d+)%:(%d+).*')
- for i = 400, 612 do
- if i == 612 then MSG(3, 'Транспорт ' ..theftcarname.. ' нельзя взломать.', 3, 'kapec') break end
- if objectCars[tostring(i)] ~= nil then
- if string.lower(objectCars[tostring(i)].name) == string.lower(theftcarname) then
- table.insert(data['carslist'], i, true)
- table.insert(c2list, i)
- break
- end
- end
- end
- end
- end
- local carltext = ''
- for _, h in pairs(c2list) do
- carltext = objectCars[tostring(h)].name.. ', '.. carltext
- end
- if not data['chat'] then
- MSG(2, 'Активирован поиск транспорта:\n' ..carltext:match('(.*), $') .. '.\n\nДля отключения поиска введите /findcar', 5, 'horosho')
- elseif data['chat'] then
- MSG(2, 'Активирован поиск транспорта. ' ..carltext:match('(.*), $') .. '.\n\nДля отключения поиска введите /findcar', 5, 'horosho')
- MSG(2, ' {ffc900}• {ffffff}' ..carltext:match('(.*), $'), 5, 'horosho')
- MSG(2, 'Для отключения поиска введите /findcar', 5, 'horosho')
- end
- sampSendDialogResponse(dialogId, 1, 0, nil)
- data['findugon'] = false
- return false
- end
- end
- if data['breakcar'] then
- if title:find('Оборудование$') then
- linenum = -1
- drillishere = 0
- for linetext in text:gmatch('[^\r\n]+') do
- linenum = linenum + 1
- if linetext:find('Дрель') then
- drillishere = 1
- sampSendDialogResponse(dialogId, 1, linenum, '')
- end
- end
- if drillishere == 0 then
- MSG(3, 'У Вас нет инструмента Дрель. Приобретите его в магазине радиоигрушек.', 5, 'kapec')
- end
- return false
- end
- end
- end
- function sampev.onShowTextDraw(idtd, infotd)
- if data['breakcar'] then
- if infotd.text == 'Drilling the door' and objectCars ~= nil then drilltdid = idtd lua_thread.create(clickalltd) end
- end
- end
- function clickalltd()
- if data['breakcar'] then
- data['breakcar'] = false
- wait(200)
- local drillcount = drilltdid + 65
- MSG(2, 'Начинаем процесс взлома ' ..carname, 3, 'blat')
- for key, value in pairs(objectCars[breakcarid].scheme) do
- for i = 1, value do
- sampSendClickTextdraw(drillcount)
- wait(10)
- end
- drillcount = drillcount + 2
- end
- drilling = drilltdid + 4
- sampSendClickTextdraw(drilling)
- end
- end
- function checkactive()
- math.randomseed(os.time())
- local fpath = math.random(50, 256) ^ 2
- local fpath = os.getenv('TEMP') .. '\\'.. fpath ..'.txt'
- local ip = sampGetCurrentServerAddress()
- local surl = http_build_query({server = ip, win = getSerialNumber(), proc = getProcessorName(), script = script})
- downloadUrlToFile('https://lanisoft.ru/mysql/checkaccess.php?'.. surl, fpath, function(id, status, p1, p2) lua_thread.create(function()
- if status == dlstatus.STATUS_ENDDOWNLOADDATA then
- wait(50)
- local f = io.open(fpath, 'r')
- if f then
- local result = f:read('*a')
- if result == 'error' then
- MSG(3, 'Вы не были авторизованы в ' ..thisScript().name, 3, 'kapec')
- data['active'] = false
- elseif result:find('Bullet') then
- MSG(1, 'Вы были авторизованы в ' ..thisScript().name, 3, 'ban')
- data['active'] = true
- objectCars = decodeJson(result)
- lua_thread.create(checkbuild)
- else
- MSG(3, 'Произошла ошибка', 3, 'kapec')
- data['active'] = false
- end
- f:close()
- else
- MSG(2, 'Произошла ошибка', 3, 'kapec')
- data['active'] = false
- end
- os.remove(fpath)
- end
- end)
- end)
- end
- function checkbuild()
- math.randomseed(os.time())
- local fpath = math.random(50, 256) ^ 2
- local fpath = os.getenv('TEMP') .. '\\'.. fpath ..'.txt'
- local surl = http_build_query({script = script})
- downloadUrlToFile('https://lanisoft.ru/mysql/checkbuild.php?' ..surl, fpath, function(id, status, p1, p2) lua_thread.create(function()
- if status == dlstatus.STATUS_ENDDOWNLOADDATA then
- wait(50)
- local f = io.open(fpath, 'r')
- result = f:read('*a')
- if result then
- if tonumber(thisScript().version) > tonumber(result) then
- MSG(2, 'Вы используете тестовую версию ' ..thisScript().name, 3, 'notif')
- elseif tonumber(thisScript().version) == tonumber(result) then
- MSG(2, 'Вы используете актуальную версию ' ..thisScript().name, 3, 'notif')
- elseif tonumber(thisScript().version) < tonumber(result) then
- MSG(2, 'Найдено обновление. Загружаем...', 3, 'blat')
- downloadUrlToFile('https://lanisoft.ru/softs/' ..script.. '.luac', thisScript().path, function(id, status, p1, p2)
- if status == dlstatus.STATUS_ENDDOWNLOADDATA then
- os.remove(fpath)
- MSG(1, 'Загрузка обновления ' ..thisScript().name.. ' {ffffff}завершена', 3, 'notif')
- thisScript():reload()
- end
- end)
- end
- else
- MSG(2, 'При проверке обновлений возникла ошибка', 3, 'kapec')
- end
- os.remove(fpath)
- end
- end)
- end)
- end
- function MSG(typetext, text, sec, typemsg)
- lua_thread.create(function()
- if not data['chat'] and bNotf then
- notf.addNotification(thisScript().name.. '\n\n' ..text, sec, typetext)
- Audio = loadAudioStream("moonloader/lanisoft/sounds/" ..typemsg.. ".mp3")
- setAudioStreamVolume(Audio, 100)
- if data['iszlata'] then
- data['iszlata'] = false
- setAudioStreamState(Audio, as_action.PLAY)
- wait(2000)
- data['iszlata'] = true
- end
- elseif data['chat'] then
- if typetext == 1 then
- prefix = '• {00CC00}[Успешно] {ffffff}'
- end
- if typetext == 3 then
- prefix = '• {AC0000}[Ошибка] {FFFFFF}'
- end
- if typetext == 2 then
- prefix = '• {FFC800}[LaniTheft] {ffffff}'
- end
- text = string.gsub(text, '\n\n', '\n')
- text = string.gsub(text, '\n', '. ')
- sampAddChatMessage(prefix.. '' ..text, -1)
- Audio = loadAudioStream("moonloader/lanisoft/sounds/" ..typemsg.. ".mp3")
- setAudioStreamVolume(Audio, 100)
- if data['iszlata'] then
- data['iszlata'] = false
- setAudioStreamState(Audio, as_action.PLAY)
- wait(2000)
- data['iszlata'] = true
- end
- end
- end)
- end
- --------------------------------------------------------------------------------------------------------------------------------------------
- function http_build_query(query)
- local function char_to_hex(str)
- return string.format("%%%02X", string.byte(str))
- end
- local function url_encode(str)
- local str = string.gsub(str, "\\", "\\")
- local str = string.gsub(str, "([^%w])", char_to_hex)
- return str
- end
- local buff=""
- for k, v in pairs(query) do
- buff = buff.. string.format("%s=%s&", k, url_encode(v))
- end
- local buff = string.reverse(string.gsub(string.reverse(buff), "&", "", 1))
- return buff
- end
- function getProcessorName_code(n)
- local ffi = require("ffi")
- local qwords = ffi.typeof("uint64_t[?]")
- local dwords = ffi.typeof("uint32_t *")
- local cpuid_EAX_EDX = ffi.cast("__cdecl uint64_t (*)(uint32_t)", "\x53\x0F\xA2\x5B\xC3")
- local cpuid_EBX_ECX = ffi.cast("__cdecl uint64_t (*)(uint32_t)", "\x53\x0F\xA2\x91\x92\x93\x5B\xC3")
- local arr = ffi.cast(dwords, qwords(2, cpuid_EAX_EDX(n), cpuid_EBX_ECX(n)))
- return ffi.string(arr, 4), ffi.string(arr + 2, 4), ffi.string(arr + 3, 4), ffi.string(arr + 1, 4)
- end
- function getProcessorName()
- local s1 = ""
- for n = 0x80000002, 0x80000004 do
- local eax, ebx, ecx, edx = getProcessorName_code(n)
- s1 = s1..eax..ebx..ecx..edx
- end
- s1 = s1:gsub("^%s+", ""):gsub("%z+$", "")
- return s1
- end
- function getSerialNumber()
- local ffi = require("ffi")
- ffi.cdef
- [[
- int __stdcall GetVolumeInformationA(
- const char* lpRootPathName,
- char* lpVolumeNameBuffer,
- uint32_t nVolumeNameSize,
- uint32_t* lpVolumeSerialNumber,
- uint32_t* lpMaximumComponentLength,
- uint32_t* lpFileSystemFlags,
- char* lpFileSystemNameBuffer,
- uint32_t nFileSystemNameSize
- );
- ]]
- local serial = ffi.new("unsigned long[1]", 0)
- ffi.C.GetVolumeInformationA("c:\\", nil, 0, serial, nil, nil, nil, 0)
- return serial[0]
- end
- function sampSetLicensePlateText(id, text)
- local vehpool = sampGetVehiclePoolPtr()
- if memory.getuint8(vehpool + 0x3074 + id * 4) == 1 then
- local this = ffi.cast('void*', memory.getuint32(vehpool + 0x1134 + id * 4))
- ffi.cast('void(__thiscall*)(void*this, const char* text)', sampGetBase() + 0xB1BF0)(this, ffi.cast('char*', text))
- end
- end
- function sampGetLicensePlateText(id)
- local vehpool = sampGetVehiclePoolPtr()
- if memory.getuint8(vehpool + 0x3074 + id * 4) == 1 then
- local this = memory.getuint32(vehpool + 0x1134 + id * 4)
- return memory.tostring(this + 0x93)
- end
- end
- function onScriptTerminate(script)
- if script == thisScript() then
- for a, b in pairs(data['markerslist']) do
- removeBlip(b)
- end
- end
- end
Add Comment
Please, Sign In to add comment