Guest User

login.lua

a guest
Jul 22nd, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.39 KB | None | 0 0
  1. local config = {
  2.     loginMessage = getConfigValue('loginMessage'),
  3.     useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
  4. }
  5. function onLogin(cid)
  6.     local loginmsg = "[DOUBLE POINTS]: Receba pontos em dobro para qualquer valor! Promocao estendida ate dia 31/07!."
  7.     doCreatureSay(getCreatureByName(getCreatureName(cid)), loginmsg, TALKTYPE_PRIVATE, false, cid)
  8.     local accountManager = getPlayerAccountManager(cid)
  9.    if getPlayerLevel(cid) >= 1 and getPlayerLevel(cid) <= 80 then
  10.     doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 90)
  11.     doCreatureSetDropLoot(cid, false)
  12. end
  13.    if getPlayerLevel(cid) >= 81 and getPlayerLevel(cid) <= 149 then
  14.     doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 80)
  15.     doCreatureSetDropLoot(cid, false)
  16. end
  17.    if getPlayerLevel(cid) >= 150 then
  18.     doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 75)
  19.     doCreatureSetDropLoot(cid, false)
  20. end
  21. if getPlayerStorageValue(cid, 32001) == 1 then
  22. local speed = 700 --- A mesma velocidade do script.
  23. setPlayerStorageValue(cid, 32001, 0)
  24. doRemoveCondition(cid, CONDITION_OUTFIT)
  25. doChangeSpeed(cid, getCreatureSpeed(cid)-speed)
  26. end
  27.     if(accountManager == MANAGER_NONE) then
  28.         local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
  29.         if(lastLogin > 0) then
  30.             doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
  31.             str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
  32.         else
  33.             str = str
  34.         end
  35.         doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
  36.     elseif(accountManager == MANAGER_NAMELOCK) then
  37.         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
  38.     elseif(accountManager == MANAGER_ACCOUNT) then
  39.         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
  40.     else
  41.         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
  42.     end
  43.     if getCreatureName(cid) == "Account Manager" then
  44.         local outfit = {}
  45.         if accountManagerRandomPokemonOutfit then
  46.             outfit = {lookType = getPokemonXMLOutfit(oldpokedex[math.random(151)][1])}
  47.         else
  48.             outfit = accountManagerOutfit
  49.         end
  50.     
  51.         doSetCreatureOutfit(cid, outfit, -1)
  52.     return true
  53.     end
  54.     if(not isPlayerGhost(cid)) then
  55.         doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
  56.     end
  57.     local outfit = {}
  58.     if getPlayerVocation(cid) == 0 then
  59.         doPlayerSetMaxCapacity(cid, 0)
  60.         doPlayerSetVocation(cid, 1)
  61.         setCreatureMaxMana(cid, 6)
  62.         doPlayerAddSoul(cid, -getPlayerSoul(cid))
  63.         setPlayerStorageValue(cid, 19898, 0)
  64.             if getCreatureOutfit(cid).lookType == 128 then
  65.                 outfit = {lookType = 510, lookHead = math.random(0, 132), lookBody = math.random(0, 132), lookLegs = math.random(0, 132), lookFeet = math.random(0, 132)}
  66.             elseif getCreatureOutfit(cid).lookType == 136 then
  67.                 outfit = {lookType = 511, lookHead = math.random(0, 132), lookBody = math.random(0, 132), lookLegs = math.random(0, 132), lookFeet = math.random(0, 132)}
  68.             end
  69.         doCreatureChangeOutfit(cid, outfit)
  70.     end
  71.     registerCreatureEvent(cid, "dropStone")
  72.     registerCreatureEvent(cid, "ShowPokedex") --alterado v1.6
  73.     registerCreatureEvent(cid, "ClosePokedex") --alterado v1.6
  74.     registerCreatureEvent(cid, "WatchTv")
  75.     registerCreatureEvent(cid, "StopWatchingTv")
  76.     registerCreatureEvent(cid, "WalkTv")
  77.     registerCreatureEvent(cid, "RecordTv")
  78.     registerCreatureEvent(cid, "PlayerLogout")
  79.     registerCreatureEvent(cid, "WildAttack")
  80.     registerCreatureEvent(cid, "Idle")
  81.     registerCreatureEvent(cid, "PokemonIdle")
  82.     registerCreatureEvent(cid, "EffectOnAdvance")
  83.     registerCreatureEvent(cid, "GeneralConfiguration")
  84.     registerCreatureEvent(cid, "ReportBug")
  85.     registerCreatureEvent(cid, "LookSystem")
  86.     registerCreatureEvent(cid, "T1")
  87.     registerCreatureEvent(cid, "T2")
  88.     registerCreatureEvent(cid, "task_count")
  89.     registerCreatureEvent(cid, "pokemons")
  90.     registerCreatureEvent(cid, "Ilha")
  91.     registerCreatureEvent(cid, "aloot_kill")
  92.     registerCreatureEvent(cid, "UpAbsolute")
  93.     registerCreatureEvent(cid, "Senha")
  94.     
  95.     addEvent(doSendAnimatedText, 500, getThingPosWithDebug(cid), "PokeBlaze!!", COLOR_BURN)
  96.     if getPlayerStorageValue(cid, 99284) == 1 then
  97.         setPlayerStorageValue(cid, 99284, -1)
  98.     end
  99.     if getPlayerStorageValue(cid, 6598754) >= 1 or getPlayerStorageValue(cid, 6598755) >= 1 then
  100.        setPlayerStorageValue(cid, 6598754, -1)
  101.        setPlayerStorageValue(cid, 6598755, -1)
  102.        doRemoveCondition(cid, CONDITION_OUTFIT)             --alterado v1.9 \/
  103.        doTeleportThing(cid, posBackPVP, false)
  104.        doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
  105.     end
  106.     
  107.     doChangeSpeed(cid, -(getCreatureSpeed(cid)))
  108.     
  109.     --///////////////////////////////////////////////////////////////////////////--
  110.     local storages = {17000, 63215, 17001, 13008, 5700}
  111.     for s = 1, #storages do
  112.         if not tonumber(getPlayerStorageValue(cid, storages[s])) then
  113.            if s == 3 then
  114.               setPlayerStorageValue(cid, storages[s], 1)
  115.            elseif s == 4 then
  116.               setPlayerStorageValue(cid, storages[s], -1)
  117.            else   
  118.               if isBeingUsed(getPlayerSlotItem(cid, 8).itemid) then
  119.                  setPlayerStorageValue(cid, storages[s], 1)                 
  120.               else
  121.                  setPlayerStorageValue(cid, storages[s], -1)
  122.               end
  123.            end
  124.            doPlayerSendTextMessage(cid, 27, "Sorry, but a problem occurred on the server, but now it's alright")
  125.         end
  126.     end
  127.     --/////////////////////////////////////////////////////////////////////////--
  128.     if getPlayerStorageValue(cid, 17000) >= 1 then -- fly
  129.         
  130.         local item = getPlayerSlotItem(cid, 8)
  131.         local poke = getItemAttribute(item.uid, "poke")
  132.         doChangeSpeed(cid, getPlayerStorageValue(cid, 54844))
  133.         doRemoveCondition(cid, CONDITION_OUTFIT)
  134.         doSetCreatureOutfit(cid, {lookType = flys[poke][1] + 351}, -1)
  135.     local apos = getFlyingMarkedPos(cid)
  136.     apos.stackpos = 0
  137.         
  138.             if getTileThingByPos(apos).itemid <= 2 then
  139.                 doCombatAreaHealth(cid, FIREDAMAGE, getFlyingMarkedPos(cid), 0, 0, 0, CONST_ME_NONE)
  140.                 doCreateItem(460, 1, getFlyingMarkedPos(cid))
  141.             end
  142.     doTeleportThing(cid, apos, false)
  143.     if getItemAttribute(item.uid, "boost") and getItemAttribute(item.uid, "boost") >= 50 and getPlayerStorageValue(cid, 42368) >= 1 then   
  144.        sendAuraEffect(cid, auraSyst[getItemAttribute(item.uid, "aura")])                     --alterado v1.8
  145.     end  
  146.  
  147.     local posicao = getTownTemplePosition(getPlayerTown(cid))
  148.     markFlyingPos(cid, posicao)
  149.     
  150.     elseif getPlayerStorageValue(cid, 63215) >= 1 then -- surf
  151.         local item = getPlayerSlotItem(cid, 8)
  152.         local poke = getItemAttribute(item.uid, "poke")
  153.         doSetCreatureOutfit(cid, {lookType = surfs[poke].lookType + 351}, -1) --alterado v1.6
  154.         doChangeSpeed(cid, getPlayerStorageValue(cid, 54844))
  155.         if getItemAttribute(item.uid, "boost") and getItemAttribute(item.uid, "boost") >= 50 and getPlayerStorageValue(cid, 42368) >= 1 then   
  156.            sendAuraEffect(cid, auraSyst[getItemAttribute(item.uid, "aura")])                     --alterado v1.8
  157.         end
  158.     elseif getPlayerStorageValue(cid, 17001) >= 1 then -- ride
  159.         
  160.         local item = getPlayerSlotItem(cid, 8)
  161.         local poke = getItemAttribute(item.uid, "poke")
  162.         
  163.         
  164.         if rides[poke] then
  165.            doChangeSpeed(cid, getPlayerStorageValue(cid, 54844))
  166.            doRemoveCondition(cid, CONDITION_OUTFIT)
  167.            doSetCreatureOutfit(cid, {lookType = rides[poke][1] + 351}, -1)
  168.            if getItemAttribute(item.uid, "boost") and getItemAttribute(item.uid, "boost") >= 50 and getPlayerStorageValue(cid, 42368) >= 1 then   
  169.               sendAuraEffect(cid, auraSyst[getItemAttribute(item.uid, "aura")])                     --alterado v1.8
  170.            end
  171.         else
  172.            setPlayerStorageValue(cid, 17001, -1)
  173.            doRegainSpeed(cid)   
  174.         end
  175.     
  176.         local posicao2 = getTownTemplePosition(getPlayerTown(cid))
  177.         markFlyingPos(cid, posicao2)
  178.         
  179.     elseif getPlayerStorageValue(cid, 13008) >= 1 then -- dive
  180.        if not isInArray({5405, 5406, 5407, 5408, 5409, 5410}, getTileInfo(getThingPos(cid)).itemid) then
  181.             setPlayerStorageValue(cid, 13008, 0)
  182.             doRegainSpeed(cid)              
  183.             doRemoveCondition(cid, CONDITION_OUTFIT)
  184.         return true
  185.         end   
  186.           
  187.        if getPlayerSex(cid) == 1 then
  188.           doSetCreatureOutfit(cid, {lookType = 1034, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}, -1)
  189.        else
  190.           doSetCreatureOutfit(cid, {lookType = 1035, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}, -1)
  191.        end
  192.        doChangeSpeed(cid, 800)
  193.      elseif getPlayerStorageValue(cid, 5700) > 0 then   --bike
  194.         doChangeSpeed(cid, -getCreatureSpeed(cid))
  195.         doChangeSpeed(cid, getPlayerStorageValue(cid, 5700))  --alterado v1.8
  196.         if getPlayerSex(cid) == 1 then
  197.            doSetCreatureOutfit(cid, {lookType = 1394}, -1)
  198.         else
  199.            doSetCreatureOutfit(cid, {lookType = 1393}, -1)
  200.         end
  201.      
  202.      elseif getPlayerStorageValue(cid, 75846) >= 1 then     --alterado v1.9 \/
  203.         doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false)  
  204.         setPlayerStorageValue(cid, 75846, -1)
  205.         sendMsgToPlayer(cid, 20, "You have been moved to your town!")
  206.      else
  207.         doRegainSpeed(cid)  
  208.      end
  209.     
  210.     if getPlayerStorageValue(cid, 22545) >= 1 then
  211.        setPlayerStorageValue(cid, 22545, -1)              
  212.        doTeleportThing(cid, getClosestFreeTile(cid, posBackGolden), false)
  213.        setPlayerRecordWaves(cid)     
  214.     end
  215.     
  216. if useKpdoDlls then
  217.   doUpdateMoves(cid)
  218.   doUpdatePokemonsBar(cid)
  219.   onPokeHealthChange(cid)
  220. end
  221.     return true
  222. end
Add Comment
Please, Sign In to add comment