Ir para conteúdo

Featured Replies

Postado

Diga em poucas palavras a base utilizada (Nome do servidor ou nome do website).

TFS 0.3.6

 

Fala galera!

Estou com um script aqui, que dando use with num item x, esse item ganha uns atributos, porém, gostaria que além dos atributos, ele ganhasse uma descrição ao dar look:

 

aqui o script:

Spoiler

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isCreature(itemEx.uid) then
        return doPlayerSendCancel(cid, "Use na sua Pokeball.")
    elseif not getItemAttribute(itemEx.uid, "poke") then
        return doPlayerSendCancel(cid, "Use na pokebola de seu Pokémon.")
    elseif not cutItem[getItemAttribute(itemEx.uid, "poke")] then
        return doPlayerSendCancel(cid, "Esse Pokémon não pode aprender esse HM.")
    elseif getItemAttribute(getPlayerSlotItem(cid, 8).uid, "flyItem") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "rideItem") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "cutItem") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "flashItem") then
        return doPlayerSendCancel(cid, "Os Pokémons só aceitam 1 HM.")
    elseif getItemAttribute(getPlayerSlotItem(cid, 8).uid, "ehditto") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "ehshinyditto") then
        return doPlayerSendCancel(cid, "Esse Pokémon não aceita HMs.")
    end
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Agora seu Pokémon possui a habilidade CUT.")
    doItemSetAttribute(itemEx.uid, "cutItem", true)
    doRemoveItem(item.uid, 1)
    return true
end

 

seria possivel?

tumblr_o70wteR8521r9n6kzo1_400.gif

Postado
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isCreature(itemEx.uid) then
		return doPlayerSendCancel(cid, "Use na sua Pokeball.")
	elseif not getItemAttribute(itemEx.uid, "poke") then
		return doPlayerSendCancel(cid, "Use na pokebola de seu Pokémon.")
	elseif not cutItem[getItemAttribute(itemEx.uid, "poke")] then
		return doPlayerSendCancel(cid, "Esse Pokémon não pode aprender esse HM.")
	elseif getItemAttribute(getPlayerSlotItem(cid, 8).uid, "flyItem") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "rideItem") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "cutItem") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "flashItem") then
		return doPlayerSendCancel(cid, "Os Pokémons só aceitam 1 HM.")
	elseif getItemAttribute(getPlayerSlotItem(cid, 8).uid, "ehditto") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "ehshinyditto") then
		return doPlayerSendCancel(cid, "Esse Pokémon não aceita HMs.")
	end
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Agora seu Pokémon possui a habilidade CUT.")
	doItemSetAttribute(itemEx.uid "description", "escreva aqui sua mensagem") -- edite aqui
	doItemSetAttribute(itemEx.uid, "cutItem", true)
	doRemoveItem(item.uid, 1)
	return true
end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Postado
  • Autor
6 minutos atrás, Vodkart disse:

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isCreature(itemEx.uid) then
		return doPlayerSendCancel(cid, "Use na sua Pokeball.")
	elseif not getItemAttribute(itemEx.uid, "poke") then
		return doPlayerSendCancel(cid, "Use na pokebola de seu Pokémon.")
	elseif not cutItem[getItemAttribute(itemEx.uid, "poke")] then
		return doPlayerSendCancel(cid, "Esse Pokémon não pode aprender esse HM.")
	elseif getItemAttribute(getPlayerSlotItem(cid, 8).uid, "flyItem") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "rideItem") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "cutItem") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "flashItem") then
		return doPlayerSendCancel(cid, "Os Pokémons só aceitam 1 HM.")
	elseif getItemAttribute(getPlayerSlotItem(cid, 8).uid, "ehditto") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "ehshinyditto") then
		return doPlayerSendCancel(cid, "Esse Pokémon não aceita HMs.")
	end
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Agora seu Pokémon possui a habilidade CUT.")
	doItemSetAttribute(itemEx.uid "description", "escreva aqui sua mensagem") -- edite aqui
	doItemSetAttribute(itemEx.uid, "cutItem", true)
	doRemoveItem(item.uid, 1)
	return true
end

 

nada aconteceu no look e deu esse erro aqui

 

[25/06/2018 23:08:57] [Error - Action Interface] 
[25/06/2018 23:08:57] data/actions/scripts/HMs/HMRide.lua:onUse
[25/06/2018 23:08:57] Description: 
[25/06/2018 23:08:57] data/actions/scripts/HMs/HMRide.lua:14: attempt to call field 'uid' (a number value)
[25/06/2018 23:08:57] stack traceback:
[25/06/2018 23:08:57]     data/actions/scripts/HMs/HMRide.lua:14: in function <data/actions/scripts/HMs/HMRide.lua:1>

