Postado Abril 16, 2015 10 anos Os items para receber o addon é configurável. talkactions.XML <talkaction words="!buyaddon" separator=" " script="buyaddon.lua"/> buyaddon.lua local text = '--Addon List--\n!buyaddon "citizen\n!buyaddon "hunter\n!buyaddon "mage\n!buyaddon "knight\n!buyaddon "summoner\n!buyaddon "warrior\n!buyaddon "barbarian\n!buyaddon "druid\n!buyaddon "wizard\n!buyaddon "oriental\n!buyaddon "pirate\n!buyaddon "assassin\n!buyaddon "beggar\n!buyaddon "beggar\n!buyaddon "shaman\n!buyaddon "norseman\n!buyaddon "nightmare\n!buyaddon "jester\n!buyaddon "brotherhood\n!buyaddon "warmaster\n--Addon List End--' function onSay(cid, words, param) local player = Player(cid) local cfg = { ["citizen"] = { outfit = { male = 128, female = 136, addon = 3, storage = 10031 }, items = { {5878,100} } }, ["hunter"] = { outfit = { male = 129, female = 137, addon = 3, storage = 10032 }, items = { {5876, 100},{5948, 100} } }, ["mage"] = { outfit = { male = 130, female = 138, addon = 3, storage = 10033 }, items = { {2160,10} } }, ["knight"] = { outfit = { male = 131, female = 139, addon = 3, storage = 10034 }, items = { {5880,100},{5893, 100} } }, ["summoner"] = { outfit = { male = 133, female = 141, addon = 3, storage = 10035 }, items = { {2160,10} } }, ["warrior"] = { outfit = { male = 134, female = 142, addon = 3, storage = 10036 }, items = { {5925, 100},{5899, 100},{5919, 1},{5880, 100} } }, ["barbarian"] = { outfit = { male = 147, female = 143, addon = 3, storage = 10037 }, items = { {5911, 50},{5910, 50},{5879, 100} } }, ["druid"] = { outfit = { male = 148, female = 144, addon = 3, storage = 10038 }, items = { {5896, 50},{5897, 50} } }, ["wizard"] = { outfit = { male = 149, female = 145, addon = 3, storage = 10039 }, items = { {2536, 1},{2492, 1},{2488, 1},{2123, 1},{5922, 50} } }, ["oriental"] = { outfit = { male = 150, female = 146, addon = 3, storage = 10040 }, items = { {5883, 100},{5895, 100},{5912, 100} } }, ["pirate"] = { outfit = { male = 151, female = 155, addon = 3, storage = 10041 }, items = { {6098, 100},{6126, 100},{6097, 100} } }, ["assassin"] = { outfit = { male = 152, female = 156, addon = 3, storage = 10042 }, items = { {5898, 30},{5882, 10},{5881, 30},{5895, 20},{5905, 10} } }, ["beggar"] = { outfit = { male = 153, female = 157, addon = 3, storage = 10043 }, items = { {5878, 50},{2743, 30},{5913, 20},{5894, 10} } }, ["shaman"] = { outfit = { male = 154, female = 158, addon = 3, storage = 10044 }, items = { {3955,5},{5810, 5},{3966, 5},{3967, 5} } }, ["norseman"] = { outfit = { male = 251, female = 252, addon = 3, storage = 10045 }, items = { {7290,15} } }, ["nightmare"] = { outfit = { male = 268, female = 269, addon = 3, storage = 10046 }, items = { {6500,200} } }, ["jester"] = { outfit = { male = 273, female = 270, addon = 3, storage = 10047 }, items = { {2160, 25} } }, ["brotherhood"] = { outfit = { male = 278, female = 279, addon = 3, storage = 10048 }, items = { {6500,200} } } } local v, removeItems = cfg[param], 0, 0 if(param == "") then player:sendTextMessage(MESSAGE_INFO_DESCR, 'Please type !addon "outfit') player:showTextDialog( 5914, text) return false end if (v == nil) then player:sendTextMessage(MESSAGE_INFO_DESCR, "There is no such as outfit named "..param..", here is the list of available outfit.") player:showTextDialog(5914, text) return false end if(player:getStorageValue(v.outfit.storage) < 1) then for i = 1, #v.items do if(player:getItemCount(v.items[i][1]) >= v.items[i][2]) then removeItems = removeItems+1 end end if(removeItems == #v.items) then if(player:getSex(cid) == 1) then player:addOutfitAddon(v.outfit.male, v.outfit.addon) elseif(player:getSex(cid) == 0) then player:addOutfitAddon( v.outfit.female, v.outfit.addon) end for i = 1, #v.items do player:removeItem( v.items[i][1], v.items[i][2]) end player:sendTextMessage(MESSAGE_INFO_DESCR, "Enjoy your new addons to your "..param.." outfit!") player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW) player:setStorageValue( v.outfit.storage, 1) else for i = 1, #v.items do player:sendTextMessage(MESSAGE_INFO_DESCR, "Tu necesitas " .. v.items[i][2] .. "x " .. ItemType(v.items[i][1]):getName() .. " para obtener el "..param.." addon.") end end else player:sendTextMessage(MESSAGE_INFO_DESCR, "Usted ya obtuvo el "..param..".") end return false end Créditos : david. Editado Junho 12, 2015 9 anos por luanluciano93 (veja o histórico de edições) I must not fear. Fear is the mind killer.
Postado Abril 16, 2015 10 anos Corrige a tag: <talkaction words="!buyaddon" separator=" " script="buyaddon.lua"/>
Postado Abril 16, 2015 10 anos Corrige a tag: <talkaction words="!buyaddon" separator=" " script="buyaddon.lua"/> Thanks bem lembrado, estou estudando .lua vendo alguns scripts em um outro fórum e andei vendo que tem bastante conteúdo que aqui não possui, e estou postando aqui pra pessoas que não sabem muito inglês ir aprendendo com os codes tb , a maioria dos codes aqui do fórum estão tudo na versão 0.4 -, vou começar fazer uns script de minha própria autoria mesmo e trazer aqui pro fórum (tfs 1.x +), pra contribuir com a comunidade tb . As Pessoas vivem apegadas aquilo que traduzem como correto e verdadeiro,assim elas definem a realidade. mas oque significa o correto e o verdadeiro?
Postado Junho 8, 2015 9 anos o que seria este erro? [08/06/2015 07:11:51] [Error - TalkAction Interface] [08/06/2015 07:11:51] data/talkactions/scripts/buyaddon.lua:onSay [08/06/2015 07:11:51] Description: [08/06/2015 07:11:51] data/talkactions/scripts/buyaddon.lua:4: attempt to call global 'Player' (a nil value) [08/06/2015 07:11:51] stack traceback: [08/06/2015 07:11:51] data/talkactions/scripts/buyaddon.lua:4: in function <data/talkactions/scripts/buyaddon.lua:3>
Postado Junho 8, 2015 9 anos o que seria este erro? [08/06/2015 07:11:51] [Error - TalkAction Interface] [08/06/2015 07:11:51] data/talkactions/scripts/buyaddon.lua:onSay [08/06/2015 07:11:51] Description: [08/06/2015 07:11:51] data/talkactions/scripts/buyaddon.lua:4: attempt to call global 'Player' (a nil value) [08/06/2015 07:11:51] stack traceback: [08/06/2015 07:11:51] data/talkactions/scripts/buyaddon.lua:4: in function <data/talkactions/scripts/buyaddon.lua:3> O script é pro TFS 1.0
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.