local config = { loginMessage = getConfigValue('loginMessage'), useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')) } function onLogin(cid) registerCreatureEvent(cid, "boss") registerCreatureEvent(cid, "Kamulec") 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 fly.login(cid) registerCreatureEvent(cid, "FirstItems") registerCreatureEvent(cid, "Mail") registerCreatureEvent(cid, "GuildMotd") registerCreatureEvent(cid, "Idle") if(config.useFragHandler) then registerCreatureEvent(cid, "SkullCheck") end setPlayerStorageValue(cid, 14755, -1) registerCreatureEvent(cid, "Antimagebomb") registerCreatureEvent(cid, "targetparty") registerCreatureEvent(cid, "combatparty") registerCreatureEvent(cid, "PartyDamage") registerCreatureEvent(cid, "ReportBug") registerCreatureEvent(cid, "Restore") registerCreatureEvent(cid, "PvPStages") registerCreatureEvent(cid, "PlayerDeath") registerCreatureEvent(cid, "PlayerLogout") registerCreatureEvent(cid, "saga") registerCreatureEvent(cid, "monsterPortals") registerCreatureEvent(cid, "dailycounter") function historyPage(parameters) local historyPage = addEvent(historyPage, 60000, {}) if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then setGlobalStorageValue(23456, (tonumber(os.date("%d")))) db.executeQuery("UPDATE `players` SET `onlinetime7`=players.onlinetime6, `onlinetime6`=players.onlinetime5, `onlinetime5`=players.onlinetime4, `onlinetime4`=players.onlinetime3, `onlinetime3`=players.onlinetime2, `onlinetime2`=players.onlinetime1, `onlinetime1`=players.onlinetimetoday, `onlinetimetoday`=0;") db.executeQuery("UPDATE `players` SET `exphist7`=players.exphist6, `exphist6`=players.exphist5, `exphist5`=players.exphist4, `exphist4`=players.exphist3, `exphist3`=players.exphist2, `exphist2`=players.exphist1, `exphist1`=players.experience-players.exphist_lastexp, `exphist_lastexp`=players.experience;") end db.executeQuery("UPDATE `players` SET `onlinetimetoday`=players.onlinetimetoday+60, `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;") end if configExp.work then if exhaustion.check(cid, configExp.storageExh) then local yourRates = getPlayerRates(cid)[SKILL__LEVEL] local bonusExpRate = yourRates + (configExp.rate * yourRates/100) local lastTime = exhaustion.get(cid, configExp.storageExh) doPlayerSetRate(cid, SKILL__LEVEL, bonusExpRate) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Your bonus experience is still active. (Left: ' .. lastTime ..' seconds.)') addEvent(bonusExp, lastTime * 1000, cid) end end return true end