tumblr_o70wteR8521r9n6kzo1_400.gif

Postado

falha minha, faltou uma virgula kk

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isCreature(itemEx.uid) then
		return doPlayerSendCancel(cid, "Use na sua Pokeball.")
	elseif not getItemAttribute(itemEx.uid, "poke") then
		return doPlayerSendCancel(cid, "Use na pokebola de seu Pokémon.")
	elseif not cutItem[getItemAttribute(itemEx.uid, "poke")] then
		return doPlayerSendCancel(cid, "Esse Pokémon não pode aprender esse HM.")
	elseif getItemAttribute(getPlayerSlotItem(cid, 8).uid, "flyItem") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "rideItem") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "cutItem") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "flashItem") then
		return doPlayerSendCancel(cid, "Os Pokémons só aceitam 1 HM.")
	elseif getItemAttribute(getPlayerSlotItem(cid, 8).uid, "ehditto") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "ehshinyditto") then
		return doPlayerSendCancel(cid, "Esse Pokémon não aceita HMs.")
	end
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Agora seu Pokémon possui a habilidade CUT.")
	doItemSetAttribute(itemEx.uid, "description", "escreva aqui sua mensagem") -- edite aqui
	doItemSetAttribute(itemEx.uid, "cutItem", true)
	doRemoveItem(item.uid, 1)
	return true
end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Postado
  • Autor
5 minutos atrás, Vodkart disse:

falha minha, faltou uma virgula kk

 


function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isCreature(itemEx.uid) then
		return doPlayerSendCancel(cid, "Use na sua Pokeball.")
	elseif not getItemAttribute(itemEx.uid, "poke") then
		return doPlayerSendCancel(cid, "Use na pokebola de seu Pokémon.")
	elseif not cutItem[getItemAttribute(itemEx.uid, "poke")] then
		return doPlayerSendCancel(cid, "Esse Pokémon não pode aprender esse HM.")
	elseif getItemAttribute(getPlayerSlotItem(cid, 8).uid, "flyItem") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "rideItem") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "cutItem") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "flashItem") then
		return doPlayerSendCancel(cid, "Os Pokémons só aceitam 1 HM.")
	elseif getItemAttribute(getPlayerSlotItem(cid, 8).uid, "ehditto") or getItemAttribute(getPlayerSlotItem(cid, 8).uid, "ehshinyditto") then
		return doPlayerSendCancel(cid, "Esse Pokémon não aceita HMs.")
	end
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Agora seu Pokémon possui a habilidade CUT.")
	doItemSetAttribute(itemEx.uid, "description", "escreva aqui sua mensagem") -- edite aqui
	doItemSetAttribute(itemEx.uid, "cutItem", true)
	doRemoveItem(item.uid, 1)
	return true
end

 

 

sem erros, mas continua com isso

 

23:22 You see a Poke Ball.
Contains a Venusaur. It is male. $Price: 18000.

 

era para aparecer "HM: Ride" junto a essas palavras.... estou achando que seja no look.lua, por que essas informações "It is male e Price, tem no look e só apareceram qnd botei lá....

 

 

look.lua

procure por > table.insert(str, ". Price: unsellable.")

Spoiler

local NPCBattle = {
["Brock"] = {artig = "He is", cidbat = "Pewter"},
["Misty"] = {artig = "She is", cidbat = "Cerulean"}, 
["Blaine"] = {artig = "He is", cidbat = "Cinnabar"},
["Sabrina"] = {artig = "She is", cidbat = "Saffron"},
["Kira"] = {artig = "She is", cidbat = "Viridian"},
["Koga"] = {artig = "He is", cidbat = "Fushcia"},
["Erika"] = {artig = "She is", cidbat = "Celadon"},
["Surge"] = {artig = "He is", cidbat = "Vermilion"},
}

local shinys = {
["Shiny Abra"] = "Dark Abra",
["Light Abra"] = "Dark Abra",
["Shiny Onix"] = "Crystal Onix",
["Shiny Gyarados"] = "Red Gyarados",
["Shiny Charizard"] = "Elder Charizard",
["Shiny Venusaur"] = "Ancient Venusaur",
["Shiny Blastoise"] = "Ancient Blastoise",
["Shiny Farfetch'd"] = "Elite Farfetch'd",
["Shiny Hitmonlee"] = "Elite Hitmonlee",
["Shiny Himonchan"] = "Elite Hitmonchan",
["Shiny Snorlax"] = "Big Snorlax",
}

