Ir para conteúdo

Featured Replies

Postado

Estou precisando de uma talkaction compatível com TFS 0.4 que quando o player digitar !addon libere todos os addons pelo preço de 1kk, encontrei esse mas não está dando certo

 

function onSay(cid, words, param, channel)
   local cfg = {
      ["citizen"] = {
         outfit = {
            male = 128,
            female = 136,
            addon = 3,
            storage = 11001
         },
         items = {
            {2160,100}
         }
      },
      ["hunter"] = {
         outfit = {
            male = 129,
            female = 137,
            addon = 3,
            storage = 11002
         },
         items = {
            {2160,100}
         }
      },
      ["mage"] = {
         outfit = {
            male = 130,
            female = 138,
            addon = 3,
            storage = 11003
         },
         items = {
            {2160,100}
         }
      },
      ["knight"] = {
         outfit = {
            male = 131,
            female = 139,
            addon = 3,
            storage = 11004
         },
         items = {
            {2160,100}
         }
      },
      ["nobleman"] = {
         outfit = {
            male = 132,
            female = 140,
            addon = 3,
            storage = 11005
         },
         items = {
            {2160,100}
         }
      },
      ["summoner"] = {
         outfit = {
            male = 133,
            female = 141,
            addon = 3,
            storage = 11006
         },
         items = {
            {2160,100}
         }
      },
      ["warrior"] = {
         outfit = {
            male = 134,
            female = 142,
            addon = 3,
            storage = 11007
         },
         items = {
            {2160,100}
         }
      },
      ["barbarian"] = {
         outfit = {
            male = 147,
            female = 143,
            addon = 3,
            storage = 11008
         },
         items = {
            {2160,100}
         }
      },
      ["druid"] = {
         outfit = {
            male = 148,
            female = 144,
            addon = 3,
            storage = 11009
         },
         items = {
            {2160,100}
         }
      },
      ["wizard"] = {
         outfit = {
            male = 149,
            female = 145,
            addon = 3,
            storage = 11010
         },
         items = {
            {2160,100}
         }
      },
      ["oriental"] = {
         outfit = {
            male = 150,
            female = 146,
            addon = 3,
            storage = 11011
         },
         items = {
            {2160,100}
         }
      },
      ["pirate"] = {
         outfit = {
            male = 151,
            female = 155,
            addon = 3,
            storage = 11012
         },
         items = {
            {2160,100}
         }
      },
      ["assassin"] = {
         outfit = {
            male = 152,
            female = 156,
            addon = 3,
            storage = 11013
         },
         items = {
            {2160,100}
         }
      },
      ["beggar"] = {
         outfit = {
            male = 153,
            female = 157,
            addon = 3,
            storage = 11014
         },
         items = {
            {2160,100}
         }
      },
      ["shaman"] = {
         outfit = {
            male = 154,
            female = 158,
            addon = 3,
            storage = 11015
         },
         items = {
            {2160,100}
         }
      },
      ["norseman"] = {
         outfit = {
            male = 251,
            female = 252,
            addon = 3,
            storage = 11016
         },
         items = {
            {2160,100}
         }
      },
      ["nightmare"] = {
         outfit = {
            male = 268,
            female = 269,
            addon = 3,
            storage = 11017
         },
         items = {
            {2160,100}
         }
      },
      ["jester"] = {
         outfit = {
            male = 273,
            female = 270,
            addon = 3,
            storage = 11018
         },
         items = {
            {2160,100}
         }
      },
      ["brotherhood"] = {
         outfit = {
            male = 278,
            female = 279,
            addon = 3,
            storage = 11019
         },
         items = {
            {2160,100}
         }
      },
      ["demon hunter"] = {
         outfit = {
            male = 289,
            female = 288,
            addon = 3,
            storage = 11020
         },
         items = {
            {2160,100}
         }
      },
      ["yalaharian"] = {
         outfit = {
            male = 325,
            female = 324,
            addon = 3,
            storage = 11021
         },
         items = {
            {2160,100}
         }
      },
      ["wayfarer"] = {
         outfit = {
            male = 366,
            female = 367,
            addon = 3,
            storage = 11023
         },
         items = {
            {2160,100}
         }
      },
      ["warmaster"] = {
         outfit = {
            male = 335,
            female = 336,
            addon = 3,
            storage = 11022
         },
         items = {
            {2160,100}
         }
      }
   }
   local v, removeItems = cfg[param], 0, 0
        if(param == "") then
                doPlayerSendCancel(cid, "Command requires param.")
      return true
   end
        if (not isPremium(cid)) then
           doPlayerSendCancel(cid, "Você nao tem premium account.")
           return true
        end
   if(getPlayerStorageValue(cid, v.outfit.storage) == -1) then
      for i = 1, #v.items do
         if(getPlayerItemCount(cid, v.items[i][1]) >= v.items[i][2]) then
            removeItems = removeItems+1
         end
      end
      if(removeItems == #v.items) then
         if(getPlayerSex(cid) == 1) then
            doPlayerAddOutfit(cid, v.outfit.male, v.outfit.addon)
         elseif(getPlayerSex(cid) == 0) then
            doPlayerAddOutfit(cid, v.outfit.female, v.outfit.addon)
         end
         for i = 1, #v.items do
            doPlayerRemoveItem(cid, v.items[i][1], v.items[i][2])
         end
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você recebeu uma nova outfit!")
                        doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_YELLOW)
         setPlayerStorageValue(cid, v.outfit.storage, 1)
      else
         for i = 1, #v.items do
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "você precisa " .. v.items[i][2] .. "x " .. getItemNameById(v.items[i][1]) .. " para comprar a outfit.")
         end
      end
   else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você ja tem está outfit.")
   end
   return true
