Ir para conteúdo
  • 0

npc santa claus


GodalonexD

Pergunta

to com esse script so que ele da erro na hora de receber os itens

 

 

local PRESENT_STORAGE = 29885 -- Storage ID

local gifts = {

{10, 11250, 1}, -- 1% to get Montaria [10]

{30, 11257, 1}, -- 3% to get Fluffy santa backpack [30]

{40, 2112, 1}, -- 4% to get Teddy Bear [40]

{100, 2472, 1}, -- 10% to get magic plate armor [100]

{150, 2520, 1}, -- 15% to get Demon Shield [150]

{150, 2152, 100}, -- 15% to get 100 Platinum Coins [150]

{200, 2160, 20}, -- 20% to get 20 Crystal coins [200]

{250, 2514, 1}, -- 25% to get mastermind shield [250]

{350, 2432, 1}, -- 35% to get fire axe [350]

{500, 2470, 1} -- 50% to get golden legs [500]

}

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

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

function SantaNPC(cid, message, keywords, parameters, node)

if(not npcHandler:isFocused(cid)) then

return false

end

if (parameters.present == true) then

if (getPlayerStorageValue(cid, PRESENT_STORAGE) == 1) then

selfSay("Não tente me enganar! Você já recebeu seu presente de Natal..", cid)

return true

end

local item = {}

local reward = 0

local count = ""

for i = 1, #gifts do

item = gifts

if (math.random(0,999) < item[1]) then

reward = item[2]

subType = item[3]

if subType > 1 then

count = subType .. " "

end

break

end

end

doPlayerAddItem(cid, reward, subType)

setPlayerStorageValue(cid, PRESENT_STORAGE, 1)

npcHandler:say('Feliz Natal ' .. count .. getItemNameById(reward) .. ' para voce..', cid)

else

npcHandler:say('Volte quando você começar a se comportar.', cid)

end

npcHandler:resetNpc()

return true

end

npcHandler:setMessage(MESSAGE_GREET, "Parabens! e Boas Festas |PLAYERNAME|. Diga {present} Para Receber seu Presente.")

local noNode = KeywordNode:new({'no'}, SantaNPC, {present = false})

local yesNode = KeywordNode:new({'yes'}, SantaNPC, {present = true})

local node = keywordHandler:addKeyword({'present'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Se comportou este ano? Para receber seu presente Diga {yes} '})

node:addChildKeywordNode(yesNode)

node:addChildKeywordNode(noNode)

npcHandler:addModule(FocusModule:new())

 

 

santac.jpg

 

podem ajudar? sem muda o sistema do script?

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...