Оба банкомата Open Source (бесплатны).
- Скачать BraxATM: Steam Workshop::BraxATM
- Скачать GlorifiedBanking: GitHub - GlorifiedPig/GlorifiedBanking: Feature rich free & open-source banking addon for Garry's Mod
- Фото и видео GlorifiedBanking: Sign In (нужна авторизация через стим)
-- addons/anyname/lua/autorun/server/anyname.lua
local function say(pl, text)
if IsValid(pl) then pl:ChatPrint(text) end
print(text)
end
local function import_to_glorified_atm(sid32, balance, cb)
local sid64 = util.SteamIDTo64(sid32)
GlorifiedBanking.SQL.Query( "REPLACE INTO `gb_players`( `SteamID`, `Balance` ) VALUES ( '" .. sid64 .. "', '" .. balance .. "' )", function()
local ply = player.GetBySteamID( sid32 )
if ply and ply:IsPlayer() then
ply.GlorifiedBanking.Balance = balance
ply:SetNW2String( "GlorifiedBanking.Balance", tostring( balance ) )
end
cb(ply)
end)
end
concommand.Add("import_from_brax_atm", function(pl)
if IsValid(pl) and not pl:IsSuperAdmin() then return end
local accounts = sql.Query("SELECT `steamID`, `money` FROM `dbg_atm`")
if accounts == false then say(pl, "Ошибка запроса: " .. sql.LastError()) return end
if accounts == nil then say(pl, "Нет данных в таблице dbg_atm. Она пустая") return end
say(pl, "Начинаем перенос " .. #accounts .. " аккаунтов")
for _, account in ipairs(accounts) do
local sid32 = account.steamID
local balance = tonumber(account.money)
import_to_glorified_atm(sid32, balance, function(targ)
say(pl, "Перенесено: " .. sid32 .. " -> " .. balance)
if targ and IsValid(targ) then
say(pl, "\tИгрок в сети. Ник " .. targ:Nick())
end
end)
end
end)
Несколько заметок.
Просто оставлю это тут:
Структура БД BraxATM
Стимайди хранятся в виде STEAM_0:1:23456789
Структура БД GlorifiedBanking
Стимайди в SteamID64
P.S. Сделано бесплатно для человека из этой темы: [Есть работа] Ищу разработчика на постоянку. Lua, Mysql, Docker