Генерация ников раксамп

Viant

Участник
Автор темы
49
2
Версия SA-MP
  1. Любая
  2. Другая
Нужен скрипт который генерирует никнейм из базы или через сайт и при этом если запускать много серверов и быстро сразу чтобы ставился разный никнейм.
Буду благодарен любой помощи
 

Митя Евгеньевич

Известный
304
124
Нужен скрипт который генерирует никнейм из базы или через сайт и при этом если запускать много серверов и быстро сразу чтобы ставился разный никнейм.
Буду благодарен любой помощи
Это?
код:
require 'lib.sampfuncs'
require 'lib.moonloader'

arr_nick = {}

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(1000) end
    local dlstatus = require('moonloader').download_status
    local json = getWorkingDirectory() .. '\\database.json'
    if doesFileExist(json) then os.remove(json) end
    downloadUrlToFile("https://raw.githubusercontent.com/AlannButler/database_names_surnames/main/n_s", 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
              arr_nick = decodeJson(f:read('*a'))
              f:close()
            end
          end
        end
      end)
    sampRegisterChatCommand("rand_nick", rand_nick)
end

function random(min, max)
    kf = math.random(min, max)
    math.randomseed(os.time() * kf)
    rand = math.random(min, max)
    return tonumber(rand)
end

function rand_nick()
    name = arr_nick[random(1, 5162)]
    surname = arr_nick[random(5163, 81533)]
    sampAddChatMessage(string.format("Ник: %s_%s", name, surname), -1)
end

 

ChromiusJ

PARΛDIGM ΛSS
Друг
4,909
3,197
Это?
код:
require 'lib.sampfuncs'
require 'lib.moonloader'

arr_nick = {}

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(1000) end
    local dlstatus = require('moonloader').download_status
    local json = getWorkingDirectory() .. '\\database.json'
    if doesFileExist(json) then os.remove(json) end
    downloadUrlToFile("https://raw.githubusercontent.com/AlannButler/database_names_surnames/main/n_s", 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
              arr_nick = decodeJson(f:read('*a'))
              f:close()
            end
          end
        end
      end)
    sampRegisterChatCommand("rand_nick", rand_nick)
end

function random(min, max)
    kf = math.random(min, max)
    math.randomseed(os.time() * kf)
    rand = math.random(min, max)
    return tonumber(rand)
end

function rand_nick()
    name = arr_nick[random(1, 5162)]
    surname = arr_nick[random(5163, 81533)]
    sampAddChatMessage(string.format("Ник: %s_%s", name, surname), -1)
end

Ему для раксамп надо
 

BlessedMd

Потрачен
29
10
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.