end

alguém poderia ajudar?

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

Postado

MMHUCMQ.png  Esta é uma mensagem automática, este tópico foi movido para a área correta.
  Regras do fórum: http://www.tibiaking.com/forum/topic/1281-regras-gerais/#comment-7680

Este tópico foi movido:
De: Scripting OTServ > OTServ > Actions e TalkActions
Para: Suporte OTServ > OTServ > Suporte de Scripts

Postado

Tenta ai:

 

talkactions/scripts/addonfull.lua

function onUse(cid, item, fromPosition, itemEx, toPosition)

	if(item.itemid == ITEMCOUNT_MAX) then
	return true
	end
	
		if getPlayerStorageValue(cid,525250) <= 0 then
	
			doPlayerSetStorageValue(cid,525250,1)
		
local pPos = getPlayerPosition(cid)

			if getPlayerSex(cid) == 1 then
	
				doSendMagicEffect(pPos, 37)
				doPlayerAddOutfit(cid,128,3)
				doPlayerAddOutfit(cid,129,3)
				doPlayerAddOutfit(cid,130,3)
				doPlayerAddOutfit(cid,131,3)
				doPlayerAddOutfit(cid,132,3)
				doPlayerAddOutfit(cid,133,3)
				doPlayerAddOutfit(cid,134,3)
				doPlayerAddOutfit(cid,143,3)
				doPlayerAddOutfit(cid,144,3)
				doPlayerAddOutfit(cid,145,3)
				doPlayerAddOutfit(cid,146,3)
				doPlayerAddOutfit(cid,151,3)
				doPlayerAddOutfit(cid,152,3)
				doPlayerAddOutfit(cid,153,3)
				doPlayerAddOutfit(cid,154,3)
				doPlayerAddOutfit(cid,251,3)
				doPlayerAddOutfit(cid,268,3)
				doPlayerAddOutfit(cid,273,3)
				doPlayerAddOutfit(cid,278,3)
				doPlayerAddOutfit(cid,289,3)
				doPlayerAddOutfit(cid,325,3)
				doPlayerAddOutfit(cid,328,3)
				doPlayerAddOutfit(cid,335,3)
				doPlayerAddOutfit(cid,367,3)

		elseif getPlayerSex(cid) == 0 then
	
				doSendMagicEffect(pPos, 37)
				doPlayerAddOutfit(cid,136,3)
				doPlayerAddOutfit(cid,137,3)
				doPlayerAddOutfit(cid,138,3)
				doPlayerAddOutfit(cid,139,3)
				doPlayerAddOutfit(cid,140,3)
				doPlayerAddOutfit(cid,141,3)
				doPlayerAddOutfit(cid,142,3)
				doPlayerAddOutfit(cid,147,3)
				doPlayerAddOutfit(cid,148,3)
				doPlayerAddOutfit(cid,149,3)
				doPlayerAddOutfit(cid,150,3)
				doPlayerAddOutfit(cid,155,3)
				doPlayerAddOutfit(cid,156,3)
				doPlayerAddOutfit(cid,157,3)
				doPlayerAddOutfit(cid,158,3)
				doPlayerAddOutfit(cid,252,3)
				doPlayerAddOutfit(cid,269,3)
				doPlayerAddOutfit(cid,270,3)
				doPlayerAddOutfit(cid,279,3)
				doPlayerAddOutfit(cid,288,3)
				doPlayerAddOutfit(cid,324,3)
				doPlayerAddOutfit(cid,329,3)
				doPlayerAddOutfit(cid,336,3)
				doPlayerAddOutfit(cid,366,3)
		
		doCreatureSay(cid,"You received all the addons!",19)
		doSendMagicEffect(getPlayerPosition(cid), 37)
		
		else
		
		doCreatureSay(cid,"You have already got all the addons.",19)
		
	end
	
		end
		
			end
			
		return true
		