ballNames = {
["normal"] = {article = "a", name = "Poke Ball", used = "Discharged Poke Ball"},
["great"] = {article = "a", name = "Great Ball", used = "Discharged Great Ball"},
["super"] = {article = "a", name = "Super Ball", used = "Discharged Super Ball"},
["saffari"] = {article = "a", name = "Saffari Ball", used = "Discharged Saffari Ball"},
["ultra"] = {article = "a", name = "Ultra Ball", used = "Discharged Ultra Ball"},
["master"] = {article = "an", name = "Master Ball", used = "Discharged Master Ball"},
["shinynormal"] = {article = "a", name = "Poke Ball", used = "Discharged Poke Ball"},
["shinygreat"] = {article = "a", name = "Great Ball", used = "Discharged Great Ball"},
["shinysuper"] = {article = "a", name = "Super Ball", used = "Discharged Super Ball"},
["shinysaffari"] = {article = "a", name = "Saffari Ball", used = "Discharged Saffari Ball"},
["shinyultra"] = {article = "a", name = "Ultra Ball", used = "Discharged Ultra Ball"},
}
function onLook(cid, thing, position, lookDistance)
                                                          
local str = {}
                                              
if not isCreature(thing.uid) then
   local iname = getItemInfo(thing.itemid)
   if isPokeball(thing.itemid) and getItemAttribute(thing.uid, "poke") then 
      
      unLock(thing.uid)
      local lock = getItemAttribute(thing.uid, "lock")        
      local pokename = getItemAttribute(thing.uid, "poke")
      local price = prices[pokename].price
      if shinys[pokename] then
         pokename = shinys[pokename]
      end
      ballArticle = iname.article
      ballName = iname.name
      for a, b in pairs (pokeballs) do
                tabela = ballNames[getItemAttribute(thing.uid, "balls") == "on" and getItemAttribute(thing.uid, "ball")]
            if isInArray(b.all, thing.itemid) then
                if isInArray(b.on, thing.itemid) then
                    ballArticle = tabela.article
                    ballName = tabela.name
                elseif isInArray(b.use, thing.itemid) or isInArray(b.off, thing.itemid) then
                    ballArticle = tabela.article
                    ballName = tabela.used
                end
            end
        end
      table.insert(str, "You see "..ballArticle.." "..ballName..".")   
      if getItemAttribute(thing.uid, "unique") then               
         table.insert(str, " It's an unique item.")   
      end
      if lock and lock > 0 then
         table.insert(str, " It will unlock in ".. os.date("%d/%m/%y %X", lock)..".")  
      end
      table.insert(str, "\nContains "..getArticle(pokename).." "..pokename.."") 
      if getItemAttribute(thing.uid, "nick") then
         table.insert(str, " ("..getItemAttribute(thing.uid, "nick")..")")
      end
      local boost = getItemAttribute(thing.uid, "boost") or 0
      if boost > 0 then
         table.insert(str, " +"..boost.."")
      end

                      local b = {"addonName", "addonName2", "addonName3", "addonName4", "addonName5", "addonName6", "addonName7"}
                    for j = 1, #b do
                     if  getItemAttribute(thing.uid, b[j]) then
             table.insert(str, "Addon: "..getItemAttribute(thing.uid, b[j])..".\n")
                       end
                  end        
                  
      local heldname, tier = getHeld(thing, "heldx")
      local heldnamey, ytier = getHeld(thing, "heldy")
      if heldname ~= nil and heldnamey ~= nil then
         table.insert(str, ". Holding: "..heldname.." (Tier: "..tier..") and "..heldnamey.." (Tier: "..ytier..")")
      elseif heldname ~= nil then
         table.insert(str, ". Holding: "..heldname.." (Tier: "..tier..")")
      elseif heldnamey ~= nil then
         table.insert(str, ". Holding: "..heldnamey.." (Tier: "..ytier..")")
      end
            if getItemAttribute(thing.uid, "gender") == SEX_MALE then
         table.insert(str, ". It is male")
      elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then
         table.insert(str, ". It is female")
      else
         table.insert(str, ". It is genderless")
      end
      if price then
         table.insert(str, ". $Price: "..getPokemonPrice(thing.uid)..".")
      else
         table.insert(str, ". Price: unsellable.")
      end
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, table.concat(str))
      return false
      
   elseif string.find(iname.name, "fainted") or string.find(iname.name, "defeated") then
   if shinys[name] then
         name = shinys[name]
      end
      
      table.insert(str, "You see a "..string.lower(iname.name)..". ")     
      if isContainer(thing.uid) then
         table.insert(str, "(Vol: "..getContainerCap(thing.uid)..")")
      end
            if getItemAttribute(thing.uid, "gender") == SEX_MALE then
         table.insert(str, ". It is male")
      elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then
         table.insert(str, ". It is female")
      else
         table.insert(str, ". It is genderless")
      end
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, table.concat(str))
      return false

   elseif isContainer(thing.uid) then     --containers

      if iname.name == "dead human" and getItemAttribute(thing.uid, "pName") then
         table.insert(str, "You see a dead human (Vol:"..getContainerCap(thing.uid)..")\n")
         table.insert(str, "You recognize ".. getItemAttribute(thing.uid, "pName")..". ".. getItemAttribute(thing.uid, "article").." was killed by a ")
         table.insert(str, getItemAttribute(thing.uid, "attacker")..".")
      else   
         table.insert(str, "You see "..iname.article.." "..iname.name..". (Vol:"..getContainerCap(thing.uid)..")")
      end
      if getPlayerGroupId(cid) >= 4 and getPlayerGroupId(cid) <= 6 then
         table.insert(str, "\nItemID: ["..thing.itemid.."]")     
         local pos = getThingPos(thing.uid)
         table.insert(str, "\nPosition: [X: "..pos.x.."][Y: "..pos.y.."][Z: "..pos.z.."]")  
      end
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, table.concat(str))
      return false
      
   elseif getItemAttribute(thing.uid, "unique") then    
   
   local p = getThingPos(thing.uid)
   
      table.insert(str, "You see ")
      if thing.type > 1 then
         table.insert(str, thing.type.." "..iname.plural..".")
      else
         table.insert(str, iname.article.." "..iname.name..".")
      end
      table.insert(str, " It's an unique item.\n"..iname.description)
      if getPlayerGroupId(cid) >= 4 and getPlayerGroupId(cid) <= 6 then
         table.insert(str, "\nItemID: ["..thing.itemid.."]")
         table.insert(str, "\nPosition: ["..p.x.."]["..p.y.."]["..p.z.."]")
      end
   
      sendMsgToPlayer(cid, MESSAGE_INFO_DESCR, table.concat(str))
      return false
   else
      return true
   end
