-
-
Player loga e logo em seguida desloga
@Francisco tibia tenta trocar a funcao isPlayerGhost na lib por essa aqui function isPlayerGhost(cid) if(not isPlayer(cid)) then return false end return getCreatureCondition(cid, CONDITION_GAMEMASTER) end
-
bota de areia
@bpm91 Estranho, eu testei no 8.6 funcionou, acho que sua source nao tem essa função
-
-
bota de areia
@bpm91 Veja se é assim que voce quer local speedGain = 10000 -- speed que o player irá ganhar local sands = {231,104} -- Id das areias local id_boot = 2643 -- ID da boots function onStepIn(cid, item, position, fromPosition) if(isInArray(sands, item.itemid)) then if getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == id_boot then doChangeSpeed(cid, speedGain) end else return false end return true end function onStepOut(cid, item, position, fromPosition) if getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid ~= id_boot then if (getCreatureSpeed(cid) > getCreatureBaseSpeed(cid)) then doChangeSpeed(cid, -speedGain) end else return false end return true end XML <movevent type="StepIn" itemid="231;104" event="script" value="botaAreia.lua"/> <movevent type="StepOut" itemid="231;104" event="script" value="botaAreia.lua"/> Lembre de adicionar os ids do tile no itemid do XML no StepIn e StepOut.
-
-
(Resolvido)Teleport que remove storage
@bpm91 Tenta ai function onStepIn(cid, item) local storages = {1991,1992,1993,1994,1995,1996,1997} -- Storages aqui if (isPlayer(cid)) then for i=1,#storages do if (getPlayerStorageValue(cid, storages[i]) >= 1) then setPlayerStorageValue(cid, storages[i], -1) end end end end
-
-
(Resolvido)Teleport que remove storage
@bpm91 Veja se funciona, não testei Crie arquivo chamado tpStorages.lua em data/moveevents function onStepIn(cid, item) local storages = {1001,1002,1003,1004,1005,1006,1007,1008} -- Storages que serão removidos if isPlayer(cid) then for i = 1, #storages do setPlayerStorageValue(cid, i, 0) end end return true end XML <movevent type="StepIn" actionid="8887" event="script" value="tpStorages.lua"/> Adicione a actionid 8887 no teleport
-
Npc
@Cleiton Felipi Ah esse script é tfs 0.4 nao vai funcionar
-
Npc
@Cleiton Felipi Substitua o código do Waliam.xml por este. <?xml version="1.0" encoding="UTF-8"?> <npc name="Waliam" script="data/npc/scripts/mail.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="128" head="115" body="119" legs="98" feet="114" addons="0"/> <parameters> <parameter key="message_greet" value="Olá |PLAYERNAME|. Eu vendo parcels (15gps), letters (10gps) e labbel(10gps) e também cuido do {banco}. Fale {oferta} ou {banco} caso estiver interessado.." /> <parameter key="module_shop" value="1" /> <parameter key="shop_buyable" value="parcel,2595,15;label,2599,10;letters,2597,10" /> <parameter key="message_farewell" value="Até mais, |PLAYERNAME|!"/> <parameter key="message_sendtrade" value="Aqui esta minha oferta, |PLAYERNAME|"/> </parameters> </npc> Lá em data/npc/scripts você apaga aquele arquivo o mailbank.lua e cria o mail.lua e cola o script de cima neste novo arquivo.
-
ALGUÉM SABE ONDE EU CONSIGO DICE AUTOMÁTICo?
@baiakpro Veja se nao tem nenhum simbolo invalido na linha 1 do script perto do =
-
Npc
@Cleiton Felipi Em data/npc crie um arquivo chamado Waliam.xml cole isso <?xml version="1.0" encoding="UTF-8"?> <npc name="Waliam" script="data/npc/scripts/mailbank.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="128" head="115" body="119" legs="98" feet="114" addons="0"/> <parameters> <parameter key="message_greet" value="Olá |PLAYERNAME|. Eu vendo parcels (15gps), letters (10gps) e labbel(10gps) e também cuido do {banco}. Fale {oferta} ou {banco} caso estiver interessado.." /> <parameter key="module_shop" value="1" /> <parameter key="shop_buyable" value="parcel,2595,15;label,2599,10;letters,2597,10" /> <parameter key="message_farewell" value="Até mais, |PLAYERNAME|!"/> <parameter key="message_sendtrade" value="Aqui esta minha oferta, |PLAYERNAME|"/> </parameters> </npc> Em data/npc/scripts crie um arquivo chamado mailbank.lua cole isso local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local moneyTo = {} local playerTo = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end -- OTServ event handling functions end local function isValidMoney(money) if isNumber(money) == TRUE and money > 0 and money < 999999999 then return TRUE end return FALSE end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, 'help') then npcHandler:say("You can check the {balance} of your bank account, {deposit} money or {withdraw} it. You can also {transfer} money to other characters, provided that they have a vocation.", cid) talkState[cid] = 0 ----------------------------------------------------------------- ---------------------------- Balance ---------------------------- ----------------------------------------------------------------- elseif msgcontains(msg, 'balance') or msgcontains(msg, 'Balance') then npcHandler:say('Your account balance is '..getPlayerBalance(cid)..' gold.', cid) talkState[cid] = 0 ----------------------------------------------------------------- ---------------------------- Help ------------------------------- ----------------------------------------------------------------- elseif msgcontains(msg, 'basic functions') then selfSay('You can check the {balance{ of your bank account, Pdeposit{ money or Pwithdraw{ it. You can also {transfer} money to othercharacters, provided that they have a vocation.', cid) talkState[cid] = 0 elseif msgcontains(msg, 'advanced functions') then selfSay('Renting a house has never been this easy. Simply make a bid for an auction. We will check immediately if you haveenough money.', cid) talkState[cid] = 0 ----------------------------------------------------------------- ---------------------------- Deposit ---------------------------- ----------------------------------------------------------------- elseif msgcontains(msg, 'deposit all') then moneyTo[cid] = getPlayerMoney(cid) if moneyTo[cid] < 1 then selfSay('You don\'t have any money to deposit in you inventory..', cid) talkState[cid] = 0 else selfSay('Would you really like to deposit '..moneyTo[cid]..' gold?', cid) talkState[cid] = 2 end elseif msgcontains(msg, 'deposit') then selfSay("Please tell me how much gold it is you would like to deposit.", cid) talkState[cid] = 1 elseif talkState[cid] == 1 then moneyTo[cid] = tonumber(msg) if isValidMoney(moneyTo[cid]) == TRUE then selfSay('Would you really like to deposit '..moneyTo[cid]..' gold?', cid) talkState[cid] = 2 else selfSay('Is isnt valid amount of gold to deposit.', cid) talkState[cid] = 0 end elseif talkState[cid] == 2 then if msgcontains(msg, 'yes') then if doPlayerDepositMoney(cid, moneyTo[cid], 1) ~= TRUE then selfSay('You do not have enough gold.', cid) else selfSay('Alright, we have added the amount of '..moneyTo[cid]..' gold to your balance. You can withdraw your money anytime you want to. Your account balance is ' .. getPlayerBalance(cid) .. '.', cid) end elseif msgcontains(msg, 'no') then selfSay('As you wish. Is there something else I can do for you?', cid) end talkState[cid] = 0 ----------------------------------------------------------------- ---------------------------- Withdraw --------------------------- ----------------------------------------------------------------- elseif msgcontains(msg, 'withdraw') then selfSay("Please tell me how much gold you would like to withdraw.", cid) talkState[cid] = 6 elseif talkState[cid] == 6 then moneyTo[cid] = tonumber(msg) if isValidMoney(moneyTo[cid]) == TRUE then selfSay('Are you sure you wish to withdraw '..moneyTo[cid]..' gold from your bank account?', cid) talkState[cid] = 7 else selfSay('Is isnt valid amount of gold to withdraw.', cid) talkState[cid] = 0 end elseif talkState[cid] == 7 then if msgcontains(msg, 'yes') then if doPlayerWithdrawMoney(cid, moneyTo[cid]) ~= TRUE then selfSay('There is not enough gold on your account. Your account balance is '..getPlayerBalance(cid)..'. Please tell me the amount of gold coins you would like to withdraw.', cid) else selfSay('Here you are, ' .. moneyTo[cid] .. ' gold. Please let me know if there is something else I can do for you.', cid) talkState[cid] = 0 end elseif msgcontains(msg, 'no') then selfSay('As you wish. Is there something else I can do for you?', cid) talkState[cid] = 0 end ----------------------------------------------------------------- ---------------------------- Transfer --------------------------- ----------------------------------------------------------------- elseif msgcontains(msg, 'transfer') then selfSay("Please tell me the amount of gold you would like to transfer.", cid) talkState[cid] = 11 elseif talkState[cid] == 11 then moneyTo[cid] = tonumber(msg) if isValidMoney(moneyTo[cid]) == TRUE then selfSay('Who would you like transfer '..moneyTo[cid]..' gold to?', cid) talkState[cid] = 12 else selfSay('Is isnt valid amount of gold to transfer.', cid) talkState[cid] = 0 end elseif talkState[cid] == 12 then playerTo[cid] = msg if getCreatureName(cid) == playerTo[cid] then selfSay('Ehm, You want transfer money to yourself? Its impossible!', cid) talkState[cid] = 0 return TRUE end if playerExists(playerTo[cid]) then selfSay('So you would like to transfer ' .. moneyTo[cid] .. ' gold to "' .. playerTo[cid] .. '" ?', cid) talkState[cid] = 13 else selfSay('Player with name "' .. playerTo[cid] .. '" doesnt exist.', cid) talkState[cid] = 0 end elseif talkState[cid] == 13 then if msgcontains(msg, 'yes') then if getPlayerBalance(cid) < moneyTo[cid] then selfSay('You dont have enought money on your bank account.', cid) return TRUE end if doPlayerTransferMoneyTo(cid, playerTo[cid], moneyTo[cid]) ~= TRUE then selfSay('This player does not exist on this world or have no vocation.', cid) else selfSay('You have transferred ' .. moneyTo[cid] .. ' gold to "' .. playerTo[cid] ..' ".', cid) playerTo[cid] = nil end elseif msgcontains(msg, 'no') then selfSay('As you wish. Is there something else I can do for you?', cid) end talkState[cid] = 0 end return TRUE end npcHandler:addModule(FocusModule:new())
-
-
(Resolvido)Ao invés de Curar, Danificar.
@Vandrow Veja se funciona, eu nao testei local pos={ {x=33036, y=32813, z=9}, {x=33038, y=32813, z=9}, {x=0, y=0, z=0}} function onThink(interval) for _, v in pairs(pos) do doSendMagicEffect(v,13) doSendAnimatedText(v, '', 30) doCombatAreaHealth(cid, 1, v, {1}, -200, -200, 12) end return true end
-
ALGUÉM SABE ONDE EU CONSIGO DICE AUTOMÁTICo?
@victor4312 Ta ai o globalevent <globalevent name="NpcDiceEvent" interval="60" event="script" value="eventDice.lua"/> local horarios = { ["19:47"] = { npc_name = "NpcDice", -- Nome do Npc XML pos_respawn_npc = {x=160,y=53,z=9}, -- Posicao aonde o Npc vai ser criado quando o evento começar pos_create_teleport= {x=157,y=57,z=7,stackpos=2}, -- Posicao do Teleport quando evento começar pos_to_teleport = {x=156,y=56,z=9}, -- Para onde o teleport irá levar time = 2, -- Duracao do evento em minutos msg_start = "O teleport para evento Dice esta aberto!", -- Mensagem quando o evento começar msg_finish = "O Evento Dice acabou!", -- Mensagem quando o evento acabar }, } function onThink(interval, lastExecution) local hours = horarios[os.date("%H:%M")] if hours then doBroadcastMessage(hours.msg_start) if not isCreature(hours.pos_respawn_npc) then doCreateNpc(hours.npc_name, hours.pos_respawn_npc) end doCreateTeleport(1387, hours.pos_to_teleport, hours.pos_create_teleport) doSendMagicEffect(hours.pos_create_teleport, 10) addEvent(function() doBroadcastMessage(hours.msg_finish) local npc = getTopCreature(hours.pos_respawn_npc).uid doRemoveCreature(npc) if getTileItemById(hours.pos_create_teleport, 1387).uid >= 1 then doSendMagicEffect(hours.pos_create_teleport, 10) doRemoveItem(getTileItemById(hours.pos_create_teleport, 1387).uid, 1) end end, 1000 * 60 * hours.time) end return true end
-
ALGUÉM SABE ONDE EU CONSIGO DICE AUTOMÁTICo?
@baiakpro Data/Npc/NpcDice.xml <?xml version="1.0" encoding="UTF-8"?> <npc name="[EVENT] Dice Event" script="data/npc/scripts/DiceScript.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look type="289" head="114" body="114" legs="91" feet="91" addons="3"/> </npc> Data/Npc/Scripts/DiceScript.lua local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local x = 0 function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end local randomDice = { [1] = 5792, [2] = 5793, [3] = 5794, [4] = 5795, [5] = 5796, [6] = 5797 } ----------------Config----------------------| local player_teleport = {x=160,y=54,z=7} -- Posicao para onde o player vai ser teleportado quando perder local rewards = { -- Id dos premios caso o player ganhe 2160, } --------------------------------------------| function creatureSayCallback(cid, type, msg) npcPos = getNpcPos() positionNpc = { NORTH = {x=npcPos.x, y=npcPos.y-2, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, SOUTH = {x=npcPos.x, y=npcPos.y+2, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, WEST = {x=npcPos.x-2, y=npcPos.y, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, EAST = {x=npcPos.x+2, y=npcPos.y, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, } local npc = getNpcCid() local dice_pos = {x=npcPos.x+1,y=npcPos.y,z=npcPos.z, stackpos=1} if getTileThingByPos(dice_pos).itemid == 0 then doCreateItem(5792, dice_pos) end if getThingFromPos(positionNpc.NORTH).uid ~= 0 or getThingFromPos(positionNpc.SOUTH).uid ~= 0 or getThingFromPos(positionNpc.WEST).uid ~= 0 or getThingFromPos(positionNpc.EAST).uid ~= 0 then if msgcontains(msg, '1') or msgcontains(msg, '2') or msgcontains(msg, '3') or msgcontains(msg, '4') or msgcontains(msg, '5') or msgcontains(msg, '6') then local dice_random_number = math.random(1, #randomDice) local dice = randomDice[math.random(1, #randomDice)] if (tonumber(msg) == dice_random_number) then local item_reward = rewards[math.random(1, #rewards)] doSendMagicEffect(dice_pos, CONST_ME_CRAPS) doTransformItem(getThingFromPos(dice_pos).uid, randomDice[dice_random_number]) doCreatureSay(npc, getCreatureName(npc).." rolled a "..dice_random_number.. ".", MESSAGE_STATUS_CONSOLE_ORANGE) doCreatureSay(npc, getCreatureName(npc).." voce ganhou "..getItemNameById(item_reward).. ".", MESSAGE_STATUS_CONSOLE_ORANGE) doPlayerAddItem(cid, item_reward, 1) doTeleportThing(cid, player_teleport) else doCreatureSay(npc, getCreatureName(npc).. " rolled a "..dice_random_number.. ".", MESSAGE_STATUS_CONSOLE_ORANGE) doSendMagicEffect(dice_pos, CONST_ME_CRAPS) doTransformItem(getThingFromPos(dice_pos).uid, randomDice[dice_random_number]) doCreatureSetSpeakType(cid, MESSAGE_STATUS_CONSOLE_ORANGE) doCreatureSay(cid, "Perdi!!! :@") doTeleportThing(cid, player_teleport) end end end x = 0 end function HavePlayer() npcPos = getNpcPos() positionNpc = { NORTH = {x=npcPos.x, y=npcPos.y-2, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, SOUTH = {x=npcPos.x, y=npcPos.y+2, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, WEST = {x=npcPos.x-2, y=npcPos.y, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, EAST = {x=npcPos.x+2, y=npcPos.y, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, } local npc = getNpcCid() local position = {x=npcPos.x, y=npcPos.y-2, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE} if (x == 0) then if getThingFromPos(positionNpc.NORTH).uid ~= 0 then npcHandler:say("Escolha um numero de 1 a 6, "..getCreatureName(getThingFromPos(positionNpc.NORTH).uid)) doCreatureSetLookDirection(npc, NORTH) x = 1 end if getThingFromPos(positionNpc.SOUTH).uid ~= 0 then npcHandler:say("Escolha um numero de 1 a 6, "..getCreatureName(getThingFromPos(positionNpc.SOUTH).uid)) doCreatureSetLookDirection(npc, SOUTH) x = 1 end if getThingFromPos(positionNpc.WEST).uid ~= 0 then npcHandler:say("Escolha um numero de 1 a 6, "..getCreatureName(getThingFromPos(positionNpc.WEST).uid)) doCreatureSetLookDirection(npc, WEST) x = 1 end if getThingFromPos(positionNpc.EAST).uid ~= 0 then npcHandler:say("Escolha um numero de 1 a 6, "..getCreatureName(getThingFromPos(positionNpc.EAST).uid)) doCreatureSetLookDirection(npc, EAST) x = 1 end end return true end function onThink() if HavePlayer() then return false end npcHandler:onThink() end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
-
[Erro] - alavanca addon
@Master68 Antes disso if player:getStorageValue(10001) == -1 then Coloque isso local player = Player(player)
-
pra quem gosta de desafio ta ai quem consegue fazer ?
@ADM Mayk on BaiakME Deixa ver se entendi vai ter 1 mapa para cada stage de evento e irão iniciar todos na mesma hora, ou vai ser randômico (por tempo) o evento que irá acontecer?
-
-
-
-
-
-
(Resolvido)Alavanca e Teleport
@bpm91 Acho que é isso local positionCurrent = {x=32268, y=31856, z=15} -- Posicao para onde o player vai se estiver correto a sequencia local positionFail = {x=32184, y=31940, z=14} -- Posicao que o player vai se estiver errada a combinacao if isPlayer(cid) and getPlayerStorageValue(cid,42501) <= -1 then doTeleportThing(cid, positionCurrent) doSendMagicEffect(getThingPos(cid), 12) setPlayerStorageValue(cid,32901,1) setPlayerStorageValue(cid,42501,1) else doTeleportThing(cid, positionFail) doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already did this seal.") end return 0 end