Postado Setembro 11, 2014 11 anos Bom gostaria de um npc que vende-se bless , a primeira segunda a terceira, free e a quarta e a quinta premium account no caso do meu server tfs 0.4 ! valeu
Postado Novembro 13, 2014 11 anos No arquivo lua coloque: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return FALSE end if msgcontains(msg, "first") or msgcontains(msg, "first bless") or msgcontains(msg, "primeira bless") or msgcontains(msg, "primeira") then selfSay("You sure to pay "..pre.." gold coins for a first bless?", cid) talkState[cid] = 1 elseif msgcontains(msg, 'yes') and talkState[cid] == 1 then if not getPlayerBlessing(cid, 1) then if doPlayerRemoveMoney(cid, pre) then doPlayerAddBlessing(cid, 1) selfSay("Now you have the first bless.", cid) talkState[cid] = 0 else selfSay("You don't have enough money to pay.", cid) end else selfSay("You already have the first bless.", cid) end elseif msgcontains(msg, 'no') and talkState[cid] == 1 then selfSay("What you wanna?", cid) talkState[cid] = 0 end if msgcontains(msg, "second") or msgcontains(msg, "second bless") or msgcontains(msg, "segunda bless") or msgcontains(msg, "segunda") then selfSay("You sure to pay "..pre.." gold coins for a second bless?", cid) talkState[cid] = 2 elseif msgcontains(msg, "yes") and talkState[cid] == 2 then if not getPlayerBlessing(cid, 2) then if doPlayerRemoveMoney(cid, pre) then doPlayerAddBlessing(cid, 2) selfSay("Now you have the second bless.", cid) talkState[cid] = 0 else selfSay("You don't have enough money to pay.", cid) end else selfSay("You already have the second bless.", cid) end elseif msgcontains(msg, 'no') and talkState[cid] == 2 then selfSay("What you wanna?", cid) talkState[cid] = 0 end if msgcontains(msg, "third") or msgcontains(msg, "third bless") or msgcontains(msg, "terceira bless") or msgcontains(msg, "terceira") then selfSay("You sure to pay "..pre.." gold coins for a third bless?", cid) talkState[cid] = 3 elseif msgcontains(msg, "yes") and talkState[cid] == 3 then if not getPlayerBlessing(cid, 3) then if doPlayerRemoveMoney(cid, pre) then doPlayerAddBlessing(cid, 3) selfSay("Now you have the third bless.", cid) talkState[cid] = 0 else selfSay("You don't have enough money to pay.", cid) end else selfSay("You already have the third bless.", cid) end elseif msgcontains(msg, 'no') and talkState[cid] == 3 then selfSay("What you wanna?", cid) talkState[cid] = 0 end if msgcontains(msg, "fourth") or msgcontains(msg, "fourth bless") or msgcontains(msg, "quarta bless") or msgcontains(msg, "quarta") then selfSay("You sure to pay "..pre.." gold coins for a fourth bless?", cid) talkState[cid] = 4 elseif msgcontains(msg, "yes") and talkState[cid] == 4 then if not getPlayerBlessing(cid, 4) then if doPlayerRemoveMoney(cid, pre) then doPlayerAddBlessing(cid, 4) selfSay("Now you have the fourth bless.", cid) talkState[cid] = 0 else selfSay("You don't have enough money to pay.", cid) end else selfSay("You already have the fourth bless.", cid) end elseif msgcontains(msg, 'no') and talkState[cid] == 4 then selfSay("What you wanna?", cid) talkState[cid] = 0 end if msgcontains(msg, "fifth") or msgcontains(msg, "fifth bless") or msgcontains(msg, "quinta bless") or msgcontains(msg, "quinta") then selfSay("You sure to pay "..pre.." gold coins for a fifth bless?", cid) talkState[cid] = 5 elseif msgcontains(msg, "yes") and talkState[cid] == 5 then if isPremium(cid) then if not getPlayerBlessing(cid, 5) then if doPlayerRemoveMoney(cid, pre) then doPlayerAddBlessing(cid, 5) selfSay("Now you have the fifth bless.", cid) talkState[cid] = 0 else selfSay("You don't have enough money to pay.", cid) end else selfSay("You already have the fifth bless.", cid) end elseif msgcontains(msg, 'no') and talkState[cid] == 5 then selfSay("What you wanna?", cid) talkState[cid] = 0 else selfSay("You need premium account to buy the fifth bless.", cid) end end local bless = {1, 2, 3, 4, 5} if msgcontains(msg, "all") or msgcontains(msg, "all blessings") or msgcontains(msg, "todas as bless") or msgcontains(msg, "todas") then selfSay("You sure to pay 50000 gold coins for a all blessings?", cid) talkState[cid] = 6 elseif msgcontains(msg, "yes") and talkState[cid] == 6 then for i = 1, table.maxn(bless) do if getPlayerBlessing(cid, bless[i]) then return selfSay("You already have all the blessings.", cid) end end if not isPremium(cid) then return selfSay("You need premium account to buy all blessings.", cid) end if not doPlayerRemoveMoney(cid, 50000) then return selfSay("You don't have enough money to pay.", cid) end local bless = {1, 2, 3, 4, 5} selfSay("Now you have the all blessings.", cid) talkState[cid] = 0 for i = 1, table.maxn(bless) do doPlayerAddBlessing(cid, bless[i]) end elseif msgcontains(msg, 'no') and talkState[cid] == 6 then selfSay("What you wanna?", cid) talkState[cid] = 0 end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Qualquer erro me informe. Atenciosamente, Meu servidor: pbOT
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.