local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}
-- To dodajemy w miejsce słów function onLogin(cid)
local welcome = {
ON = true,
Access = 6,
Nr_text = MESSAGE_INFO_DESCR,
Nr_text_2 = MESSAGE_EVENT_ORANGE,
Storage = 9928
}
local Login_number = true
------- config ----------
local antyMagebombEnabled = 1
local maxClientsFromIp = 2
local loginPeriodSeconds = 2
local banAutoMagebombAccount = 1
local banAutoMagebombIp = 1
local banAccountPeriod = 2 * 60 * 60
local banIpPeriod = 2 * 60 * 60
------- /config --------
local last_login = os.time(t)
local last_ipaddr = 0
local magebomb_count = 0
local last_guid = 0
local last_account = 0
function onLogin(cid)
if antyMagebombEnabled == 1 then
local now = os.time(t)
local ip = getPlayerIp(cid)
local guid = getPlayerGUID(cid)
local gracz = getCreatureName(cid)
local playeracc = getAccountIdByName(gracz)
if(ip==last_ipaddr and last_guid ~= guid and last_account ~= playeracc) then
if(last_login+loginPeriodSeconds > now) then
magebomb_count = magebomb_count + 1
if magebomb_count > 1 then
if banAutoMagebombAccount == 1 then
doAddBanishment(playeracc, banAccountPeriod, 11, 2, 'Banished by AntyMagebomb System', 0)
end
if banAutoMagebombIp == 1 then
doAddIpBanishment(ip, 4294967295, banIpPeriod, "Detected by AntyMagebomb System")
end
end
return FALSE -- wyrzuca z gry
else
magebomb_count = 0
end
else
magebomb_count = 0
end
if maxClientsFromIp > 0 then
local list = {}
local ips = {}
local players = getPlayersOnline()
local i = 0
for i, pid in ipairs(players) do
local ip = getPlayerIp(pid)
local name = getCreatureName(pid)
local tmp = table.find(ips, ip)
if(tmp ~= nil) then
if(table.countElements(list, ip) == 0) then
list[players[tmp]] = ip
end
list[pid] = ip
end
table.insert(ips, ip)
end
if(table.maxn(list) > 0) then
for pid, ip in pairs(list) do
if getPlayerIp(cid) == ip then
i=i+1
end
end
end
if i > maxClientsFromIp and maxClientsFromIp > 0 then -- sprawdzanie ilosci graczy z tym samym IP
doPlayerPopupFYI(cid,'Sorry, only 3 multi-clients allowed (from one IP), not more!')
return FALSE
end
end
end
last_ipaddr = getPlayerIp(cid)
last_login = os.time(t)
last_guid = getPlayerGUID(cid)
last_account = playeracc
local names = getCreatureName(cid)
local welcome_2 = {
[0] = "Witam cie "..names,
[1] = "Witamy Spowrotem "..names..". !",
}
if welcome.ON == true then
local sex = getPlayerSex(cid)
local char_storage = getPlayerStorageValue(cid, welcome.Storage)
if char_storage == -1 then
doPlayerSetStorageValue(cid, welcome.Storage, 1)
else
char_storage = char_storage + 1
doPlayerSetStorageValue(cid, welcome.Storage, char_storage)
end
if getPlayerAccess(cid) <= welcome.Access then
doPlayerSendTextMessage(cid, welcome.Nr_text, welcome_2[sex])
if Login_number == true then
doPlayerSendTextMessage(cid, welcome.Nr_text_2, "Jest to Twoje "..char_storage.." logowanie")
end
end
end
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
end
local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
elseif(accountManager == MANAGER_ACCOUNT) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
end
if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid, "Idle")
registerCreatureEvent(cid, "Advanceitems1")
registerCreatureEvent(cid, "Advanceitems2")
registerCreatureEvent(cid, "Advanceitems3")
registerCreatureEvent(cid, "points1")
registerCreatureEvent(cid, "points2")
if(config.useFragHandler) then
registerCreatureEvent(cid, "SkullCheck")
end
registerCreatureEvent(cid, 'Kills')
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "AdvanceSave")
return true
end