|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
script_name('squad-mats') |
|
|
|
|
script_author("Serhiy_Rubin") |
|
|
|
|
script_version("02.02.2023") |
|
|
|
|
script_version("18.02.2023") |
|
|
|
|
sampev = require 'samp.events' |
|
|
|
|
inicfg = require "inicfg" |
|
|
|
|
dlstatus = require("moonloader").download_status |
|
|
|
@ -23,9 +23,6 @@ function main() |
|
|
|
|
addChatMessage("Установлен новый ID сквада: "..config.data.squad_id) |
|
|
|
|
end |
|
|
|
|
end) |
|
|
|
|
sampRegisterChatCommand("test",function(para) |
|
|
|
|
dialog.reshow() |
|
|
|
|
end) |
|
|
|
|
wait(-1) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -123,22 +120,6 @@ dialog.convertText = function(text) |
|
|
|
|
text = string.format("%s\n \nВсего потрачено: %d матов\nСтоимость: %d вирт\n> Оплатить сейчас", text, config.data.mats, (config.data.mats * config.data.mats_price)) |
|
|
|
|
return text |
|
|
|
|
end |
|
|
|
|
dialog.reshow = function() |
|
|
|
|
local text = dialog.convertText(dialog.text) |
|
|
|
|
local bs = raknetNewBitStream() |
|
|
|
|
raknetBitStreamWriteInt16(bs, dialog.id) |
|
|
|
|
raknetBitStreamWriteInt8(bs, 2) |
|
|
|
|
raknetBitStreamWriteInt8(bs, 4) |
|
|
|
|
raknetBitStreamWriteString(bs, Utf8ToAnsi("Меню")) |
|
|
|
|
raknetBitStreamWriteInt8(bs, 7) |
|
|
|
|
raknetBitStreamWriteString(bs, Utf8ToAnsi("Выбрать")) |
|
|
|
|
raknetBitStreamWriteInt8(bs, 7) |
|
|
|
|
raknetBitStreamWriteString(bs, Utf8ToAnsi("Закрыть")) |
|
|
|
|
raknetBitStreamWriteInt8(bs, string.len(text)) |
|
|
|
|
raknetBitStreamWriteString(bs, Utf8ToAnsi(text)) |
|
|
|
|
raknetEmulRpcReceiveBitStream(61,bs) |
|
|
|
|
raknetDeleteBitStream(bs) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-->> EVENTS |
|
|
|
|
function sampev.onServerMessage(color, message) |
|
|
|
@ -146,14 +127,13 @@ function sampev.onServerMessage(color, message) |
|
|
|
|
local weapon = message:match("%[Офис%]{FFFFFF} Вы взяли {00FFBF}(.+) %(%d+ .+%) {FFFFFF}с оружейного шкафа офиса!") |
|
|
|
|
config.data.mats = config.data.mats + counter.weapon[weapon] |
|
|
|
|
config.save(config.data) |
|
|
|
|
--lua_thread.create(dialog.reshow) |
|
|
|
|
end |
|
|
|
|
if message == " Операция выполнена" and os.time() - counter.reset <= 2 then |
|
|
|
|
if message:find(" Операция выполнена") and os.time() - counter.reset <= 2 then |
|
|
|
|
addChatMessage("Счетчик материалов обнулен!") |
|
|
|
|
config.data.mats = 0 |
|
|
|
|
config.save(config.data) |
|
|
|
|
end |
|
|
|
|
if message == " Вы не в сообществе" and os.time() - counter.reset <= 2 then |
|
|
|
|
if message:find(" Вы не в сообществе") and os.time() - counter.reset <= 2 then |
|
|
|
|
addChatMessage("Укажите ID сообщества командой /squadid [ID]") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
@ -165,11 +145,12 @@ function sampev.onShowDialog(dialogId, style, title, button1, button2, text) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
function sampev.onSendDialogResponse(dialogId, button, listboxId, input) |
|
|
|
|
if listboxId == 10 then |
|
|
|
|
if dialog.id == dialogId and listboxId == 10 and button == 1 then |
|
|
|
|
counter.reset = os.time() |
|
|
|
|
sampSendChat("/squad bank "..config.data.squad_id.." "..(config.data.mats * config.data.mats_price)) |
|
|
|
|
return false |
|
|
|
|
end |
|
|
|
|
dialog.id = -1 |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-->> NEW FUNCTION |
|
|
|
|