Ir para conteúdo

Featured Replies

Postado

Olá Galera, vi esse script em outro fórum achei muito bacana e vim trazer pra cá já que vi que aqui no TK não existe...

Se trata de um script que você usando um comando!save, você salva sua posição e depois você usando outro comando você aparece naquela posição salva, caso não estiver com pz.

Mas lembre-se: não da pra salvar uma posição que seja em protect zone ou em uma house!

 

Você usa !teleport para escolher para onde quer ir (exemplo):

 

tp_system_window1.png

 

Para salvar sua posição você usa !saveTeleport e o nome do local que irá ficar guardado, desse modo:

 

tp_system_command1.png
 

Apos salvar o local que você queira, usando o comando irá aparecer assim:

tp_system_window2.png

 

 

Após escolher o local, e clicar em Teleport, você irá para a posição salva...

 

Você pode configurar o maximo de pontos que um player pode salvar:
 

 maxPortPoints = 10

Você também tem a opção de deletar alguma posição usando:
 

!deleteTeleport

Agora vamos ao que interessa :HAHAHA: :

Execute isto a sua database:

CREATE TABLE IF NOT EXISTS `player_teleport` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `player_id` int(11) NOT NULL,
  `slot` int(11) NOT NULL,
  `posx` int(11) NOT NULL DEFAULT '0',
  `posy` int(11) NOT NULL DEFAULT '0',
  `posz` int(11) NOT NULL DEFAULT '0',
  `name` varchar(255) NOT NULL COMMENT '',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;

Em login.lua

Abaixo de return true, adicione:
 

player:registerEvent("Teleport")

Em creaturescripts.xml:

<event type="modalWindow" name="Teleport" script="teleport.lua"/>

Crie um arquivo .lua em creaturescripts com o nome de teleport e coloque dentro:

function onModalWindow(cid, modalWindowId, buttonId, choiceId)
  local player = Player(cid)
  local playerGuid = player:getGuid()
  if modalWindowId == 1 then
  if buttonId == 0x00 then -- Select
  if not teleport.canTeleportWhileInfight and getCreatureCondition(cid, CONDITION_INFIGHT) == false then
  local resultId = db.storeQuery("SELECT `posx`, `posy`, `posz`, `name` FROM `player_teleport` WHERE `player_id` = " .. playerGuid .. " AND slot = ".. choiceId)
  if resultId ~= false then
  local pos = {x = result.getDataInt(resultId, "posx"), y = result.getDataInt(resultId, "posy"), z = result.getDataInt(resultId, "posz")}
  local portName = result.getDataString(resultId, "name")
      player:teleportTo(pos, true)
      player:sendTextMessage(22, "You have successfully transported yourself to ".. portName ..".")
  player:sendMagicEffect(CONST_ME_TELEPORT)
  end
  result.free(resultId)
  else
  player:sendCancelMessage("You cannot teleport while beeing infight.")
  end
  elseif buttonId == 0x01 then -- Cancel
  return false
  end
  elseif modalWindowId == 2 then
  if buttonId == 0x00 then -- Delete
  local slot = db.storeQuery("SELECT `name` FROM `player_teleport` WHERE `player_id` = " .. playerGuid .." AND slot = ".. choiceId .."")
  local portName = result.getDataString(slot, "name")
  db.query("DELETE FROM `player_teleport` WHERE `player_id` = " .. playerGuid .. " AND slot = ".. choiceId .."")
  player:sendTextMessage(22, "You have successfully removed ".. portName ..".")
  result.free(slot)
  elseif buttonId == 0x01 then -- Cancel
  return false
  end
  end
  return true
end

Em talkactions.xml:

<talkaction words="!teleport" separator=" " script="teleport.lua"/> <!-- Abre a janela das posições-->
<talkaction words="!saveTeleport" separator=" " script="teleport.lua"/> <!-- Salva uma posição -->
<talkaction words="!deleteTeleport" separator=" " script="teleport.lua"/> <!-- Deleta uma posição -->

Crie um arquivo .lua em talkactions com o nome de teleport e coloque dentro:

