Ir para conteúdo
  • Cadastre-se

Posts Recomendados

  • Respostas 43
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Bom, vi por aqui e não achei nenhum autoloot igual o da pxg ou sem bugs, então decidi vir aqui postar o que eu fiz. Vamos lá.   1º - Vá na pasta Lib, no arquivo some functions.lua e adicione isso d

Tenta assim : lib na some fuctions.lua  no final end como o dono do topico fez!   vai actions/script   cria arquivo.lua e escreve autoloot.lua, dentro você coloka assim:     No tol

Posted Images

Muito legal, acredito que da pra fazer com uma checagem se é corpse e evitar ter que colocar os IDS dos corpses um por um, mas tá legal o sistema, inves de ficar usando comentarios, você poderia ter feito uma variavel se utilizaria o sistema de itens especificos ou não e verificar a variavel com um IF, acredito que seja melhor para quem não tem conhecimento nenhum de scripts, eu modifiquei e ficou assim:


local toloot = {11441, 11441, 11443, 11444, 11445, 11446, 11447, 11448, 11449,11450, 11451, 11452, 11453, 11454, 12618, 12232, 12244} -- PREFERENCIAL - SE QUISER APENAS COM ALGUNS ITENS
local useSpecific = false --True para lotear somente os itens que estiverem na tabela toloot, false para todos os itens do corpse
function onUse(cid, item, frompos, item2, topos)
if getItemAttribute(item.uid, "corpseowner") ~= cid then
doPlayerSendCancel(cid, "You're not the owner.")
return true
end
local items = {}
for x=0, (getContainerSize(item.uid)) do
local itens = getContainerItem(item.uid, x)
if useSpecific == true then
    if isInArray(toloot, itens.itemid) then
        table.insert(items, {i=itens.itemid, q=itens.type})
        doRemoveItem(itens.uid)
        break
    end
else
table.insert(items, {i=itens.itemid, q=itens.type})
doRemoveItem(itens.uid)
end
end
for y=1, #items do
doPlayerAddItemStacking(cid, items[y].i, items[y].q)
doPlayerSendTextMessage(cid, 20, "Looted "..items[y].q.."x "..getItemNameById(items[y].i)..".")
end
if #items > 0 then
return true
else
return false
end
end
--[[
AUTO LOOT BY GABRIEL SALES
SE QUISER ATIVAR O AUTOLOOT APENAS PARA ALGUNS ITENS, ADICIONE OS IDS NA TABELA toloot E TIRE OS COMENTÁRIOS(--).
--]]


Mais uma vez, excelente sistema, obrigado por disponibilizar.

Grande abraço :3

Editado por Mateuso (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Eu nem ia deixar aquela tabela, só deixei porque poderia ser util.

Quanto ao corpse, creio que não seja problema pegar todos eles por um pequeno script, é facil

De qualquer maneira, de nada.

Att. Featzen.

Link para o post
Compartilhar em outros sites

eu modifiquei e ficou assim:

Essa sua script que você modificou tem algum erro? porque vou usar ela '-'

 

Gabrielbsales Não teria como colocar para quando o player clicar no corpse do pokemon vim qualquer item?

porque tem servidores que tem muitos items e sai colocando de 1 em 1 é ruim :(

                                                            vps-plano-01.png

 

                                                                                                                    http://www.weblara.com.br/

Link para o post
Compartilhar em outros sites

Essa sua script que você modificou tem algum erro? porque vou usar ela '-'

 

Gabrielbsales Não teria como colocar para quando o player clicar no corpse do pokemon vim qualquer item?

porque tem servidores que tem muitos items e sai colocando de 1 em 1 é ruim :(

Mas ja está assim Oo

Att. Featzen.

Link para o post
Compartilhar em outros sites
--local toloot = {11441, 11441, 11443, 11444, 11445, 11446, 11447, 11448, 11449,11450, 11451, 11452, 11453, 11454, 12618, 12232, 12244} -- PREFERENCIAL - SE QUISER

então nessa parte é qual IDS?

 

EDIT

o systema não está funcionando, quando o pokemon morre e clico em cima do corpo dele os items não vem para bp

Editado por SliceFalso (veja o histórico de edições)

                                                            vps-plano-01.png

 

                                                                                                                    http://www.weblara.com.br/

Link para o post
Compartilhar em outros sites

Tá funcionando sim você não está sabendo colocar.

mais eu fiz certinho e quando mato o pokemon que vou clicar com o botão direito não vem nada para a bp

                                                            vps-plano-01.png

 

                                                                                                                    http://www.weblara.com.br/

Link para o post
Compartilhar em outros sites

Colocou os ids dos corpses no actions.xml?


então nessa parte é qual IDS?

 

EDIT

o systema não está funcionando, quando o pokemon morre e clico em cima do corpo dele os items não vem para bp

Poderia ler '-'

Att. Featzen.

Link para o post
Compartilhar em outros sites

Colocou os ids dos corpses no actions.xml?

sim olha ai como deixei

<?xml version="1.0" encoding="UTF-8"?>
<actions>

              <action itemid="1819" script="vipname.lua"/>

              <action itemid="247;9924;202;12687;187;218;12534;12906;10519;8935;5970;5972;6012;13501;2936;13537;5975;12545;12741;2928;13247;139;6072;11920;12749;5962;13539;12695;159;12438;12743;12514;12599;12689;297;12725;9872;6056;5765;12604;6036;9923;13362;5978;606;12859;12437;6364;230;12516;3004;5986;6336;12441;127;12527;204;2970;10520;12744;5996;677;6002;12694;6043;12491;9781;5969;6046;8960;6011;610;6034;12466;5968;12717;12684;163;13519;9876;12602;206;9875;2932;181;9774;6029;13201;13532;13235;12543;4295;6019;5963;12705;6031;3035;6071;619;614;8957;618;12507;235;12453;12544;226;6009;5981;6005;5988;8958;9937;12431;12556;3038;6020;11987;12771;9868;6028;9916;12918;216;9925;9921;13419;604;12852;6038;155;5987;9920;220;198;9009;9083;12720;6013;8943;12862;6076;147;3002;208;12781;153;6017;12439;3288;6050;1051;12702;5998;12907;5979;12733;13522;2806;4323;12502;12465;12549;6057;9081;13173;12601;12460;9963;13361;6023;6042;6332;12701;5983;12690;12706;12855;12753;6025;12857;13414;6060;8967;2842;12755;13534;3007;12434;12461;145;12518;13261;13513;12595;12464;6051;6306;10002;622;12746;13359;12524;9961;13503;6037;12679;12740;12704;12723;3005;6035;6014;5997;613;6338;8939;6006;6069;6015;253;12513;12550;267;2879;13264;13423;6039;7283;8956;605;12425;6026;161;13510;10603;8938;259;13514;9871;5999;5993;8941;10508;2817;12860;6345;131;13529;13517;10008;12537;6007;10539;5971;12712;2872;167;8969;8953;13523;2953;5990;5989;13535;5992;12525;9107;13253;13542;13213;12597;189;13536;12568;169;8951;12698;9803;9915;10003;5974;6054;11839;6032;5966;5977;12482;2926;2905;7320;9913;6041;157;9654;9873;6008;6016;6340;3564;10171;2990;12682;6073;13516;6024;129;177;12508;9879;12478;684;6010;5960;9823;13511;623;214;8950;13262;590;10015;9880;10538;13401;12519;8946;2925;2968;713;12735;200;12738;5982;9801;593;9783;12731;6065;5995;624;175;13360;6033;13204;13358;12709;683;682;13502;2973;13531;13533;9965;6047;12583;13508;12716;1452;6067;12938;13263;2858;4428;3297;3286;3274;265;11919;11921;1453;12904;12881;12767;12766;12930;4445;12880;12759;609;13528;12715;12728;12868;4251;8942;12861;12745;241;5976;12422;6003;12915;12627;9831;7282;13530;12752;12751;12750;149;3008;6000;8966;12748;237;12520;12747;6004;5984;12754;12742;8964;12739;6040;10524;6044;12567;12737;12663;12736;12734;6055;137;12468;12445;13515;12526;12730;12729;8968;12727;12726;13249;12724;12722;6302;12721;13211;12719;12718;191;12714;12603;12713;12710;12711;5985;13538;2845;165;12707;12700;12495;6331;12865;12699;9877;12477;12697;12696;8947;12692;8937;12691;12569;12686;12492;12685;12683;12536;625;9914;617;616;615;612;611;12854;9780;608;271;13509;251;12770;592;591;6048;9867;607;9829;243;269;263;173;257;255;249;239;9917;228;6030;222;6516;210;196;193;185;183;2982;179;171;12708;151;6053;13356;13357;13260;12732;13212;13269;13512;12600;12598;2837;12596;9881;6059;13526;6027;233;13525;12693;10525;6045;13518;9960;9962;9658;5964;10522;10521;9802;9936;8952;9964;12864;9938;9919;9775;10005;2818;10518;9882;9824;9935;8955;8949;12555;5961;12554;6001;12547;12517;5994;12467;6018;12462;687;12484;9869;11843;6049;12662;224;2836;212;2961" event="script" value="Autoloot.lua"/>
 
              <action itemid="6569" event="script" value="candy_up.lua"/>

    <!-- Agatha Quest -->
    <action actionid="6616" event="script" value="Agatha/Agatha_Colar.lua"/>
    <action actionid="3544" event="script" value="Agatha/Agatha_Door.lua"/>
    <action actionid="6655" event="script" value="Agatha/Agatha_Enigma.lua"/>
    <action actionid="6657" event="script" value="Agatha/Agatha_Espelho_Lab.lua"/>
    <action actionid="6658" event="script" value="Agatha/Agatha_Espelho_Out.lua"/>
    <action actionid="6660" event="script" value="Agatha/Agatha_Estante.lua"/>
    <action actionid="6661" event="script" value="Agatha/Agatha_Hammer.lua"/>
    <action actionid="6617-6653" event="script" value="Agatha/Agatha_Items.lua"/>
    <action actionid="6654" event="script" value="Agatha/Agatha_Receita.lua"/>
    <action actionid="6659" event="script" value="Agatha/Agatha_Receita[2].lua"/>

    <action itemid="12594" event="script" value="Squirtle Bottle.lua"/>
    <action fromid="11790" toid="11803" event="script" value="other/doors.lua"/>

    <action itemid="12688" event="script" value="bike.lua"/>

              <action itemid="1822" event="script" value="troll.lua"/>

        <action uniqueid="6798" script="bikebau.lua"/>

    <action actionid="32698" event="script" value="bau_Pewter.lua"/>

     <!-- Water quest -->
        <action uniqueid="8999" script="Water/1hora.lua"/>
        <action uniqueid="2111" script="Water/water.lua"/>
 
        <!-- Poison quest -->
        <action uniqueid="1746" script="Poison Quest/poison.lua"/>

        <!-- Pokeball quest -->
        <action uniqueid="20006" script="Pokeball/pokeball.lua"/>
        <action uniqueid="20993" script="inicial/firestone.lua"/>
        <action uniqueid="20994" script="inicial/waterstone.lua"/>
        <action uniqueid="20995" script="inicial/leafstone.lua"/>
 
        <!-- Pewter quest -->
        <action uniqueid="20000" script="Pewter quest/Pewter.lua"/>
        <action uniqueid="20001" script="Pewter quest/geloquest.lua"/>
        
        <!-- Outland quest -->
        <action actionid="19381;19382;19383;19384" event="script" value="Outland/Outland-waves.lua"/>
        <action actionid="19385" event="script" value="Outland/Outland-Saida.lua"/>
        <action uniqueid="19386" event="script" value="Outland/Outland-Bau.lua"/>

         
        <!-- Addon quest -->
        <action uniqueid="12154" event="script" value="addonquest.lua"/>


        <!-- Dungeon quest -->
        <action uniqueid="7897" event="script" value="dungeon/icedungeon.lua"/>   
        <action uniqueid="7898" event="script" value="dungeon/leafdungeon.lua"/>

        <!-- Leaf valley Quest -->
        <action actionid="7100" script="LeafQuest/Leafquest.lua"/>
        <action uniqueid="7105" script="LeafQuest/Leafquest2.lua"/>

        <!-- Water valley Quest -->
        <action actionid="7101" script="WaterQuest/waterquest.lua"/>
        <action uniqueid="7104" script="WaterQuest/waterquest2.lua"/>

        <!-- Fire valley Quest -->
        <action actionid="7102" script="FireQuest/firequest.lua"/>
        <action uniqueid="7103" script="FireQuest/firequest2.lua"/>

        <!-- Helds -->

        <action itemid="13487;13488;13489;13490;13491;13492.13493;13494;13495;13496;13497;13498;13499;13500" event="script" value="heldsystem.lua"/>



        <!-- Golden Arena -->
    <action actionid="65535" event="script" value="Quadro_Golden.lua"/>
    <action actionid="55356" event="script" value="Quadro_Golden_Rank.lua"/>
    <action itemid="6527" event="script" value="Meowth Coin.lua"/>

    <!-- Quests -->
    <action actionid="2000" event="script" value="quests/system.lua"/>
    <action actionid="2001" event="script" value="quests/system.lua"/>
        <action uniqueid="3251" event="script" value="quests/ceruleanforest.lua"/>
        <action uniqueid="3252" event="script" value="quests/desert.lua"/>
    <action uniqueid="3253" event="script" value="quests/mewtwocave.lua"/>
              <action uniqueid="6794" event="script" value="quests/saffronquest.lua"/>
              <action uniqueid="6795" event="script" value="quests/box3.lua"/>
              <action uniqueid="6796" event="script" value="quests/box1.lua"/>
              <action uniqueid="6797" event="script" value="quests/box2.lua"/>

    <!-- Weapons enchanting (Gems) -->
    <action itemid="2150" event="script" value="other/enchanting.lua"/>
    <action itemid="2149" event="script" value="other/enchanting.lua"/>
    <action itemid="7759" event="script" value="other/enchanting.lua"/>
    <action itemid="7760" event="script" value="other/enchanting.lua"/>
    <action itemid="7761" event="script" value="other/enchanting.lua"/>
    <action itemid="7762" event="script" value="other/enchanting.lua"/>

    <!-- Tools -->
    <action itemid="2420" event="script" value="tools/machete.lua"/>
    <action itemid="2442" event="script" value="tools/machete.lua"/>
    <action itemid="2580" event="script" value="tools/fishing.lua" allowfaruse="1"/>
    <action itemid="10223" event="script" value="tools/fishing.lua" allowfaruse="1"/>
    <action itemid="2554" event="script" value="tools/shovel.lua"/>
    <action itemid="5710" event="script" value="tools/shovel.lua"/>
    <action itemid="2120" event="script" value="tools/rope.lua"/>
    <action itemid="7731" event="script" value="tools/rope.lua"/>
    <action itemid="2553" event="script" value="tools/pick.lua"/>
    <action itemid="5908" event="script" value="tools/obsidian_knife.lua"/>
    <action itemid="5942" event="script" value="tools/blessed_wooden_stake.lua"/>

    <!-- Food -->
    <action itemid="2362;2666-2691" event="script" value="other/food.lua"/>
    <action fromid="2695" toid="2696" event="script" value="other/food.lua"/>
    <action fromid="2787" toid="2796" event="script" value="other/food.lua"/>
    <action itemid="5097" event="script" value="other/food.lua"/>
    <action itemid="6125" event="script" value="other/food.lua"/>
    <action itemid="6278" event="script" value="other/food.lua"/>
    <action itemid="6279" event="script" value="other/food.lua"/>
    <action itemid="6394" event="script" value="other/food.lua"/>
    <action itemid="6501" event="script" value="other/food.lua"/>
    <action fromid="6541" toid="6545" event="script" value="other/food.lua"/>
    <action itemid="6574" event="script" value="other/food.lua"/>
    <action itemid="7158" event="script" value="other/food.lua"/>
    <action itemid="7159" event="script" value="other/food.lua"/>
    <action fromid="7372" toid="7377" event="script" value="other/food.lua"/>
    <action itemid="7909" event="script" value="other/food.lua"/>
    <action fromid="8838" toid="8845" event="script" value="other/food.lua"/>
    <action itemid="8847" event="script" value="other/food.lua"/>
    <action itemid="12211;12213-12222" event="script" value="other/food.lua"/>

    <!-- Increase/Decrease ItemId -->
    <action itemid="461" event="function" value="increaseItemId"/>
    <action itemid="462" event="function" value="decreaseItemId"/>
    <action itemid="1873" event="function" value="increaseItemId"/>
    <action itemid="1874" event="function" value="decreaseItemId"/>
    <action itemid="1875" event="function" value="increaseItemId"/>
    <action itemid="1876" event="function" value="decreaseItemId"/>
    <action itemid="2162" event="function" value="increaseItemId"/>
    <action itemid="2163" event="function" value="decreaseItemId"/>
    <action itemid="3743" event="function" value="increaseItemId"/>
    <action itemid="3744" event="function" value="decreaseItemId"/>
    <action itemid="3947" event="function" value="increaseItemId"/>
    <action itemid="3948" event="function" value="decreaseItemId"/>
    <action itemid="1479" event="function" value="increaseItemId"/>
    <action itemid="1480" event="function" value="decreaseItemId"/>
    <action itemid="2058" event="function" value="increaseItemId"/>
    <action itemid="2059" event="function" value="decreaseItemId"/>
    <action itemid="2060" event="function" value="increaseItemId"/>
    <action itemid="2061" event="function" value="decreaseItemId"/>
    <action itemid="2066" event="function" value="increaseItemId"/>
    <action itemid="2067" event="function" value="decreaseItemId"/>
    <action itemid="2068" event="function" value="increaseItemId"/>
    <action itemid="2069" event="function" value="decreaseItemId"/>
    <action itemid="2064" event="function" value="increaseItemId"/>
    <action itemid="2065" event="function" value="decreaseItemId"/>
    <action itemid="2096" event="function" value="increaseItemId"/>
    <action itemid="2097" event="function" value="decreaseItemId"/>
    <action itemid="1786" event="function" value="increaseItemId"/>
    <action itemid="1787" event="function" value="decreaseItemId"/>
    <action itemid="1788" event="function" value="increaseItemId"/>
    <action itemid="1789" event="function" value="decreaseItemId"/>
    <action itemid="1790" event="function" value="increaseItemId"/>
    <action itemid="1791" event="function" value="decreaseItemId"/>
    <action itemid="1792" event="function" value="increaseItemId"/>
    <action itemid="1793" event="function" value="decreaseItemId"/>
    <action itemid="1634" event="function" value="increaseItemId"/>
    <action itemid="1635" event="function" value="decreaseItemId"/>
    <action itemid="1636" event="function" value="increaseItemId"/>
    <action itemid="1637" event="function" value="decreaseItemId"/>
    <action itemid="1638" event="function" value="increaseItemId"/>
    <action itemid="1639" event="function" value="decreaseItemId"/>
    <action itemid="1640" event="function" value="increaseItemId"/>
    <action itemid="1641" event="function" value="decreaseItemId"/>
    <action itemid="7058" event="function" value="increaseItemId"/>
    <action itemid="7059" event="function" value="decreaseItemId"/>
    <action itemid="8684" event="function" value="increaseItemId"/>
    <action itemid="8685" event="function" value="decreaseItemId"/>
    <action itemid="8686" event="function" value="increaseItemId"/>
    <action itemid="8687" event="function" value="decreaseItemId"/>
    <action itemid="8688" event="function" value="increaseItemId"/>
    <action itemid="8689" event="function" value="decreaseItemId"/>
    <action itemid="8690" event="function" value="increaseItemId"/>
    <action itemid="8691" event="function" value="decreaseItemId"/>
    <action itemid="9575" event="function" value="increaseItemId"/>
    <action itemid="9576" event="function" value="decreaseItemId"/>
    <action itemid="9577" event="function" value="increaseItemId"/>
    <action itemid="9578" event="function" value="decreaseItemId"/>
    <action itemid="9579" event="function" value="increaseItemId"/>
    <action itemid="9580" event="function" value="decreaseItemId"/>
    <action itemid="9581" event="function" value="increaseItemId"/>
    <action itemid="9582" event="function" value="decreaseItemId"/>
    <action itemid="9624" event="function" value="increaseItemId"/>
    <action itemid="9625" event="function" value="decreaseItemId"/>
    <action itemid="9747" event="function" value="increaseItemId"/>
    <action itemid="9748" event="function" value="decreaseItemId"/>
    <action itemid="9749" event="function" value="increaseItemId"/>
    <action itemid="9750" event="function" value="decreaseItemId"/>
    <action itemid="9825" event="function" value="increaseItemId"/>
    <action itemid="9826" event="function" value="decreaseItemId"/>
    <action itemid="9827" event="function" value="increaseItemId"/>
    <action itemid="9828" event="function" value="decreaseItemId"/>
    <action itemid="9973" event="function" value="increaseItemId"/>
    <action itemid="9974" event="function" value="decreaseItemId"/>
    <action itemid="10044" event="function" value="increaseItemId"/>
    <action itemid="10045" event="function" value="decreaseItemId"/>

    <!-- Spellbooks -->
    <action itemid="2175" event="script" value="other/spellbook.lua"/>
    <action itemid="6120" event="script" value="other/spellbook.lua"/>
    <action fromid="8900" toid="8904" event="script" value="other/spellbook.lua"/>
    <action itemid="8918" event="script" value="other/spellbook.lua"/>

    <!-- Change gold -->
    <action itemid="2148;2152;2160;12416" event="script" value="other/changegold.lua"/>

    <!-- Construction kits -->
    <action fromid="3901" toid="3938" event="script" value="other/constructionkits.lua"/>
    <action fromid="5086" toid="5088" event="script" value="other/constructionkits.lua"/>
    <action fromid="6114" toid="6115" event="script" value="other/constructionkits.lua"/>
    <action fromid="6372" toid="6373" event="script" value="other/constructionkits.lua"/>
    <action fromid="7960" toid="7962" event="script" value="other/constructionkits.lua"/>
    <action fromid="8692" toid="8693" event="script" value="other/constructionkits.lua"/>
    <action itemid="7503" event="script" value="other/constructionkits.lua"/>
    <action itemid="7700" event="script" value="other/constructionkits.lua"/>

    <!-- Bed construction kits -->
    <action fromid="7904" toid="7907" event="script" value="other/furniturebeds.lua"/>

    <!-- Music, instruments -->
    <action fromid="2070" toid="2085" event="script" value="other/music.lua"/>
    <action itemid="2095" event="script" value="other/music.lua"/>
    <action itemid="2332" event="script" value="other/music.lua"/>
    <action itemid="2364" event="script" value="other/music.lua"/>
    <action fromid="2367" toid="2374" event="script" value="other/music.lua"/>
    <action fromid="3951" toid="3953" event="script" value="other/music.lua"/>
    <action itemid="3957" event="script" value="other/music.lua"/>
    <action itemid="5786" event="script" value="other/music.lua"/>
    <action itemid="6572" event="script" value="other/music.lua"/>

    <!-- Teleport (stairs, ladders) -->
    <action itemid="430" event="script" value="other/teleport.lua"/>
    <action itemid="1368" event="script" value="other/teleport.lua"/>
    <action itemid="1369" event="script" value="other/teleport.lua"/>
    <action itemid="1386" event="script" value="other/teleport.lua"/>
    <action itemid="3678" event="script" value="other/teleport.lua"/>
    <action itemid="5543" event="script" value="other/teleport.lua"/>
    <action itemid="8580" event="script" value="other/teleport.lua"/>
    <action itemid="8599" event="script" value="other/teleport.lua"/>
    <action itemid="10035" event="script" value="other/teleport.lua"/>

    <!-- Destroy -->
    <action id="2321;2390-2398;2400-2404;2406-2409;2411-2417;2419;2421-2441;2443-2454;3961-3964;3966;4846;6101;6528;6553;7379-7392;7402-7437;7449;7451-7456;7744-7758;7763-7777;7854-7883;7958;8601-8602;8924-8932;10293" event="script" value="other/destroy.lua"/>

    <!-- Bread Creating -->
    <action itemid="2692" event="script" value="other/createbread.lua"/>
    <action itemid="2694" event="script" value="other/createbread.lua"/>

    <!-- Windows -->
    <action fromid="5303" toid="5305" event="script" value="other/windows.lua"/>
    <action fromid="6436" toid="6473" event="script" value="other/windows.lua"/>
    <action fromid="6788" toid="6791" event="script" value="other/windows.lua"/>
    <action fromid="7025" toid="7032" event="script" value="other/windows.lua"/>
    <action fromid="10264" toid="10267" event="script" value="other/windows.lua"/>
    <action fromid="10488" toid="10491" event="script" value="other/windows.lua"/>

    <!-- Doors -->
    <action fromid="1209" toid="1214" event="script" value="other/doors.lua"/>
    <action fromid="1219" toid="1262" event="script" value="other/doors.lua"/>
    <action fromid="1539" toid="1542" event="script" value="other/doors.lua"/>
    <action fromid="2086" toid="2092" event="script" value="other/doors.lua"/>
    <action fromid="3535" toid="3552" event="script" value="other/doors.lua"/>
    <action fromid="4913" toid="4918" event="script" value="other/doors.lua"/>
    <action fromid="5082" toid="5085" event="script" value="other/doors.lua"/>
    <action fromid="5098" toid="5145" event="script" value="other/doors.lua"/>
    <action fromid="5278" toid="5295" event="script" value="other/doors.lua"/>
    <action fromid="5515" toid="5518" event="script" value="other/doors.lua"/>
    <action fromid="5732" toid="5737" event="script" value="other/doors.lua"/>
    <action fromid="5745" toid="5749" event="script" value="other/doors.lua"/>
    <action fromid="6192" toid="6209" event="script" value="other/doors.lua"/>
    <action fromid="6249" toid="6266" event="script" value="other/doors.lua"/>
    <action fromid="6795" toid="6802" event="script" value="other/doors.lua"/>
    <action fromid="6891" toid="6908" event="script" value="other/doors.lua"/>
    <action fromid="7033" toid="7050" event="script" value="other/doors.lua"/>
    <action fromid="7054" toid="7057" event="script" value="other/doors.lua"/>
    <action fromid="8541" toid="8558" event="script" value="other/doors.lua"/>
    <action fromid="9165" toid="9184" event="script" value="other/doors.lua"/>
    <action fromid="9267" toid="9284" event="script" value="other/doors.lua"/>
    <action itemid="10032" event="script" value="other/doors.lua"/>
    <action itemid="10091" event="script" value="other/doors.lua"/>
    <action fromid="10268" toid="10285" event="script" value="other/doors.lua"/>
    <action fromid="10468" toid="10486" event="script" value="other/doors.lua"/>
    <action fromid="10774" toid="10776" event="script" value="other/doors.lua"/>
    <action fromid="10779" toid="10785" event="script" value="other/doors.lua"/>
    <action fromid="10788" toid="10791" event="script" value="other/doors.lua"/>

    <!-- Watch -->
    <action itemid="2036" event="script" value="other/watch.lua"/>
    <action fromid="1728" toid="1731" event="script" value="other/watch.lua"/>
    <action itemid="1877" event="script" value="other/watch.lua"/>
    <action fromid="6091" toid="6092" event="script" value="other/watch.lua"/>
    <action itemid="8187" event="script" value="other/watch.lua"/>

    <!-- Decay To -->
    <action fromid="2041" toid="2042" event="script" value="other/decayto.lua"/>
    <action fromid="2044" toid="2045" event="script" value="other/decayto.lua"/>
    <action fromid="2047" toid="2048" event="script" value="other/decayto.lua"/>
    <action fromid="2050" toid="2055" event="script" value="other/decayto.lua"/>
    <action fromid="5812" toid="5813" event="script" value="other/decayto.lua"/>
    <action itemid="7183" event="script" value="other/decayto.lua"/>
    <action itemid="9006" event="script" value="other/decayto.lua"/>
    <action fromid="9976" toid="9979" event="script" value="other/decayto.lua"/>

    <!-- Other -->
    <action itemid="2114" event="script" value="other/piggybank.lua"/>
    <action fromid="6570" toid="6571" event="script" value="other/surprisebag.lua"/>
    <action fromid="5792" toid="5797" event="script" value="other/dice.lua"/>
    <action itemid="6576" event="script" value="other/fireworksrocket.lua"/>
    <action itemid="6578" event="script" value="other/partyhat.lua"/>
    <action itemid="2785" event="script" value="other/blueberrybush.lua"/>
    <action itemid="2579" event="script" value="other/trap.lua"/>

    <action itemid="5791" event="script" value="other/stuffeddragon.lua"/>
    <action itemid="6566" event="script" value="other/stuffeddragon.lua"/>

              <action itemid="748;751;755;752;754;753" event="script" value="addons.lua"/>

-- POTIONS / ANTIDOTE
    <action itemid="12343;12345-12348" event="script" value="potion.lua" allowfaruse="1" blockwalls="1"/>
    <action itemid="12349" event="script" value="medicine.lua" allowfaruse="1" blockwalls="1"/>
    <action itemid="12344" event="script" value="revive.lua" allowfaruse="1" blockwalls="1"/>

-- BOXES (poke inicial)
    <action itemid="1740" event="script" value="starter.lua"/>

-- POKEMON PRIZE BOXES / RARE CANDY
    -- POKEMON PRIZE BOXES / RARE CANDY

        <action itemid="11638;11639;11640;11641" event="script" value="box_antiga.lua"/>
        <action itemid="12227" event="script" value="shiny box.lua"/>
        <action itemid="12331" event="script" value="lendaria box.lua"/>

-- POKEDEX
    <action itemid="2382" event="script" value="pokedex.lua" allowfaruse="1" blockwalls="1"/>
    <action itemid="7385" event="script" value="pokeinfo.lua"/>

-- LOJA DE ROUPAS
    <action itemid="3896;3897;3867;3868" event="script" value="roupas.lua"/>

-- GO/BACK E CATCH
    <action itemid="11826-11837;11737-11748;10975-10977;12621-12623" event="script" value="goback.lua"/>
    <action itemid="2391-2394;12617" event="script" value="catch.lua" allowfaruse="1"/>

-- CASSINO

-- TV / CAM
    <action itemid="11416-11418;11395-11398;11401-11404" event="script" value="television.lua"/>
    <action itemid="12330" event="script" value="camera.lua"/>

-- PC
    <action itemid="11462-11469" event="script" value="computer.lua"/>

-- BOOST MACHINE
    <action itemid="12352-12357" event="script" value="boost.lua"/>

-- ORDER
    <action itemid="2550" event="script" value="order.lua" allowfaruse="1" blockwalls="0"/>

-- PEDRAS DE EVO
    <action itemid="11441;11454;12232;12242;12244;12417;12419;12401;12414;1820;1821;2037;2038;2396;2397;2398;2399" event="script" value="evolution.lua" allowfaruse="1"/>
              <action itemid="2400" event="script" value="Shiny stone.lua" allowfaruse="1"/>

  </actions>

                                                            vps-plano-01.png

 

                                                                                                                    http://www.weblara.com.br/

Link para o post
Compartilhar em outros sites

Coloca isto aqui no autoloot.lua:

 
local toloot = {11441, 11441, 11443, 11444, 11445, 11446, 11447, 11448, 11449,11450, 11451, 11452, 11453, 11454, 12618, 12232, 12244} -- PREFERENCIAL - SE QUISER APENAS COM ALGUNS ITENS
local useSpecific = false --True para lotear somente os itens que estiverem na tabela toloot, false para todos os itens do corpse
function onUse(cid, item, frompos, item2, topos)
if getItemAttribute(item.uid, "corpseowner") ~= cid then
doPlayerSendCancel(cid, "You're not the owner.")
return true
end
local items = {}
for x=0, (getContainerSize(item.uid)) do
local itens = getContainerItem(item.uid, x)
if useSpecific == true then
    if isInArray(toloot, itens.itemid) then
        table.insert(items, {i=itens.itemid, q=itens.type})
        doRemoveItem(itens.uid)
        break
    end
else
table.insert(items, {i=itens.itemid, q=itens.type})
doRemoveItem(itens.uid)
end
end
for y=1, #items do
doPlayerAddItemStacking(cid, items[y].i, items[y].q)
doPlayerSendTextMessage(cid, 20, "Looted "..items[y].q.."x "..getItemNameById(items[y].i)..".")
end
if #items > 0 then
return true
else
return false
end
end
--[[
AUTO LOOT BY GABRIEL SALES
SE QUISER ATIVAR O AUTOLOOT APENAS PARA ALGUNS ITENS, ADICIONE OS IDS NA TABELA toloot E TIRE OS COMENTÁRIOS(--).
--]]
Editado por otaviogfl (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

não está indo será por causa do meu some fuctions?

olha ele ai

 

function getStringOfTaskArray(array)
if type(array) ~= 'table' or not next(array) then return "" end

local result = {}
for _, value in ipairs(array) do
local thing, num = (type(value[1]) == 'string' and value[1] or getItemNameById(value[1])), value[2]
table.insert(result, (_ == 1 and "" or ", ")..num.." "..thing..(num == 1 and "" or "s"))
end
result[#result] = " and"..(result[#result]:sub(2,#result[#result]))
return table.concat(result)
end

function getVitalityByMaster(cid)
if not isCreature(cid) then return 0 end
local ball = getPlayerSlotItem(cid, 8).uid
if not ball or ball <= 1 or not pokes[getItemAttribute(ball, 'poke')] then return true end
return pokes[getItemAttribute(ball, 'poke')].vitality * (getPlayerLevel(cid) + (getItemAttribute(ball, 'boost') or 0))
end

function onPokeHealthChange(cid, zerar)
if not isCreature(cid) then return true end
if zerar then doPlayerSendCancel(cid, '#ph#,0,0') end
local ball = getPlayerSlotItem(cid, 8).uid
if not ball or ball <= 1 or not pokes[getItemAttribute(ball, 'poke')] then return true end

if #getCreatureSummons(cid) >= 1 and getPlayerStorageValue(cid, 212124) <= 0 then --alterado v1.6
local pokemon = getCreatureSummons(cid)[1]
local pokelife = (getCreatureHealth(pokemon) / getCreatureMaxHealth(pokemon))
doItemSetAttribute(ball, "hp", pokelife)
end

local rd = 1 - (tonumber(getItemAttribute(ball, "hp")))
local maxHp = HPperVITsummon * getVitalityByMaster(cid)
local hp = maxHp -(maxHp * rd)
doPlayerSendCancel(cid, '#ph#,'.. math.floor(hp) ..','.. math.floor(maxHp))
end


function addPokeToPlayer(cid, pokemon, boost, gender, ball, unique)             --alterado v1.9 \/ peguem ele todo...
local genders = {
["male"] = 4,
["female"] = 3,
[1] = 4,
[0] = 3,
[4] = 4,
[3] = 3,
}
if not isCreature(cid) then return false end

local pokemon = doCorrectString(pokemon)
if not pokes[pokemon] then return false end

   local GENDER = (gender and genders[gender]) and genders[gender] or getRandomGenderByName(pokemon)
   local btype = (ball and pokeballs[ball]) and ball or isShinyName(pokemon) and "shinynormal" or "normal"
   local happy = 250

   if (getPlayerFreeCap(cid) >= 6 and not isInArray({5, 6}, getPlayerGroupId(cid))) or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then
      item = doCreateItemEx(11826)
   else
      item = addItemInFreeBag(getPlayerSlotItem(cid, 3).uid, 11826, 1)   
   end
   if not item then return false end

   doItemSetAttribute(item, "poke", pokemon)
   doItemSetAttribute(item, "hp", 1)
   doItemSetAttribute(item, "happy", happy)
   doItemSetAttribute(item, "gender", GENDER)
   doSetItemAttribute(item, "hands", 0)
   doItemSetAttribute(item, "description", "Contains a "..pokemon..".")
   doItemSetAttribute(item, "fakedesc", "Contains a "..pokemon..".")
   if boost and tonumber(boost) and tonumber(boost) > 0 and tonumber(boost) <= 50 then
      doItemSetAttribute(item, "boost", boost)
   end
   if unique then
      doItemSetAttribute(item, "unique", getCreatureName(cid))
   end
                                                                             
   if (getPlayerFreeCap(cid) >= 6 and not isInArray({5, 6}, getPlayerGroupId(cid))) or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then
      doPlayerSendMailByName(getCreatureName(cid), item, 1)
      sendMsgToPlayer(cid, 27, "You are already holding six pokemons, so your new pokemon was sent to your depot.")
   end
   if (isShinyName(pokemon) or (boost and tonumber(boost) and tonumber(boost) >= 10)) and pokeballs["shiny"..btype] then
      doTransformItem(item, pokeballs["shiny"..btype].on)
   else
      doTransformItem(item, pokeballs[btype].on)
   end
return true
end
---------------------------

function unLock(ball)                                                             
if not ball or ball <= 0 then return false end
if getItemAttribute(ball, "lock") and getItemAttribute(ball, "lock") > 0 then
   local vipTime = getItemAttribute(ball, "lock")
   local timeNow = os.time()
   local days = math.ceil((vipTime - timeNow)/(24 * 60 * 60))
   if days <= 0 then
      doItemEraseAttribute(ball, "lock")    
      doItemEraseAttribute(ball, "unique")
      return true
   end
end
return false
end

function getGuildMembersOnline(GuildId)
local players = {}
for _, pid in pairs(getPlayersOnline()) do
    if getPlayerGuildId(pid) == tonumber(GuildId) then
       table.insert(players, pid)
    end
end                                                   --by Vodkart
return #players > 0 and players or false
end

function getGuildMembers(GuildId)
local players,query = {},db.getResult("SELECT `name` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = " .. GuildId .. ");")
if (query:getID() ~= -1) then  
   repeat
         table.insert(players,query:getDataString("name"))
   until not query:next()                           --by Vodkart
   query:free()
end
return #players > 0 and players or false
end
--/////////////////////////////////////////////////////////////////////////////////---
function sendMsgToPlayer(cid, tpw, msg)      --alterado v1.7 \/\/\/
if not isCreature(cid) or not tpw or not msg then return true end
return doPlayerSendTextMessage(cid, tpw, msg)
end

function getPlayerDesc(cid, thing, TV)
if (not isCreature(cid) or not isCreature(thing)) and not TV then return "" end

local pos = getThingPos(thing)
local ocup = youAre[getPlayerGroupId(thing)]
local rank = (getPlayerStorageValue(thing, 86228) <= 0) and "a Pokemon Trainer" or lookClans[getPlayerStorageValue(thing, 86228)][getPlayerStorageValue(thing, 862281)]
local name = thing == cid and "yourself" or getCreatureName(thing)     
local art = thing == cid and "You are" or (getPlayerSex(thing) == 0 and "She is" or "He is")
   
local str = {}
table.insert(str, "You see "..name..". "..art.." ")
if youAre[getPlayerGroupId(thing)] then
   table.insert(str, (ocup).." and "..rank.." from ".. getTownName(getPlayerTown(thing))..".")       
else
   table.insert(str, (rank).." from ".. getTownName(getPlayerTown(thing))..".")
end
if getPlayerGuildId(thing) > 0 then
   table.insert(str, " "..art.." "..getPlayerGuildRank(thing).." from the "..getPlayerGuildName(thing)..".")
end
if TV then
   table.insert(str, " "..art.." watching TV.")
end
table.insert(str, ((isPlayer(cid) and youAre[getPlayerGroupId(cid)]) and "\nPosition: [X: "..pos.x.."][Y: "..pos.y.."][Z: "..pos.z.."]" or ""))

return table.concat(str)
end
-------------------------------------------------------------------------------------------------   /\/\
function getLivePokeballs(cid, container, duel)
    if not isCreature(cid) then return {} end     
    if not isContainer(container) then return {} end
    local items = {}
    ---
    local ballSlot = getPlayerSlotItem(cid, 8)
    if ballSlot.uid ~= 0 then
       for a, b in pairs (pokeballs) do
           if ballSlot.itemid == b.on or ballSlot.itemid == b.use then
              if duel and getPlayerLevel(cid) >= (pokes[getItemAttribute(ballSlot.uid, "poke")].level + getPokeballBoost(ballSlot)) then
                 table.insert(items, ballSlot.uid)                                                                      --alterado v1.8
              elseif not duel then
                 table.insert(items, ballSlot.uid)
              end
           end
       end
    end
    ---     
    if isContainer(container) and getContainerSize(container) > 0 then      
        for slot=0, (getContainerSize(container)-1) do
            local item = getContainerItem(container, slot)
                if isContainer(item.uid) then
                    local itemsbag = getPokeballsInContainer(item.uid)
                    for i=0, #itemsbag do
                        if not isInArray(items, itemsbag[i]) then
                           table.insert(items, itemsbag[i])
                        end
                    end
                elseif isPokeball(item.itemid) then
                    for a, b in pairs (pokeballs) do
                        if item.itemid == b.on then
                           if duel and getPlayerLevel(cid) >= (pokes[getItemAttribute(item.uid, "poke")].level + getPokeballBoost(item)) then    
                              table.insert(items, item.uid)                                            --alterado v1.8
                           elseif not duel then
                              table.insert(items, item.uid)
                           end
                        end
                    end
                end
        end
    end
return items
end

function addItemInFreeBag(container, item, num)
if not isContainer(container) or not item then return false end                                             
if not num or num <= 0 then num = 1 end                                            --alterado v1.6.1
if getContainerSize(container) < getContainerCap(container) then
   return doAddContainerItem(container, item, num)
else
   for slot = 0, (getContainerSize(container)-1) do
       local container2 = getContainerItem(container, slot)
       if isContainer(container2.uid) and getContainerSize(container2.uid) < getContainerCap(container2.uid) then
          return doAddContainerItem(container2.uid, item, num)
       end
   end
end
return false
end
------------------------------------------------------------------------------------------------------
function pokeHaveReflect(cid)
if not isCreature(cid) then return false end
local table = getTableMove(cid, "Reflect")
if table and table.name then     --alterado v1.6
   return true
end
return false
end
------------------------------------------------------------------------------------------------------
function nextHorario(cid)
    horarioAtual = os.date("%X")
    horario = string.explode(horarioAtual, ":")
    
    for i = 1, #horas do
        horarioComparacao = horas[i]
        horarioComp = string.explode(horarioComparacao, ":")
        ---------------
        if tonumber(horarioComp[1]) > tonumber(horario[1]) then
           return horarioComparacao                                
        elseif tonumber(horarioComp[1]) == tonumber(horario[1]) and tonumber(horario[2]) < tonumber(horarioComp[2]) then
           return horarioComparacao
        end
    end
    return horas[1]                                  
end                                                               

function getTimeDiff(timeDiff)
local dateFormat = {
{'hour', timeDiff / 60 / 60}, --6%
{'min', timeDiff / 60 % 60},
}
local out = {}                                   
for k, t in ipairs(dateFormat) do
    local v = math.floor(t[2])
    if(v > -1) then
         table.insert(out, (k < #dateFormat and '' or ' and ') .. v .. '' .. (v <= 1 and t[1] or t[1].."s"))
    end
end
if tonumber(dateFormat[1][2]) == 0 and tonumber(dateFormat[2][2]) == 0 then
   return "seconds"
end
return table.concat(out)
end

function getTimeDiff2(timeDiff)
local dateFormat = {
{'hour', timeDiff / 60 / 60}, --6%
{'min', timeDiff / 60 % 60},
{'sec', timeDiff % 60},
}
local out = {}                                  
for k, t in ipairs(dateFormat) do
    local v = math.floor(t[2])
    if(v > 0) then
         table.insert(out, (k < #dateFormat and ' ' or ' and ') .. v .. '' .. (v <= 1 and t[1] or t[1].."s"))
    end
end
return table.concat(out)
end

function showTimeDiff(timeComp)
local b = string.explode(os.date("%X"), ":")
local c = string.explode(timeComp, ":")
    ---
    local d, m, y = os.date("%d"), os.date("%m"), os.date("%Y")
    local hAtual, mAtual = tonumber(b[1]), tonumber(b[2])
    local hComp, mComp = tonumber(c[1]), tonumber(c[2])
    ---
    local t = os.time{year= y, month= m, day= d, hour= hAtual, min= mAtual}
    local t1 = os.time{year= y, month= m, day= d, hour= hComp, min= mComp}
    ---                                                                       
    comparacao = t1-t
    if hComp < hAtual then
       v = os.time{year= y, month= m, day= d, hour= 24, min= 0}
       v2 = os.time{year= y, month= m, day= d, hour= 0, min= 0}
       comparacao = (v-t)+(t1-v2)
    end
return getTimeDiff(comparacao)
end
-------------------------------------------------------------------------
function cleanCMcds(item)
if item ~= 0 then
   for c = 1, 15 do              --alterado v1.5
      local str = "cm_move"..c
      setCD(item, str, 0)
   end
end
end

function ehNPC(cid)   --alterado v1.9
return isCreature(cid) and not isPlayer(cid) and not isSummon(cid) and not isMonster(cid)
end

function ehMonstro(cid)   --alterado v1.9
return cid and cid >= AUTOID_MONSTERS and cid < AUTOID_NPCS and getCreatureMaster(cid) == cid
end

function doAppear(cid)    --Faz um poke q tava invisivel voltar a ser visivel...
if not isCreature(cid) then return true end
    doRemoveCondition(cid, CONDITION_INVISIBLE)
    doRemoveCondition(cid, CONDITION_OUTFIT)
    doCreatureSetHideHealth(cid, false)
    if getCreatureName(cid) == "Ditto" and pokes[getPlayerStorageValue(cid, 1010)] and getPlayerStorageValue(cid, 1010) ~= "Ditto" then
       if isSummon(cid) then
          local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
          doSetCreatureOutfit(cid, {lookType = getItemAttribute(item.uid, "transOutfit")}, -1)   --alterado v1.6.1
       end
    end
end

function doDisapear(cid)   --Faz um pokemon ficar invisivel
if not isCreature(cid) then return true end
doCreatureAddCondition(cid, permanentinvisible)
doCreatureSetHideHealth(cid, true)
doSetCreatureOutfit(cid, {lookType = 2}, -1)
end

function hasTile(pos)    --Verifica se tem TILE na pos
pos.stackpos = 0
if getTileThingByPos(pos).itemid >= 1 then
   return true
end
return false
end

function getThingFromPosWithProtect(pos)  --Pega uma creatura numa posi?o com prote?es
if hasTile(pos) then
   if isCreature(getRecorderCreature(pos)) then
      return getRecorderCreature(pos)
   else
      pos.stackpos = 253
      pid = getThingfromPos(pos).uid
   end
else
   pid = getThingfromPos({x=1,y=1,z=10,stackpos=253}).uid
end
return pid
end

function getTileThingWithProtect(pos)    --Pega um TILE com prote?es
if hasTile(pos) then
pos.stackpos = 0
   pid = getTileThingByPos(pos)
else
   pid = getTileThingByPos({x=1,y=1,z=10,stackpos=0})
end
return pid
end

function canAttackOther(cid, pid)         --Function q verifica se um poke/player pode atacar outro poke/player

if not isCreature(cid) or not isCreature(pid) then return "Cant" end

local master1 = isSummon(cid) and getCreatureMaster(cid) or cid
local master2 = isSummon(pid) and getCreatureMaster(pid) or pid
   
   ----             
   if getPlayerStorageValue(master1, 6598754) >= 5 and getPlayerStorageValue(master2, 6598754) >= 5 then
      if getPlayerStorageValue(master1, 6598754) ~= getPlayerStorageValue(master2, 6598754) then
         if isDuelingAgainst(master1, master2) then   --alterado v1.8
            if isSummon(cid) and isPlayer(pid) then
               return "Cant"
            else
               return "Can"
            end
         end
      end
   end
   ----              pvp system
   if getPlayerStorageValue(master1, 6598754) >= 1 and getPlayerStorageValue(master2, 6598755) >= 1 then
      return "Can"
   end
   if getPlayerStorageValue(master1, 6598755) >= 1 and getPlayerStorageValue(master2, 6598754) >= 1 then  ---estar em times diferentes
      return "Can"
   end
   ----
   if ehMonstro(cid) or ehMonstro(pid) then
      return "Can"
   end

return "Cant"
end
   
      
function stopNow(cid, time)    --function q faz o poke/player ficar imovel por um tempo
if not isCreature(cid) or not tonumber(time) or isSleeping(cid) then return true end

local function podeMover(cid)                         --alterado v1.9 \/
if isCreature(cid) then mayNotMove(cid, false) end
end

mayNotMove(cid, true)
addEvent(podeMover, time, cid)
end

function doReduceStatus(cid, off, def, agi)   --reduz os status
if not isCreature(cid) then return true end
local A = getOffense(cid)
local B = getDefense(cid)
local C = getSpeed(cid)

if off > 0 then
   setPlayerStorageValue(cid, 1001, A - off)
end
if def > 0 then
   setPlayerStorageValue(cid, 1002, B - def)
end
if agi > 0 then
   setPlayerStorageValue(cid, 1003, C - agi)
   if getCreatureSpeed(cid) ~= 0 then
      doRegainSpeed(cid)
   end                                              --alterado v1.5  functions arrumadas...
end
end

function doRaiseStatus(cid, off, def, agi, time)  
if not isCreature(cid) then return true end
local A = getOffense(cid)
local B = getDefense(cid)
local C = getSpeed(cid)

if off > 0 then
   setPlayerStorageValue(cid, 1001, A * off)
end
if def > 0 then
   setPlayerStorageValue(cid, 1002, B * def)
end
if agi > 0 then
   setPlayerStorageValue(cid, 1003, C + agi)
   if getCreatureSpeed(cid) ~= 0 then
      doRegainSpeed(cid)
   end
end

local D = getOffense(cid)
local E = getDefense(cid)
local F = getSpeed(cid)
---------------------------
local G = D - A
local H = E - B
local I = F - C

addEvent(doReduceStatus, time*1000, cid, G, H, I)
end


function BackTeam(cid)          
  if isCreature(cid) then
     local summon = getCreatureSummons(cid)   --alterado v1.6
     for i = 2, #summon do
         doSendMagicEffect(getThingPos(summon[i]), 211)
         doRemoveCreature(summon[i])
     end
     setPlayerStorageValue(cid, 637501, -1)
  end  
end
    
function choose(...) -- by mock
    local arg = {...}
    return arg[math.random(1,#arg)]
end

function AddPremium(cid, days)
local function removerPlayer(cid)
if isCreature(cid) then
   doRemoveCreature(cid)
end
end

db.executeQuery("UPDATE `accounts` SET `premdays` = '"..days.."' WHERE `accounts`.`id` = ".. getPlayerAccountId(cid) ..";")
doPlayerSendTextMessage(cid,25,"Voc?ser?kickado em 5 segundos.")    
addEvent(removerPlayer, 5*1000, cid)     
return TRUE
end

function isShiny(cid)
return isCreature(cid) and string.find(getCreatureName(cid), "Shiny")  --alterado v1.9
end

function isShinyName(name)        
return tostring(name) and string.find(doCorrectString(name), "Shiny") --alterado v1.9
end

function doConvertTypeToStone(type, string)
local t = {
["fly"] = {heart, "heart"},
["flying"] = {heart, "heart"},
["normal"] = {heart, "heart"},
["fire"] = {fire, "fire"},
["grass"] = {leaf, "leaf"},
["leaf"] = {leaf, "leaf"},
["water"] = {water, "water"},
["poison"] = {venom, "venom"},
["venom"] = {venom, "venom"},
["electric"] = {thunder, "thunder"},
["thunder"] = {thunder, "thunder"},
["rock"] = {rock, "rock"},
["fight"] = {punch, "punch"},
["fighting"] = {punch, "punch"},
["bug"] = {coccon, "coccon"},
["dragon"] = {crystal, "crystal"},
["dark"] = {dark, "dark"},
["ghost"] = {dark, "dark"},
["ground"] = {earth, "earth"},
["earth"] = {earth, "earth"},
["psychic"] = {enigma, "enigma"},
["steel"] = {metal, "metal"},
["metal"] = {metal, "metal"},
["ice"] = {ice, "ice"},
["boost"] = {boostStone, "boost"},      --alterado v1.9
}

if string then
return t[type][2]
else
return t[type][1]
end
end

function doConvertStoneIdToString(stoneID)
local t = {
[11453] = "Heart Stone",
[11441] = "Leaf Stone",
[11442] = "Water Stone",
[11443] = "Venom Stone",
[11444] = "Thunder Stone",
[11445] = "Rock Stone",
[11446] = "Punch Stone",
[11447] = "Fire Stone",               --alterado v1.6
[11448] = "Cocoon Stone",
[11449] = "Crystal Stone",
[11450] = "Darkess Stone",
[11451] = "Earth Stone",
[11452] = "Enigma Stone",
[11454] = "Super Stone",
[12244] = "King's Rock",
[12232] = "Metal Stone",
[12242] = "Sun Stone",
[1820] = "Charizardite X",
[1821] = "Charizardite Y",
[2037] = "Blazikenite",
[2038] = "Tyranitarite",
[2397] = "Blastoisinite",
[2396] = "Alakazite",
[2398] = "Gengarite",
[2399] = "Lucarionite",
[12401] = "Shiny Fire Stone",
[12402] = "Shiny Water Stone",
[12403] = "Shiny Leaf Stone",
[12404] = "Shiny Heart Stone",
[12405] = "Shiny Enigma Stone",
[12406] = "Shiny Rock Stone",
[12407] = "Shiny Venom Stone",
[12408] = "Shiny Super Stone",
[12409] = "Shiny Thunder Stone",
[12410] = "Shiny Crystal Stone",
[12411] = "Shiny Cocoon Stone",
[12412] = "Shiny Darkness Stone",
[12413] = "Shiny Punch Stone",
[12414] = "Shiny Earth Stone",
[boostStone] = "Boost Stone",  --alterado v1.9
}
if t[stoneID] then
return t[stoneID]
else
return ""
end
end

function isStone(id)
if id >= leaf and id <= super then
return true
end
if id == boostStone then  --alterado v1.9
return true
end
if id == 12232 or id == 12242 or id == 12244 or id == 12245 then
return true                                 
end
if (id >= sfire and id <= searth) or id == 12417 or id == 12419 then
return true
end
return false
end

function isWater(id)
return tonumber(id) and id >= 4820 and id <= 4825 --alterado v1.9
end

function getTopCorpse(position)
local pos = position
for n = 1, 255 do
    pos.stackpos = n
    local item = getTileThingByPos(pos)
    if item.itemid >= 2 and (string.find(getItemNameById(item.itemid), "fainted ") or string.find(getItemNameById(item.itemid), "defeated ")) then
       return getTileThingByPos(pos)
    end
end
return null
end

bpslot = CONST_SLOT_BACKPACK

function hasPokemon(cid)
    if not isCreature(cid) then return false end
    if getCreatureMana(cid) <= 0 then return false end
    if #getCreatureSummons(cid) >= 1 then return true end
    local item = getPlayerSlotItem(cid, CONST_SLOT_FEET)
    local bp = getPlayerSlotItem(cid, bpslot)
    for a, b in pairs (pokeballs) do
        if item.itemid == b.on or item.itemid == b.use then
        return true                              --alterado v1.4
        end
        if #getItemsInContainerById(bp.uid, b.on) >= 1 then
        return true
        end
    end
return false
end

function isNpcSummon(cid)
return isNpc(getCreatureMaster(cid))
end

function getPokemonHappinessDescription(cid)
    if not isCreature(cid) then return true end
    local str = {}
    if getPokemonGender(cid) == SEX_MALE then
        table.insert(str, "He")
    elseif getPokemonGender(cid) == SEX_FEMALE then
        table.insert(str, "She")
    else
        table.insert(str, "It")
    end
    local h = getPlayerStorageValue(cid, 1008)
    if h >= tonumber(getConfigValue('PokemonStageVeryHappy')) then
        table.insert(str, " is very happy with you!")
    elseif h >= tonumber(getConfigValue('PokemonStageHappy')) then
        table.insert(str, " is happy.")
    elseif h >= tonumber(getConfigValue('PokemonStageOK')) then
        table.insert(str, " is unhappy.")
    elseif h >= tonumber(getConfigValue('PokemonStageSad')) then
        table.insert(str, " is sad.")
    elseif h >= tonumber(getConfigValue('PokemonStageMad')) then
        table.insert(str, " is mad.")
    else
        table.insert(str, " is very mad at you!")
    end
return table.concat(str)
end

function doSetItemAttribute(item, key, value)
doItemSetAttribute(item, key, value)
end

function deTransform(cid, check)
    if not isCreature(cid) then return true end

    local m = getCreatureMaster(cid)
    local p = getPlayerSlotItem(m, 8)

    if getItemAttribute(p.uid, "transTurn") ~= check then return true end

    setPlayerStorageValue(cid, 1010, getCreatureName(cid) == "Ditto" and "Ditto" or "Shiny Ditto")        --edited
    doRemoveCondition(cid, CONDITION_OUTFIT)
    doSendMagicEffect(getThingPos(cid), 184)
    doCreatureSay(cid, "DITTO!", TALKTYPE_MONSTER)
    doItemSetAttribute(p.uid, "transBegin", 0)
    doItemSetAttribute(p.uid, "transLeft", 0)
    doItemEraseAttribute(p.uid, "transName")
    adjustStatus(cid, p.uid, true, true, true)
end

function isTransformed(cid)
return isCreature(cid) and not isInArray({-1, "Ditto", "Shiny Ditto"}, getPlayerStorageValue(cid, 1010))  --alterado v1.9
end

function doSendFlareEffect(pos)
    local random = {28, 29, 79}
    doSendMagicEffect(pos, random[math.random(1, 3)])
end

function isDay()
    local a = getWorldTime()
    if a >= 360 and a < 1080 then
    return true
    end
return false
end

function doPlayerSendTextWindow(cid, p1, p2)
    if not isCreature(cid) then return true end
    local item = 460
    local text = ""
    if type(p1) == "string" then
        doShowTextDialog(cid, item, p1)
    else
        doShowTextDialog(cid, p1, p2)
    end
end

function getClockString(tw)
    local a = getWorldTime()
    local b = a / 60
    local hours = math.floor(b)
    local minut = a - (60 * hours)

    if not tw then
        if hours < 10 then
            hours = "0"..hours..""
        end
        if minut < 10 then
            minut = "0"..minut..""
        end
    return hours..":"..minut
    else
        local sm = "a.m"
        if hours >= 12 then
            hours = hours - 12
            sm = "p.m"
        end
        if hours < 10 then
            hours = "0"..hours..""
        end
        if minut < 10 then
            minut = "0"..minut..""
        end
    return hours..":"..minut.." "..sm
    end
end

function doCorrectPokemonName(poke)
return doCorrectString(poke)
end

function doCorrectString(str)
local name = str:explode(" ")  --alterado v1.9
local final = {}
for _, s in ipairs(name) do
    table.insert(final, s:sub(1, 1):upper()..s:sub(2, #s):lower())
end
return table.concat(final, (name[2] and " " or ""))
end   

function getHappinessRate(cid)
    if not isCreature(cid) then return 1 end
    local a = getPlayerStorageValue(cid, 1008)
        if a == -1 then return 1 end
    if a >= getConfigValue('PokemonStageVeryHappy') then
        return happinessRate[5].rate
    elseif a >= getConfigValue('PokemonStageHappy') then
        return happinessRate[4].rate
    elseif a >= getConfigValue('PokemonStageOK') then
        return happinessRate[3].rate
    elseif a >= getConfigValue('PokemonStageSad') then
        return happinessRate[2].rate
    else
        return happinessRate[1].rate
    end
return 1
end

function doBodyPush(cid, target, go, pos)
    if not isCreature(cid) or not isCreature(target) then
        doRegainSpeed(cid)
        doRegainSpeed(target)
    return true
    end
        if go then
            local a = getThingPos(cid)
            doChangeSpeed(cid, -getCreatureSpeed(cid))
                if not isPlayer(target) then
                    doChangeSpeed(target, -getCreatureSpeed(target))
                end
            doChangeSpeed(cid, 800)
            doTeleportThing(cid, getThingPos(target))
            doChangeSpeed(cid, -800)
            addEvent(doBodyPush, 350, cid, target, false, a)
        else
            doChangeSpeed(cid, 800)
            doTeleportThing(cid, pos)
            doRegainSpeed(cid)
            doRegainSpeed(target)
        end
end

function doReturnPokemon(cid, pokemon, pokeball, effect, hideeffects, blockevo)

    --////////////////////////////////////////////////////////////////////////////////////////--
    checkDuel(cid)                                                                      --alterado v1.6 duel system
    --////////////////////////////////////////////////////////////////////////////////////////--
    if getPlayerStorageValue(cid, 52480) >= 1 and getPlayerStorageValue(cid, 52484) ~= 10 then
       return sendMsgToPlayer(cid, 27, "You can't do that while the duel don't begins!")        --alterado v1.8
    end
    --////////////////////////////////////////////////////////////////////////////////////////--
    
    if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 212124) <= 0 then     --alterado v1.6
       if getPlayerStorageValue(cid, 637501) == -2 or getPlayerStorageValue(cid, 637501) >= 1 then  
          BackTeam(cid)       
       end
    end
    -----------------
    local edit = true

    if not pokeball then
        pokeball = getPlayerSlotItem(cid, 8)
    end

    if blockevo then
        edit = false
        doPlayerSendCancel(cid, "Your pokemon couldn't evolve due to server mistakes, please wait until we fix the problem.")
    end

    local happy = getPlayerStorageValue(pokemon, 1008)
    local hunger = getPlayerStorageValue(pokemon, 1009)
    local pokelife = (getCreatureHealth(pokemon) / getCreatureMaxHealth(pokemon))

    if edit then
        doItemSetAttribute(pokeball.uid, "happy", happy)
        doItemSetAttribute(pokeball.uid, "hunger", hunger)
        doItemSetAttribute(pokeball.uid, "hp", pokelife)
    end

    if getCreatureName(pokemon) == "Ditto" then
        if isTransformed(pokemon) then
            local left = getItemAttribute(pokeball.uid, "transLeft") - (os.clock() - getItemAttribute(pokeball.uid, "transBegin"))
            doItemSetAttribute(pokeball.uid, "transLeft", left)
        end
    end

    if hideeffects then
        doRemoveCreature(pokemon)
    return true
    end

    local pokename = getPokeName(pokemon)

    local mbk = gobackmsgs[math.random(1, #gobackmsgs)].back:gsub("doka", pokename)

    if getCreatureCondition(cid, CONDITION_INFIGHT) then
        if isCreature(getCreatureTarget(cid)) then
            doItemSetAttribute(pokeball.uid, "happy", happy - 5)
        else
            doItemSetAttribute(pokeball.uid, "happy", happy - 2)
        end
    end

    doTransformItem(pokeball.uid, pokeball.itemid-1)
    doCreatureSay(cid, mbk, TALKTYPE_SAY)

    doSendMagicEffect(getCreaturePosition(pokemon), effect)

    doRemoveCreature(pokemon)

    unLock(pokeball.uid) --alterado v1.8
    
    if useOTClient then
       doPlayerSendCancel(cid, '12//,hide')  --alterado v1.7
    end
    
    if useKpdoDlls then
        doUpdateMoves(cid)
    end

end

local EFFECTS = {
    --[OutfitID] = {Effect}
    ["Magmar"] = 35,                --alterado v1.5
    ["Jynx"] = 17,   
    ["Shiny Jynx"] = 17,    
    ["Piloswine"] = 205,  --alterado v1.8
    ["Swinub"] = 205,
}

function doGoPokemon(cid, item)

    if getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 then
    return true
    end
---------------------------------------------------------------
local ballName = getItemAttribute(item.uid, "poke")

   btype = getPokeballType(item.itemid)                   

    local effect = pokeballs[btype].effect
        if not effect then
            effect = 21
        end
-----------------------------------------------------------------
    if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_FEET).uid then
        doPlayerSendCancel(cid, "You must put your pokeball in the correct place!")
    return TRUE
    end

    local thishp = getItemAttribute(item.uid, "hp")

    if thishp <= 0 then
        if isInArray(pokeballs[btype].all, item.itemid) then
            doTransformItem(item.uid, pokeballs[btype].off)
            doItemSetAttribute(item.uid, "hp", 0)
            doPlayerSendCancel(cid, "This pokemon is fainted.")
            return true
        end
    end

    local pokemon = getItemAttribute(item.uid, "poke")

    if not pokes[pokemon] then
    return true
    end

----------------------- Sistema de nao poder carregar mais que 3 pokes lvl baixo e + q 1 poke de lvl medio/alto ---------------------------------
if not isInArray({5, 6}, getPlayerGroupId(cid)) then
   local balls = getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid)      --alterado v1.9 \/
   local low = {}
   local lowPokes = {"Rattata", "Caterpie", "Weedle", "Oddish", "Pidgey", "Paras", "Poliwag", "Bellsprout", "Magikarp", "Hoppip", "Sunkern"}
   if #balls >= 1 then
      for _, uid in ipairs(balls) do
          local nome = getItemAttribute(uid, "poke")
          if not isInArray(lowPokes, pokemon) and nome == pokemon then
             return doPlayerSendTextMessage(cid, 27, "Sorry, but you can't carry two pokemons equals!")
          else
             if nome == pokemon then
                table.insert(low, nome)
             end
          end
      end
   end
if #low >= 3 then
   return doPlayerSendTextMessage(cid, 27, "Sorry, but you can't carry more than three pokemons equals of low level!")
end   
end
---------------------------------------------------------------------------------------------------------------------------------------------------

    local x = pokes[pokemon]
    local boosts = getItemAttribute(item.uid, "boost") or 0

    if getPlayerLevel(cid) < (x.level + boosts) then   --alterado v1.8 \/
    doPlayerSendCancel(cid, "You need level "..(x.level + boosts).." to use this pokemon.")
    return true
    end
    
    --------------------------------------------------------------------------------------
    shinysClan = {
    ["Shiny Fearow"] = {4, "Wingeon"},
    ["Shiny Flareon"] = {1, "Volcanic"},
    ["Shiny Vaporeon"] = {2, "Seavel"},
    ["Shiny Jolteon"] = {9, "Raibolt"},
    ["Shiny Hypno"] = {7, "Psycraft"},
    ["Shiny Golem"] = {3, "Orebound"},         
    ["Shiny Vileplume"] = {8, "Naturia"},
    ["Shiny Nidoking"] = {5, "Malefic"},
    ["Shiny Hitmontop"] = {6, "Gardestrike"},   
    }
    
    if shinysClan[pokemon] and (getPlayerGroupId(cid) < 4 or getPlayerGroupId(cid) > 6) then --alterado v1.9
       if getPlayerStorageValue(cid, 86228) ~= shinysClan[pokemon][1] then
          doPlayerSendCancel(cid, "You need be a member of the clan "..shinysClan[pokemon][2].." to use this pokemon!")
          return true   
       elseif getPlayerStorageValue(cid, 862281) ~= 5 then
          doPlayerSendCancel(cid, "You need be atleast rank 5 to use this pokemon!")
          return true
       end
    end
    --------------------------------------------------------------------------------------

    doSummonMonster(cid, pokemon)

    local pk = getCreatureSummons(cid)[1]
    if not isCreature(pk) then return true end
    
    ------------------------passiva hitmonchan------------------------------
    if isSummon(pk) then                                                  --alterado v1.8 \/
       if pokemon == "Shiny Hitmonchan" or pokemon == "Hitmonchan" then
          if not getItemAttribute(item.uid, "hands") then
             doSetItemAttribute(item.uid, "hands", 0)
          end
          local hands = getItemAttribute(item.uid, "hands")
          doSetCreatureOutfit(pk, {lookType = hitmonchans[pokemon][hands].out}, -1)
       end
    end
    -------------------------------------------------------------------------
    ---------movement magmar, jynx-------------
    if EFFECTS[getCreatureName(pk)] then     
       markPosEff(pk, getThingPos(pk))
       sendMovementEffect(pk, EFFECTS[getCreatureName(pk)], getThingPos(pk))   
    end
    --------------------------------------------------------------------------  

    if getCreatureName(pk) == "Ditto" then

        local left = getItemAttribute(item.uid, "transLeft")
        local name = getItemAttribute(item.uid, "transName")

        if left and left > 0 then
            setPlayerStorageValue(pk, 1010, name)
            doSetCreatureOutfit(pk, {lookType = getItemAttribute(item.uid, "transOutfit")}, -1)
            addEvent(deTransform, left * 1000, pk, getItemAttribute(item.uid, "transTurn"))
            doItemSetAttribute(item.uid, "transBegin", os.clock())
        else
            setPlayerStorageValue(pk, 1010, "Ditto")
        end
    end

    if isGhostPokemon(pk) then doTeleportThing(pk, getPosByDir(getThingPos(cid), math.random(0, 7)), false) end

    doCreatureSetLookDir(pk, 2)

    adjustStatus(pk, item.uid, true, true, true)
    doAddPokemonInOwnList(cid, pokemon)

    doTransformItem(item.uid, item.itemid+1)

    local pokename = getPokeName(pk) --alterado v1.7

    local mgo = gobackmsgs[math.random(1, #gobackmsgs)].go:gsub("doka", pokename)
    doCreatureSay(cid, mgo, TALKTYPE_SAY)

    doSendMagicEffect(getCreaturePosition(pk), effect)

    unLock(item.uid) --alterado v1.8
    
    local pk = getCreatureSummons(cid)[1]
local pb = getPlayerSlotItem(cid, 8).uid
local look = getItemAttribute(pb,"addon")
if not look then
doSetItemAttribute(pb,"addon",0)
return false
end
if look > 0 then
doSetCreatureOutfit(pk, {lookType = look}, -1)
return true
end

    if useKpdoDlls then
        doUpdateMoves(cid)
    end
end

function doRegainSpeed(cid)              --alterado v1.9 \/
if not isCreature(cid) then return true end

   local speed = PlayerSpeed
   if isMonster(cid) then
      speed = getSpeed(cid)
   elseif isPlayer(cid) and isInArray({4, 5, 6}, getPlayerGroupId(cid)) then
      speed = 200*getPlayerGroupId(cid)
   end
   
   doChangeSpeed(cid, -getCreatureSpeed(cid))
   if getCreatureCondition(cid, CONDITION_PARALYZE) == true then
      doRemoveCondition(cid, CONDITION_PARALYZE)
      addEvent(doAddCondition, 10, cid, paralizeArea2)             
   end
    
doChangeSpeed(cid, speed)
return speed
end

function isPosEqualPos(pos1, pos2, checkstackpos)
    if pos1.x ~= pos2.x or pos1.y ~= pos2.y and pos1.z ~= pos2.z then
    return false
    end
    if checkstackpos and pos1.stackpos and pos2.stackpos and pos1.stackpos ~= pos2.stackpos then
    return false
    end
return true
end

function getRandomGenderByName(name)
local rate = newpokedex[name]
    if not rate then return 0 end
    rate = rate.gender
    if rate == 0 then
        gender = 3
    elseif rate == 1000 then
        gender = 4
    elseif rate == -1 then
        gender = 0
    elseif math.random(1, 1000) <= rate then
        gender = 4
    else
        gender = 3
    end
return gender
end

function getRecorderPlayer(pos, cid)
    local ret = 0
    if cid and isPosEqual(getThingPos(cid), pos) then   --alterado v1.9
       return cid
    end
    local s = {}
    s.x = pos.x
    s.y = pos.y
    s.z = pos.z
        for a = 0, 255 do
            s.stackpos = a
            local b = getTileThingByPos(s).uid
            if b > 1 and isPlayer(b) and getCreatureOutfit(b).lookType ~= 814 then
                ret = b
            end
        end
return ret
end

function getRecorderCreature(pos, cid)
    local ret = 0
    if cid and isPosEqual(getThingPos(cid), pos) then   --alterado v1.9
       return cid
    end
    local s = {}
    s.x = pos.x
    s.y = pos.y
    s.z = pos.z
        for a = 0, 255 do
            s.stackpos = a
            local b = getTileThingByPos(s).uid
            if b > 1 and isCreature(b) and getCreatureOutfit(b).lookType ~= 814 then
                ret = b
            end
        end
return ret
end

function doCreatureSetOutfit(cid, outfit, time)
    doSetCreatureOutfit(cid, outfit, time)
end

function doMagicalFlower(cid, away)
    if not isCreature(cid) then return true end
    for x = -3, 3 do
        for y = -3, 3 do
        local a = getThingPos(cid)
        a.x = a.x + x
        a.y = a.y + y
            if away then
                doSendDistanceShoot(a, getThingPos(cid), 21)
            else
                doSendDistanceShoot(getThingPos(cid), a, 21)
            end
        end
    end
end        

function isItemPokeball(item)         --alterado v1.9 \/
if not item then return false end
for a, b in pairs (pokeballs) do
    if isInArray(b.all, item) then return true end
end
return false
end

function isPokeball(item)
return isItemPokeball(item)
end                                    --/\

function getPokeballType(id)
    for a, b in pairs (pokeballs) do
        if isInArray(b.all, id) then
            return a
        end
    end
return "none"
end

randomdiagonaldir = {
[NORTHEAST] = {NORTH, EAST},
[SOUTHEAST] = {SOUTH, EAST},
[NORTHWEST] = {NORTH, WEST},
[SOUTHWEST] = {SOUTH, WEST}}

function doFaceOpposite(cid)
local a = getCreatureLookDir(cid)
local d = {
[NORTH] = SOUTH,
[SOUTH] = NORTH,
[EAST] = WEST,
[WEST] = EAST,
[NORTHEAST] = SOUTHWEST,
[NORTHWEST] = SOUTHEAST,
[SOUTHEAST] = NORTHWEST,
[SOUTHWEST] = NORTHEAST}
doCreatureSetLookDir(cid, d[a])
end

function doFaceRandom(cid)
local a = getCreatureLookDir(cid)
local d = {
[NORTH] = {SOUTH, WEST, EAST},
[SOUTH] = {NORTH, WEST, EAST},
[WEST] = {SOUTH, NORTH, EAST},
[EAST] = {SOUTH, WEST, NORTH}}
doChangeSpeed(cid, 1)
doCreatureSetLookDir(cid, d[a][math.random(1, 3)])
doChangeSpeed(cid, -1)
end

function getFaceOpposite(dir)
local d = {
[NORTH] = SOUTH,
[SOUTH] = NORTH,
[EAST] = WEST,
[WEST] = EAST,
[NORTHEAST] = SOUTHWEST,
[NORTHWEST] = SOUTHEAST,
[SOUTHEAST] = NORTHWEST,
[SOUTHWEST] = NORTHEAST}
return d[dir]
end

function getResistance(cid, combat)
    if isPlayer(cid) then return false end
local poketype1 = pokes[getCreatureName(cid)].type
local poketype2 = pokes[getCreatureName(cid)].type2
local multiplier = 1
    if effectiveness[combat].super and isInArray(effectiveness[combat].super, poketype1) then
        multiplier = multiplier * 2
    end
    if poketype2 and effectiveness[combat].super and isInArray(effectiveness[combat].super, poketype2) then
        multiplier = multiplier * 2
    end
    if effectiveness[combat].weak and isInArray(effectiveness[combat].weak, poketype1) then
        multiplier = multiplier * 0.5
    end
    if poketype2 and effectiveness[combat].weak and isInArray(effectiveness[combat].weak, poketype2) then
        multiplier = multiplier * 0.5
    end
    if effectiveness[combat].non and isInArray(effectiveness[combat].non, poketype1) then
        multiplier = multiplier * 0
    end
    if poketype2 and effectiveness[combat].non and isInArray(effectiveness[combat].non, poketype2) then
        multiplier = multiplier * 0
    end

    if multiplier == 0.25 then
        multiplier = 0.5
    elseif multiplier == 4 then
        multiplier = 2
    end

return multiplier
end

function getCreatureDirectionToTarget(cid, target, ranged)
    if not isCreature(cid) then return true end
    if not isCreature(target) then return getCreatureLookDir(cid) end
    local dirs = {
    [NORTHEAST] = {NORTH, EAST},
    [SOUTHEAST] = {SOUTH, EAST},
    [NORTHWEST] = {NORTH, WEST},
    [SOUTHWEST] = {SOUTH, WEST}}
    local x = getDirectionTo(getThingPos(cid), getThingPos(target), false)
        if x <= 3 then return x
        else
            local xdistance = math.abs(getThingPos(cid).x - getThingPos(target).x)
            local ydistance = math.abs(getThingPos(cid).y - getThingPos(target).y)
                if xdistance > ydistance then
                    return dirs[x][2]
                elseif ydistance > xdistance then
                    return dirs[x][1]
                elseif isInArray(dirs[x], getCreatureLookDir(cid)) then
                    return getCreatureLookDir(cid)
                else
                    return dirs[x][math.random(1, 2)]
                end
        end
end

function getSomeoneDescription(cid)
    if isPlayer(cid) then return getPlayerNameDescription(cid) end
return getMonsterInfo(getCreatureName(cid)).description
end
    

function isGhostPokemon(cid)
    if not isCreature(cid) then return false end
    local ghosts = {"Gastly", "Haunter", "Gengar", "Shiny Gengar", "Misdreavus", "Shiny Abra"}
return isInArray(ghosts, getCreatureName(cid))
end

function updateGhostWalk(cid)
    if not isCreature(cid) then return false end
    local pos = getThingPos(cid)
    pos.x = pos.x + 1
    pos.y = pos.y + 1
    local ret = getThingPos(cid)
    doTeleportThing(cid, pos, false)
    doTeleportThing(cid, ret, false)
return true
end

function doRemoveElementFromTable(t, e)
    local ret = {}
    for a = 1, #t do
        if t[a] ~= e then
        table.insert(ret, t[a])
        end
    end
return ret
end

function doFaceCreature(sid, pos)
if not isCreature(sid) then return true end
    if getThingPos(sid).x == pos.x and getThingPos(sid).y == pos.y then return true end
    local ret = 0

    local ld = getCreatureLookDir(sid)
    local dir = getDirectionTo(getThingPos(sid), pos)
    local al = {
    [NORTHEAST] = {NORTH, EAST},
    [NORTHWEST] = {NORTH, WEST},
    [SOUTHEAST] = {SOUTH, EAST},
    [SOUTHWEST] = {SOUTH, WEST}}

    if dir >= 4 and isInArray(al[dir], ld) then return true end

    doChangeSpeed(sid, 1)
        if dir == 4 then
            ret = math.random(2, 3)
        elseif dir == 5 then
            ret = math.random(1, 2)
        elseif dir == 6 then
            local dirs = {0, 3}
            ret = dirs[math.random(1, 2)]
        elseif dir == 7 then
            ret = math.random(0, 1)
        else
            ret = getDirectionTo(getThingPos(sid), pos)
        end
doCreatureSetLookDir(sid, ret)
doChangeSpeed(sid, -1)
return true
end

function doCreatureAddCondition(cid, condition)
if not isCreature(cid) then return true end
doAddCondition(cid, condition)
end

function doCreatureRemoveCondition(cid, condition)
if not isCreature(cid) then return true end
doRemoveCondition(cid, condition)
end

function setCD(item, tipo, tempo)

    if not tempo or not tonumber(tempo) then
        doItemEraseAttribute(item, tipo)
    return true
    end

    doItemSetAttribute(item, tipo, "cd:"..(tempo + os.time()).."")
return tempo + os.time()
end

function getCD(item, tipo, limite)

    if not getItemAttribute(item, tipo) then
    return 0
    end

    local string = getItemAttribute(item, tipo):gsub("cd:", "")
    local number = tonumber(string) - os.time()

    if number <= 0 then
    return 0
    end

    if limite and limite < number then
        return 0
    end

return number
end

function doSendMoveEffect(cid, target, effect)
if not isCreature(cid) or not isCreature(target) then return true end
doSendDistanceShoot(getThingPos(cid), getThingPos(target), effect)
return true
end

function doSetItemActionId(uid, actionid)
doItemSetAttribute(uid, "aid", actionid)
return true
end

function threeNumbers(number)
    if number <= 9 then
    return "00"..number..""
    elseif number <= 99 then
    return "0"..number..""
    end
return ""..number..""
end

function isBr(cid)
if getPlayerStorageValue(cid, 105505) ~= -1 then
return true
end
return false
end

function isBeingUsed(ball)            
if not ball then return false end
for a, b in pairs (pokeballs) do           --alterado v1.9
    if b.use == ball then return true end
end
return false
end

function doRemoveTile(pos)-- Script by mock
pos.stackpos = 0
local sqm = getTileThingByPos(pos)
doRemoveItem(sqm.uid,1)
end

function doCreateTile(id,pos) -- By mock
doAreaCombatHealth(0,0,pos,0,0,0,CONST_ME_NONE)
doCreateItem(id,1,pos)
end

function hasSqm(pos)
local f = getTileThingByPos(pos)
if f.itemid ~= 0 and f.itemid ~= 1 then
return true
end
return false
end

function getPosDirs(p, dir) -- By MatheusMkalo
return dir == 1 and {x=p.x-1, y=p.y, z=p.z} or dir == 2 and {x=p.x-1, y=p.y+1, z=p.z} or dir == 3 and {x=p.x, y=p.y+1, z=p.z} or dir == 4 and {x=p.x+1, y=p.y+1, z=p.z} or dir == 5 and {x=p.x+1, y=p.y, z=p.z} or dir == 6 and {x=p.x+1, y=p.y-1, z=p.z} or dir == 7 and {x=p.x, y=p.y-1, z=p.z} or dir == 8 and {x=p.x-1, y=p.y-1, z=p.z}
end

function canWalkOnPos(pos, creature, pz, water, sqm, proj)
if not pos then return false end
if not pos.x then return false end
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid <= 1 and sqm then return false end
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 919 then return false end
if isInArray({4820, 4821, 4822, 4823, 4824, 4825}, getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid) and water then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false end
    local n = not proj and 3 or 2                                    --alterado v1.6
    for i = 0, 255 do
        pos.stackpos = i                           
        local tile = getTileThingByPos(pos)        
        if tile.itemid ~= 0 and i ~= 253 and not isCreature(tile.uid) then     --edited
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end   
return true
end

function canWalkOnPos2(pos, creature, pz, water, sqm, proj)     --alterado v1.6
if not pos then return false end
if not pos.x then return false end
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid <= 1 and sqm then return false end
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 919 then return false end
if isInArray({4820, 4821, 4822, 4823, 4824, 4825}, getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid) and water then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false end
    --[[local n = not proj and 3 or 2
    for i = 0, 255 do
        pos.stackpos = i                           --edited pra retirar um bug.. ;x
        local tile = getTileThingByPos(pos)        
        if tile.itemid ~= 0 and i ~= 253 and not isCreature(tile.uid) then     --edited
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end ]]  
return true
end

function getFreeTile(pos, cid)
    if canWalkOnPos(pos, true, false, true, true, false) then
        return pos
    end
    local positions = {}
    for a = 0, 7 do
        if canWalkOnPos(getPosByDir(pos, a), true, false, true, true, false) then
        table.insert(positions, pos)
        end
    end
    if #positions >= 1 then
        if isCreature(cid) then
            local range = 1000
            local ret = getThingPos(cid)
            for b = 1, #positions do
                if getDistanceBetween(getThingPos(cid), positions[b]) < range then
                    ret = positions[b]
                    range = getDistanceBetween(getThingPos(cid), positions[b])
                end
            end
            return ret
        else
            return positions[math.random(#positions)]
        end
    end
return getThingPos(cid)
end

function isWalkable(pos, creature, proj, pz, water)-- by Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
    if isWater(getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid) and water then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 3 or 2
    for i = 0, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end


function isPlayerSummon(cid, uid)
return getCreatureMaster(uid) == cid  --alterado v1.9
end

function isSummon(sid)
return isCreature(sid) and getCreatureMaster(sid) ~= sid and isPlayer(getCreatureMaster(sid))   --alterado v1.9
end

function getItemsInContainerById(container, itemid) -- Function By Kydrai
local items = {}
if isContainer(container) and getContainerSize(container) > 0 then
   for slot=0, (getContainerSize(container)-1) do
       local item = getContainerItem(container, slot)
       if isContainer(item.uid) then
          local itemsbag = getItemsInContainerById(item.uid, itemid)
          for i=0, #itemsbag do
              table.insert(items, itemsbag[i])
          end
       else
          if itemid == item.itemid then
             table.insert(items, item.uid)
          end
       end
   end
end
return items
end

function getPokeballsInContainer(container) -- Function By Kydrai
    if not isContainer(container) then return {} end
    local items = {}
    if isContainer(container) and getContainerSize(container) > 0 then
        for slot=0, (getContainerSize(container)-1) do
            local item = getContainerItem(container, slot)
                if isContainer(item.uid) then
                    local itemsbag = getPokeballsInContainer(item.uid)
                    for i=0, #itemsbag do
                        table.insert(items, itemsbag[i])
                    end
                elseif isPokeball(item.itemid) then
                    table.insert(items, item.uid)
                end
        end
    end
return items
end

function getItensUniquesInContainer(container)    --alterado v1.6
if not isContainer(container) then return {} end
local items = {}
if isContainer(container) and getContainerSize(container) > 0 then
   for slot=0, (getContainerSize(container)-1) do
       local item = getContainerItem(container, slot)
       if isContainer(item.uid) then
          local itemsbag = getItensUniquesInContainer(item.uid)
          for i=0, #itemsbag do
              table.insert(items, itemsbag[i])
          end
       elseif getItemAttribute(item.uid, "unique") then
          table.insert(items, item)
       end
   end
end
return items
end

function hasSpaceInContainer(container)                --alterado v1.6
if not isContainer(container) then return false end
if getContainerSize(container) < getContainerCap(container) then return true end

for slot = 0, (getContainerSize(container)-1) do
    local item = getContainerItem(container, slot)
    if isContainer(item.uid) then
       if hasSpaceInContainer(item.uid) then
          return true
       end
    end
end
return false
end

function doPlayerAddItemStacking(cid, itemid, quant) -- by mkalo
local item = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid)
local piles = 0
if #item > 0 then
   for i,x in pairs(item) do
       if getThing(x).type < 100 then
          local it = getThing(x)
          doTransformItem(it.uid, itemid, it.type+quant)
          if it.type+quant > 100 then
             doPlayerAddItem(cid, itemid, it.type+quant-100)
          end
       else
          piles = piles+1
       end
   end
else
   return doPlayerAddItem(cid, itemid, quant)
end
if piles == #item then
   doPlayerAddItem(cid, itemid, quant)
end
end

function doPlayerAddItemStacking(cid, itemid, quant)
local item = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid)
local piles = 0
if #item > 0 then
for i,x in pairs(item) do
if getThing(x).type < 100 then
local it = getThing(x)
doTransformItem(it.uid, itemid, it.type+quant)
if it.type+quant > 100 then
doPlayerAddItem(cid, itemid, it.type+quant-100)
end
else
piles = piles+1
end
break
end
else
return doPlayerAddItem(cid, itemid, quant)
end
if piles == #item then
doPlayerAddItem(cid, itemid, quant)
end
end
     

                                                            vps-plano-01.png

 

                                                                                                                    http://www.weblara.com.br/

Link para o post
Compartilhar em outros sites

Vc usa qual servidor?

PDA by bolz

Gabrielbsales está dando esse erro aqui

[14/09/2014 09:09:20] [Error - Action Interface]
[14/09/2014 09:09:20] data/actions/scripts/Autoloot.lua:onUse
[14/09/2014 09:09:20] Description:
[14/09/2014 09:09:20] (luaGetContainerSize) Container not found

[14/09/2014 09:09:20] [Error - Action Interface]
[14/09/2014 09:09:20] data/actions/scripts/Autoloot.lua:onUse
[14/09/2014 09:09:20] Description:
[14/09/2014 09:09:20] data/actions/scripts/Autoloot.lua:9: 'for' limit must be a number
[14/09/2014 09:09:20] stack traceback:
[14/09/2014 09:09:20]     data/actions/scripts/Autoloot.lua:9: in function <data/actions/scripts/Autoloot.lua:3>

Gabrielbsales

                                                            vps-plano-01.png

 

                                                                                                                    http://www.weblara.com.br/

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por FeeTads
      salve rapaziada, do TK, esses tempos eu tava a procura de um autoloot bom e eficiente, e como vocês devem saber, o autoloot usado nos scripts .lua são bem "pesados"
      o @Naze fez um excelentíssimo trabalho e disponibilizou um script de autoloot na source, porém como a vida é dificil, ele tem alguns bugs de função e um deles é no 
      "remove autoloot" que quando o player digita "!autoloot remove, nome-do-item" nada acontece, eu decidi mexer e vim disponibilizar arrumado pra vcs.
      LEMBRANDO QUE 100% DOS CRÉDITOS SÃO AO @Naze porém se vc procurar no tópico dele ainda vai estar bugado, então resolvi deixar aqui certinho pra ajudar quem precisar.


      Link do tópico do naze: https://tibiaking.com/forums/topic/101086-otimizado-autoloot-in-sources-for-otx2-ou-menor/
       

      caso alguém ja utilize esse autoloot e esteja com o problema de remover items do autoloot
      só ir em player.cpp e trocar

      isso:
       
      void Player::removeAutoLoot(uint16_t id) { if(checkAutoLoot(id)) { return; } AutoLoot.remove(id); }
      por isso:
      void Player::removeAutoLoot(uint16_t id) { if(!checkAutoLoot(id)) return; for(std::list<uint16_t>::iterator it = AutoLoot.begin(); it != AutoLoot.end(); ++it) { if((*it) == id) { AutoLoot.erase(it); break; } } }
      todos os créditos ao Naze, não sei se alguém mais fez esse código, mas como peguei do link citado acima que é post dele deixo aqui o autoloot 100% funcional direto nas sources
    • Por Featzen
      Bom, como um individuo(Vudi) não sabe cumprir o que fala, vou postar o sistema aqui.(não cabe ao post explicar aqui)
      Bom, aqui está o smeargle system, igual o da PxG. Vamos lá.
       
      1 - Vá na pasta Lib, substitua seu cooldown bar.lua por isso:



       
      2 - Ainda no Lib, no fim(depois do ultimo end) do Some Functions.lua, adicione isso:



       
      3 - Agora no order.lua, do Actions, em baixo de:
      if getTileThingByPos(checkpos).uid <= 0 then return true end Adicione:



       
      4 - Se seu servidor ja tiver os spells, sketch 1, sketch 2... Substitua por esses:
       



       
      Se não, use os mesmos acima, não esqueça de adicionar no spells.xml.
       
      5 - Agora, vá em talkactions/scripst, abra o move1.lua e substitua:



       
      Pronto, se tiver feito tudo certo, funcionará.
      Como ficará:



      Como usar:



       
      Créditos: Eu(Todo o script)
    • Por Cicuta Verde
      Alguem teria as sprites de todos hero cards do pxg q cujo alguns foram usados no Defenders de natal?
       
      Eu ja tive uma vez na epoca q dava pra pegar pelo próprio cliente, mas troquei de pc e perdi, agr to precisando pro meu projeto.
       
      *pesquisei por tags aqui no forum e ja pesquisei no google mas nao achei nada.
    • Por Digoshow
      Ola eu instalei um scrip no meu otserv que e o Auto-loot, tudo certinho blz, mais eu queria editar o comando que e usado para diciona um item, o comando que esta e esse /aloot remove:2170 eu queria deixa assim /aloot remove, 2170 tirar os 2 pontos e deixa uma virgula e um espaco depois da virgula, alguem consegue editar pra mim porfavor:
      Scrip que estou usando : http://www.tibiaking.com/forum/topic/8172-sistema-auto-loot/
      Obrigado, REP+ !
    • Por lucasmacaca
      OLA MEUS AMIGOS ,GOSTARIA DE SABER COMO EU CONSIGO FAZER UM MINI MAP TIPO ESSE , A MANEIRA MAIS FACIL ,DES DE JA AGRADEÇO  

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo