-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.
-
Conteúdo Similar
-
- 0 respostas
- 599 visualizações
-
- 0 respostas
- 1814 visualizações
-
- 0 respostas
- 1331 visualizações
-
- 2 respostas
- 2188 visualizações
-
- 1 resposta
- 1826 visualizações
-

Pergunta
Chupacabradoesgoto 14
-- Premium account freePremium = false premiumForPromotion = true removePremiumOnInit = true-- This is an example NPC script that can be used on Jiddo's NPC system local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) -- OTServ event handling functions start 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 -- OTServ event handling functions end local node1 = keywordHandler:addKeyword({'promotion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be promoted in your vocation for 20000 gold?'}) node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, promotion = 1, cost = 20000, premium = false, level = 20, text = 'Congratulations! You are now promoted.'}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Allright then. Come back when you are ready.', reset = true}) npcHandler:addModule(FocusModule:new())--Usage: -- local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'}) -- node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20}, text = 'Congratulations! You are now promoted.') -- node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'Allright then. Come back when you are ready.'}, reset = true) function StdModule.promotePlayer(cid, message, keywords, parameters, node) local npcHandler = parameters.npcHandler if(npcHandler == nil) then error('StdModule.promotePlayer called without any npcHandler instance.') end if(cid ~= npcHandler.focus) then return false end if(isPremium(cid) or isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == true or parameters.premium == false) then local oldVoc = getPlayerVocation(cid) if(parameters.promotions[oldVoc] == oldVoc or parameters.promotions[oldVoc] == nil) then npcHandler:say('You are already promoted!') elseif(getPlayerLevel(cid) < parameters.level) then npcHandler:say('I am sorry, but I can only promote you once you have reached level ' .. parameters.level .. '.') elseif(doPlayerRemoveMoney(cid, parameters.cost) ~= TRUE) then npcHandler:say('You do not have enough money!') else doPlayerSetVocation(cid, parameters.promotions[oldVoc]) npcHandler:say(parameters.text) end else npcHandler:say('Sorry, only premium characters are allowed to be promoted.') end npcHandler:resetNpc() return true endninguem? =(
Link para o comentário
https://xtibia.com/forum/topic/237207-npc-n%C3%A3o-vende-promotion-nem-pra-premium/Compartilhar em outros sites
0 respostass a esta questão
Posts Recomendados