end

 

talkactions/talkactions.xml adicione a tag

 

<talkaction words="!addons" event="script" value="addonfull.lua"/>

 

Postado
  • Autor
  Em 08/02/2016 em 19:43, Sekk disse:

Tenta ai:

 

talkactions/scripts/addonfull.lua


function onUse(cid, item, fromPosition, itemEx, toPosition)

	if(item.itemid == ITEMCOUNT_MAX) then
	return true
	end
	
		if getPlayerStorageValue(cid,525250) <= 0 then
	
			doPlayerSetStorageValue(cid,525250,1)
		
local pPos = getPlayerPosition(cid)

			if getPlayerSex(cid) == 1 then
	
				doSendMagicEffect(pPos, 37)
				doPlayerAddOutfit(cid,128,3)
				doPlayerAddOutfit(cid,129,3)
				doPlayerAddOutfit(cid,130,3)
				doPlayerAddOutfit(cid,131,3)
				doPlayerAddOutfit(cid,132,3)
				doPlayerAddOutfit(cid,133,3)
				doPlayerAddOutfit(cid,134,3)
				doPlayerAddOutfit(cid,143,3)
				doPlayerAddOutfit(cid,144,3)
				doPlayerAddOutfit(cid,145,3)
				doPlayerAddOutfit(cid,146,3)
				doPlayerAddOutfit(cid,151,3)
				doPlayerAddOutfit(cid,152,3)
				doPlayerAddOutfit(cid,153,3)
				doPlayerAddOutfit(cid,154,3)
				doPlayerAddOutfit(cid,251,3)
				doPlayerAddOutfit(cid,268,3)
				doPlayerAddOutfit(cid,273,3)
				doPlayerAddOutfit(cid,278,3)
				doPlayerAddOutfit(cid,289,3)
				doPlayerAddOutfit(cid,325,3)
				doPlayerAddOutfit(cid,328,3)
				doPlayerAddOutfit(cid,335,3)
				doPlayerAddOutfit(cid,367,3)

		elseif getPlayerSex(cid) == 0 then
	
				doSendMagicEffect(pPos, 37)
				doPlayerAddOutfit(cid,136,3)
				doPlayerAddOutfit(cid,137,3)
				doPlayerAddOutfit(cid,138,3)
				doPlayerAddOutfit(cid,139,3)
				doPlayerAddOutfit(cid,140,3)
				doPlayerAddOutfit(cid,141,3)
				doPlayerAddOutfit(cid,142,3)
				doPlayerAddOutfit(cid,147,3)
				doPlayerAddOutfit(cid,148,3)
				doPlayerAddOutfit(cid,149,3)
				doPlayerAddOutfit(cid,150,3)
				doPlayerAddOutfit(cid,155,3)
				doPlayerAddOutfit(cid,156,3)
				doPlayerAddOutfit(cid,157,3)
				doPlayerAddOutfit(cid,158,3)
				doPlayerAddOutfit(cid,252,3)
				doPlayerAddOutfit(cid,269,3)
				doPlayerAddOutfit(cid,270,3)
				doPlayerAddOutfit(cid,279,3)
				doPlayerAddOutfit(cid,288,3)
				doPlayerAddOutfit(cid,324,3)
				doPlayerAddOutfit(cid,329,3)
				doPlayerAddOutfit(cid,336,3)
				doPlayerAddOutfit(cid,366,3)
		
		doCreatureSay(cid,"You received all the addons!",19)
		doSendMagicEffect(getPlayerPosition(cid), 37)
		
		else
		
		doCreatureSay(cid,"You have already got all the addons.",19)
		
	end
	
		end
		
			end
			
		return true
		
end

 

talkactions/talkactions.xml adicione a tag

 


<talkaction words="!addons" event="script" value="addonfull.lua"/>

 

o que seria isso 

ITEMCOUNT_MAX

?

ta dando bug

 

[15:32:39.339] [Error - LuaInterface::loadFile] data/talkactions/scripts/addonfu                                                                                        ll.lua:84: '<eof>' expected near 'end'
[15:32:39.339] [Warning - Event::loadScript] Cannot load script (data/talkaction                                                                                        s/scripts/addonfull.lua)
[15:32:39.339] data/talkactions/scripts/addonfull.lua:84: '<eof>' expected near                                                                                         'end'
 

Postado

Tinha um 'end' a mais.. testa ai:

Mostrar conteúdo oculto

 

 

Desculpa ^^

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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo