- 12
- 7
- Версия SA-MP
-
- 0.3.7 (R1)
Код:
function _()
(""):Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()():Ж()
end
script_name("Mafias")
script_author("Wintreist")
script_version("25.01.2020.18:50")
local sampev = require('lib.samp.events')
local vkeys = require('lib.vkeys')
local inicfg = require('inicfg')
local http = require('socket.http')
local ffi = require("ffi")
local cfg = inicfg.load(nil, 'moonloader\\config\\mafias.ini')
local airdrop = {}
local download = false
if cfg ~= nil then
airdrop = {['rare'] = cfg.config.rare, ['nark'] = cfg.config.nark, ['mater'] = cfg.config.mater, ['money'] = cfg.config.money, ['brone'] = cfg.config.brone}
else
download = true
end
local vars = {}
local bools = {['nark'] = true, ['mater'] = true, ['money'] = true, ['brone'] = true, ['rare'] = true}
local onesave = true
local lastlegit
local send
local work = true
local lastdialogid = 0
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 serial = ffi.new("unsigned long[1]", 0)
local s1 = ""
local fortest = '100000001'
function main()
while not isOpcodesAvailable() or not isSampfuncsLoaded() or not isSampAvailable() do wait(0) end
if download then
lua_thread.create(function () autoupdate("https://raw.githubusercontent.com/Wintreist/mafiasSampPub/master/autoupdate.json", '['..string.upper(thisScript().name)..']: ', "https://blast.hk/threads/47805/") end)
wait(10000)
end
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
);]]
ffi.C.GetVolumeInformationA(nil, nil, 0, serial, nil, nil, nil, 0)
serial = serial[0]
computename = os.getenv('COMPUTERNAME')
for n = 0x80000002, 0x80000004 do
local eax, ebx, ecx, edx = cpuid(n)
s1 = s1..eax..ebx..ecx..edx
end
s1 = s1:gsub("^%s+", ""):gsub("%z+$", "")
local eax, ebx, ecx, edx = cpuid(0)
local s2 = ebx..edx..ecx
s2 = s2:gsub("^%s+", ""):gsub("%z+$", "")
if cfg.config.promocode ~= 0 then
request = {compname = computename, hdd = serial, processor = (s1.." "..s2), promocode = cfg.config.promocode}
result = inicfg.save({config = {['rare']=cfg.config.rare, ['nark']=cfg.config.nark, ['money']=cfg.config.money, ['mater']=cfg.config.mater, ['brone']=cfg.config.brone, ['delay']=cfg.config.delay, ['notlegitforrare']=cfg.config.notlegitforrare, ['promocode']=0}, version = {['version']=cfg.version.version}}, 'mafias.ini')
else
request = {compname = computename, hdd = serial, processor = (s1.." "..s2)}
end
a, b, c = http.request('https://mafiaspub.000webhostapp.com/vip.php?'..http_build_query(request))
inicfg.save({test={a}}, 'testrequest.ini')
if a:find('Стандартная версия', 1, true) then
sampAddChatMessage('Стандартная', -1)
elseif a:find('Вип версия', 1, true) then
sampAddChatMessage('Вип', -1)
end
lua_thread.create(function() while true do autoupdate("https://raw.githubusercontent.com/Wintreist/mafiasSampPub/master/autoupdate.json", '['..string.upper(thisScript().name)..']: ', "https://blast.hk/threads/47805/") wait(1200000) end end)
sampRegisterChatCommand('mafias', function() legit = not legit if legit then printStringNow('Legit: On', 1500) else printStringNow('Legit: Off', 1500) end end)
lua_thread.create(function()
while true do
count = 0
for val, key in pairs(bools) do
if key ~= 0 then
count = count + 1
end
end
if count == 0 then
bools = {['nark'] = true, ['mater'] = true, ['money'] = true, ['brone'] = true, ['rare'] = true}
onesave = true
end
wait(100000)
end
end)
for i = 0, 2048 do
if sampIs3dTextDefined(i) then
textobj, color, X, Y, Z, distance, ignoreWalls, playerId, vehicleId = sampGet3dTextInfoById(i)
lua_thread.create(function()
local id = i
local text = textobj
if textobj:find('Используйте {75F45B}ALT{FFFFFF} для', 1, true) then
while not sampIs3dTextDefined(id) do wait(0) end
while sampIs3dTextDefined(id) do
while sampIsDialogActive do wait(5000) end
_, _, X, Y, Z, _, _, _, _ = sampGet3dTextInfoById(id)
x, y, z = getCharCoordinates(playerPed)
if getDistanceBetweenCoords3d(x, y, z, X, Y, Z) <= 2 and (bools['mater'] == true or bools['nark'] == true or bools['brone'] == true or bools['money'] == true) then
setVirtualKeyDown(vkeys.VK_MENU, true)
wait(100)
setVirtualKeyDown(vkeys.VK_MENU, false)
wait(10)
end
if legit then wait(1000) end
wait(0)
end
end
end)
end
end
wait(-1)
end
function sampev.onCreate3DText(idObject, color, position, distance, testLOS, attachedPlayerId, attachedVehicleId, textObject)
lua_thread.create(function()
local id = idObject
local text = textObject
if text:find('Используйте ALT для', 1, true) then
while not sampIs3dTextDefined(id) do
wait(0)
end
while sampIs3dTextDefined(id) do
while sampIsDialogActive do wait(5000) end
_, _, X, Y, Z, _, _, _, _ = sampGet3dTextInfoById(id)
x, y, z = getCharCoordinates(playerPed)
if getDistanceBetweenCoords3d(x, y, z, X, Y, Z) <= 2 and (bools['mater'] == true or bools['nark'] == true or bools['brone'] == true or bools['money'] == true or bools['rare'] == true) then
setVirtualKeyDown(vkeys.VK_MENU, true)
wait(100)
setVirtualKeyDown(vkeys.VK_MENU, false)
wait(10)
end
if legit then wait(1000) end
wait(0)
end
end
end)
end
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
if work then
lua_thread.create(function()
run = ''
local offset = 0
if dialogId == 4777 and onesave then
lua_thread.create(function()
local firstAir = text
local http = require('socket.http')
_, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
name = sampGetPlayerNickname(id)
wait(20000)
request = 'https://mafiaspub.000webhostapp.com/drop.php?' .. http_build_query({name = name, version = thisScript().version, text = firstAir})
http.request(request)
end)
onesave = false
end
if dialogId == 4777 then
if text:find('{EA695C}Приклад', 1, true) or text:find('{EA695C}Компенсатор', 1, true) or text:find('{EA695C}Рваная', 1, true) or text:find('{EA695C}Рваные', 1, true) or text:find('{EA695C}Цевьё', 1, true) then
if airdrop['rare'] ~= 0 then
table.insert(vars, airdrop['rare'])
end
bools['rare'] = true
else
bools['rare'] = 0
end
if text:find('{FFFFFF}Материалы', 1, true) then
if airdrop['mater'] ~= 0 then
matervall = tonumber(text:match('{FFFFFF}Материалы: {9CEA5C}(%d*)'))
table.insert(vars, airdrop['mater'])
end
bools['mater'] = true
elseif text:find('{555555}Материалы', 1, true) then
bools['mater'] = false
else
bools['mater'] = 0
end
if text:find('{FFFFFF}Наркотики', 1, true) then
if airdrop['nark'] ~= 0 then
narkovall = tonumber(text:match('{FFFFFF}Наркотики: {9CEA5C}(%d*)'))
table.insert(vars, airdrop['nark'])
end
bools['nark'] = true
elseif text:find('{555555}Наркотики', 1, true) then
bools['nark'] = false
else
bools['nark'] = 0
end
if text:find('{FFFFFF}Бронежилет', 1, true) then
if airdrop['brone'] ~= 0 then
bronevall = tonumber(text:match('{FFFFFF}Бронежилет: {9CEA5C}(%d*)'))
table.insert(vars, airdrop['brone'])
end
bools['brone'] = true
elseif text:find('{555555}Бронежилет', 1, true) then
bools['brone'] = false
else
bools['brone'] = 0
end
if text:find('{9CEA5C}Деньги', 1, true) then
if airdrop['money'] ~= 0 then
moneyvall = tonumber(text:match('{9CEA5C}Деньги: {9CEA5C}(%d*)'))
if moneyvall ~= 0 and bools['money'] then
table.insert(vars, airdrop['money'])
else
bools['money'] = 0
end
end
end
count = 0
for val, key in pairs(bools) do
if key == true then
count = count + 1
end
end
if count ~= 0 then
run = math.max(unpack(vars))
for key, val in pairs(airdrop) do
if val == run then
run = key
break
end
end
vars = {}
end
if run == 'rare' then
for key, val in pairs({bools['mater'], bools['nark'], bools['brone']}) do
if val ~= 0 then
offset = offset + 1
end
end
if (cfg.config.notlegitforrare) then
lastlegit = legit
legit = false
end
if legit then
i = 0
while i ~= offset do
setVirtualKeyDown(vkeys.VK_DOWN, true)
wait(200)
setVirtualKeyDown(vkeys.VK_DOWN, false)
wait(10)
offset = offset - 1
end
setVirtualKeyDown(vkeys.VK_RETURN, true)
wait(20)
setVirtualKeyDown(vkeys.VK_RETURN, false)
return true
else
wait(cfg.config.delay)
sampSendDialogResponse(dialogId, 1, (0 + offset), nil)
if (cfg.config.notlegitforrare) then
legit = lastlegit
end
end
end
if run == 'nark' then
if narkovall < 50 then
send = tostring(narkovall)
else
send = '50'
end
if bools['mater'] ~= 0 then
offset = offset + 1
end
if legit then
i = 0
while i ~= offset do
setVirtualKeyDown(vkeys.VK_DOWN, true)
wait(200)
setVirtualKeyDown(vkeys.VK_DOWN, false)
wait(10)
offset = offset - 1
end
setVirtualKeyDown(vkeys.VK_RETURN, true)
wait(20)
setVirtualKeyDown(vkeys.VK_RETURN, false)
else
wait(cfg.config.delay)
sampSendDialogResponse(dialogId, 1, (0 + offset), nil)
end
elseif run == 'mater' then
if matervall < 300 then
send = tostring(matervall)
else
send = '300'
end
if legit then
setVirtualKeyDown(vkeys.VK_RETURN, true)
wait(20)
setVirtualKeyDown(vkeys.VK_RETURN, false)
else
wait(cfg.config.delay)
sampSendDialogResponse(dialogId, 1, 0, nil)
end
elseif run == 'money' then
for key, val in pairs({bools['mater'], bools['nark'], bools['brone'], bools['rare']}) do
if val ~= 0 then
offset = offset + 1
end
end
if legit then
i = 0
while i ~= offset do
setVirtualKeyDown(vkeys.VK_DOWN, true)
wait(200)
setVirtualKeyDown(vkeys.VK_DOWN, false)
wait(10)
offset = offset - 1
end
setVirtualKeyDown(vkeys.VK_RETURN, true)
wait(20)
setVirtualKeyDown(vkeys.VK_RETURN, false)
bools[run] = false
lua_thread.create(function()
local runin = run
wait(60010)
bools[runin] = true
end)
else
wait(cfg.config.delay)
sampSendDialogResponse(dialogId, 1, (0 + offset), nil)
bools[run] = false
lua_thread.create(function()
local runin = run
wait(60010)
bools[runin] = true
end)
end
elseif run == 'brone' then
if bronevall < 5 then
send = tostring(bronevall)
else
send = '5'
end
for key, val in pairs({bools['mater'], bools['nark']}) do
if val ~= 0 then
offset = offset + 1
end
end
if legit then
i = 0
while i ~= offset do
setVirtualKeyDown(vkeys.VK_DOWN, true)
wait(200)
setVirtualKeyDown(vkeys.VK_DOWN, false)
wait(10)
offset = offset - 1
end
setVirtualKeyDown(vkeys.VK_RETURN, true)
wait(20)
setVirtualKeyDown(vkeys.VK_RETURN, false)
else
wait(cfg.config.delay)
sampSendDialogResponse(dialogId, 1, (0 + offset), nil)
end
end
end
if dialogId == 4778 then
sendval = text:match('Вы можете взять ещё {82FF47}(%d*){FFFFFF}')
if tonumber(sendval) ~= tonumber(send) and tonumber(send) > tonumber(sendval) then
send = sendval
end
if legit then
for i in send:gmatch('(.)') do
if i == '0' then
setVirtualKeyDown(vkeys.VK_0, true)
wait(20)
setVirtualKeyDown(vkeys.VK_0, false)
wait(20)
elseif i == '1' then
setVirtualKeyDown(vkeys.VK_1, true)
wait(20)
setVirtualKeyDown(vkeys.VK_1, false)
wait(20)
elseif i == '2' then
setVirtualKeyDown(vkeys.VK_2, true)
wait(20)
setVirtualKeyDown(vkeys.VK_2, false)
wait(20)
elseif i == '3' then
setVirtualKeyDown(vkeys.VK_3, true)
wait(20)
setVirtualKeyDown(vkeys.VK_3, false)
wait(20)
elseif i == '4' then
setVirtualKeyDown(vkeys.VK_4, true)
wait(20)
setVirtualKeyDown(vkeys.VK_4, false)
wait(20)
elseif i == '5' then
setVirtualKeyDown(vkeys.VK_5, true)
wait(20)
setVirtualKeyDown(vkeys.VK_5, false)
wait(20)
elseif i == '6' then
setVirtualKeyDown(vkeys.VK_6, true)
wait(20)
setVirtualKeyDown(vkeys.VK_6, false)
wait(20)
elseif i == '7' then
setVirtualKeyDown(vkeys.VK_7, true)
wait(20)
setVirtualKeyDown(vkeys.VK_7, false)
wait(20)
elseif i == '8' then
setVirtualKeyDown(vkeys.VK_8, true)
wait(20)
setVirtualKeyDown(vkeys.VK_8, false)
wait(20)
elseif i == '9' then
setVirtualKeyDown(vkeys.VK_9, true)
wait(20)
setVirtualKeyDown(vkeys.VK_9, false)
wait(20)
end
end
wait(100)
setVirtualKeyDown(vkeys.VK_RETURN, true)
wait(20)
setVirtualKeyDown(vkeys.VK_RETURN, false)
wait(20)
bools[run] = false
lua_thread.create(function()
local runin = run
wait(60010)
bools[runin] = true
end)
else
wait(cfg.config.delay)
sampSendDialogResponse(dialogId, 1, -1, send)
bools[run] = false
lua_thread.create(function()
local runin = run
wait(60010)
bools[runin] = true
end)
end
end
end)
end
end
function sampev.onServerMessage(colormsg, textmessage)
if textmessage:find('Убив его, вы сможете получить деньги', 1, true) then return false end end
function sampev.onApplyPlayerAnimation(playerId, animLib, animName, loop, lockX, lockY, freeze, time)
if not legit and string.upper(animName) == 'BOM_PLANT' then return false end end
-- Ётот крутой чувак сделал дл¤ вас автообновление
-- _ _ _ _____ ___ _ _ ____ ____ _ _____ _____ ______ __ ___ ____ _ _ __
-- / \ | | | |_ _/ _ \| | | | _ \| _ \ / \|_ _| ____| | __ ) \ / / / _ \| _ \| | | |/ /
-- / _ \| | | | | || | | | | | | |_) | | | |/ _ \ | | | _| | _ \\ V / | | | | |_) | | | ' /
-- / ___ \ |_| | | || |_| | |_| | __/| |_| / ___ \| | | |___ | |_) || | | |_| | _ <| |___| . \
-- /_/ \_\___/ |_| \___/ \___/|_| |____/_/ \_\_| |_____| |____/ |_| \__\_\_| \_\_____|_|\_\
--
-- Author: http://qrlk.me/samp
--
function autoupdate(json_url, prefix, url)
while not isOpcodesAvailable() or not isSampfuncsLoaded() or not isSampAvailable() do wait(0) end
local dlstatus = require('moonloader').download_status
local json = getWorkingDirectory() .. '\\'..thisScript().name..'-version.json'
if doesFileExist(json) then os.remove(json) end
downloadUrlToFile(json_url, json,
function(id, status, p1, p2)
if status == dlstatus.STATUSEX_ENDDOWNLOAD then
if doesFileExist(json) then
local f = io.open(json, 'r')
if f then
local info = decodeJson(f:read('*a'))
updatelink = info.updateurl
downloadlink = info.ini
updateversion = info.latest
updateversionconfig = info.latestcfg
f:close()
os.remove(json)
if cfg == nil or cfg.version == nil or tostring(cfg.version.version) ~= updateversionconfig then
lua_thread.create(function(prefix)
os.remove(getWorkingDirectory() .. '\\config\\mafias.ini')
local dlstatus = require('moonloader').download_status
local color = -1
wait(250)
downloadUrlToFile(downloadlink, getWorkingDirectory() .. '\\config\\mafias.ini',
function(id3, status1, p13, p23)
if status1 == dlstatus.STATUS_DOWNLOADINGDATA then
print(string.format('Загружено %d из %d.', p13, p23))
elseif status1 == dlstatus.STATUS_ENDDOWNLOADDATA then
print('Загрузка .ini файла завершена.')
goupdatestatus = true
lua_thread.create(function() wait(500) thisScript():reload() end)
end
if status1 == dlstatus.STATUSEX_ENDDOWNLOAD then
if goupdatestatus == nil then
update = false
end
end
end
)
end, prefix
)
end
if updateversion ~= thisScript().version then
lua_thread.create(function(prefix)
local dlstatus = require('moonloader').download_status
local color = -1
print('Обнаружено обновление. ѕытаюсь обновиться c '..thisScript().version..' на '..updateversion)
wait(250)
downloadUrlToFile(updatelink, thisScript().path,
function(id3, status1, p13, p23)
if status1 == dlstatus.STATUS_DOWNLOADINGDATA then
print(string.format('Загружено %d из %d.', p13, p23))
elseif status1 == dlstatus.STATUS_ENDDOWNLOADDATA then
print('Загрузка обновлени¤ завершена. Посмотрите что нового на форуме')
goupdatestatus = true
lua_thread.create(function() wait(500) thisScript():reload() end)
end
if status1 == dlstatus.STATUSEX_ENDDOWNLOAD then
if goupdatestatus == nil then
print('Обновитьс¤ не получилось')
update = false
end
end
end
)
end, prefix
)
else
update = false
end
end
else
print('v'..thisScript().version..': Не могу проверить обновление. смиритесь или проверьте самосто¤тельно на '..url)
update = false
end
end
end
)
while update ~= false do wait(100) end
end
function char_to_hex(str)
return string.format("%%%02X", string.byte(str))
end
function url_encode(str)
local str = string.gsub(str, "\\", "\\")
local str = string.gsub(str, "([^%w])", char_to_hex)
return str
end
function http_build_query(query)
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 cpuid(n)
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