end

local npcname = getCreatureName(thing.uid)
if ehNPC(thing.uid) and NPCBattle[npcname] then    --npcs duel
   table.insert(str, "You see "..npcname..". "..NPCBattle[npcname].artig.." Leader of the Gym from "..NPCBattle[npcname].cidbat..".")
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, table.concat(str))
   return false
end
if not isPlayer(thing.uid) and not isMonster(thing.uid) then    --outros npcs
   table.insert(str, "You see "..getCreatureName(thing.uid)..".")
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, table.concat(str))
   return false
end

if getPlayerStorageValue(thing.uid, 697548) ~= -1 then    
   table.insert(str, getPlayerStorageValue(thing.uid, 697548))                                   
   local pos = getThingPos(thing.uid)
   if youAre[getPlayerGroupId(cid)] then
      table.insert(str, "\nPosition: [X: "..pos.x.."][Y: "..pos.y.."][Z: "..pos.z.."]")
   end
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, table.concat(str))  
   return false
end

if isPlayer(thing.uid) then     --player
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, getPlayerDesc(cid, thing.uid, false))  --alterado v1.7
return false
end


if not isPlayer(thing.uid) and not isMonster(thing.uid) then    --outros npcs
   table.insert(str, "You see "..getCreatureName(thing.uid)..".")
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, table.concat(str))
   return false
end

if getCreatureName(thing.uid) == "Evolution" then return false end

if not isSummon(thing.uid) then   --monstros
   
   table.insert(str, "You see a "..getSomeoneDescription(thing.uid).."")
      if getPokemonGender(thing.uid) == SEX_MALE then
      table.insert(str, ". It is male.")
   elseif getPokemonGender(thing.uid) == SEX_FEMALE then
      table.insert(str, ". It is female.")
   else
      table.insert(str, ". It is genderless.")
   end
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, table.concat(str))
   return false

elseif isSummon(thing.uid) and not isPlayer(thing.uid) then  --summons
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see "..getSomeoneDescription(thing.uid)..".\nIt belongs to "..getCreatureName(getCreatureMaster(thing.uid))..".")
   return false
end
return true
end

 

tumblr_o70wteR8521r9n6kzo1_400.gif

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

Quem Está Navegando 0

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

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 520.1k

Informação Importante

Confirmação de Termo