function onSay(cid, words, param)
   local player = Player(cid)
   if teleport.premiumOnly and player:getPremiumDays() < 1 and player:getGroup():getId() < 4 then
     return player:sendCancelMessage("You need a premium account to use this.")
   end
   if words == "!saveTeleport" then
     if not Tile(player:getPosition()):getHouse() and not getTilePzInfo(player:getPosition()) then
       player:savePortPosition(string.lower(param))
     else
       player:sendCancelMessage("You can't save positions in a house / protection zone")
     end
   elseif words == "!teleport" then
     local modal = ModalWindow(1, "Teleport List", "Choose your destination:")
     playerGuid = player:getGuid()
     local ret = false
     for var = 1, teleport.maxPortPoints do
       local slot = db.storeQuery("SELECT `name` FROM `player_teleport` WHERE `player_id` = " .. playerGuid .." AND slot = ".. var .."")
       if slot ~= false then
         local portName = result.getDataString(slot, "name")
         modal:addChoice(var, "".. portName .."")
         result.free(slot)
         ret = true
       end
     end
     if ret then
       modal:addButton(0x00, "Teleport")
       modal:setDefaultEnterButton(0x00)
     end
     modal:addButton(0x01, "Cancel")
     modal:setDefaultEscapeButton(0x01)
     modal:sendToPlayer(player)
   elseif words == "!deleteTeleport" then
     local modal = ModalWindow(2, "Teleport List", "Choose which to delete:")
     playerGuid = player:getGuid()
     local ret = false
     for var = 1, teleport.maxPortPoints do
       local slot = db.storeQuery("SELECT `name` FROM `player_teleport` WHERE `player_id` = " .. playerGuid .." AND slot = ".. var .."")
       if slot ~= false then
         local portName = result.getDataString(slot, "name")
         modal:addChoice(var, "".. portName .."")
         result.free(slot)
         ret = true
       end
     end
     if ret then
       modal:addButton(0x00, "Delete")
       modal:setDefaultEnterButton(0x00)
     end
  modal:addButton(0x01, "Cancel")
  modal:setDefaultEscapeButton(0x01)
  modal:sendToPlayer(player)
   end
   return false
end

Em global.lua

teleport = {
   maxPortPoints = 10,
   canTeleportWhileInfight = false,
   premiumOnly = false
}

function Player.savePortPosition(self, description)
  local playerGuid = self:getGuid()
  local pos = self:getPosition()
  local port = 0

   for i = 1, teleport.maxPortPoints do
     local slot = db.storeQuery("SELECT `name` FROM `player_teleport` WHERE `player_id` = " .. playerGuid .." AND slot = ".. i .."")
     if slot == false then
       port = i
       ret = true
       break
     end
     result.free(slot)
   end

   if ret then
     db.query("INSERT INTO `player_teleport` (`player_id`, `slot`, `posx`, `posy`, `posz`, `name`) VALUES (".. playerGuid ..", ".. port ..", ".. pos.x ..", ".. pos.y ..", ".. pos.z ..", '".. description .."');")
     self:sendTextMessage(22, "You have successfully saved the transportation point. ".. description ..".")
     self:sendMagicEffect(CONST_ME_MAGIC_BLUE)
   else
     self:sendCancelMessage("You cannot have more then ".. teleport.maxPortPoints .." save points.")
   end
end

A configuração fica em global.lua como pode ver:
 

teleport = {
   maxPortPoints = 10, -- Maximo de locais.
   canTeleportWhileInfight = false, -- Se o player pode se teletransportar com PZ.
   premiumOnly = false -- Para premiuns ou não.
}

Bom é só isso pessoal... :rock:

 

 

Aproveitem e abusem desse sistema, mas lembrando que é apenas para TFS 1.0!

 

Créditos:

Evil Hero (pelo script todo)

Disturbbed (tradução)

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

  • Respostas 16
  • Visualizações 1.4k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • A parte de configuração é aqui:   teleport = { maxPortPoints = 10, -- Maximo de locais. canTeleportWhileInfight = false, -- Se o player pode se teletransportar com PZ. premiumOnly = false

  • Obrigado! Sempre que puder estarei trazendo mais conteudos....

Posted Images

Postado

Nossa, cara, gostei muito, só gostaria de saber se você poderia fazer com que para o player utilizasse isso, custaria dinheiro, pois tem portar de graça é bem... Vc sabe. Eu não li lo script inteiro, mas se a pessoa estiver lutando contra um monstro, ela poderia teleportar? Se não, coloca isso também, pois a pessoa poderia fugir de coisas/pessoas... Rep +, e se fizer o que disse dou mais outro Rep.

Postado
  • Autor

A parte de configuração é aqui:
 

teleport = {
   maxPortPoints = 10, -- Maximo de locais.
   canTeleportWhileInfight = false, -- Se o player pode se teletransportar com PZ.
   premiumOnly = false -- Para premiuns ou não.
}

no caso canTeleportWhileInfight está false então não pode usar o comando com PZ/PK

 

 

Já para tirar dinheiro voce pode colocar isso

doPlayerRemoveMoney(cid, 10000)

100 = 1k

1000 = 10k

10000 = 100k

100000 = 1kk

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

Visitante
Este tópico está impedido de receber novos posts.

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo