Postado Abril 3, 2015 10 anos Olhe agora pra ver que numero aparece no console ao falar yes... sim distro é console... local money = xxxx -- Quanto vai custar local storage = 14542 -- Não mexer 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 local function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end player = Player(cid) if player:getStorageValue(storage) == 1 then npcHandler:say('you have already received the promotion', cid) return true end if msgcontains(msg:lower(), 'promotion') then npcHandler:say('you are sure?', cid) npcHandler.topic[cid] = 1 end if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then print(player:getVocation()) if player:getVocation() == 5 or player:getVocation() == 6 or player:getVocation() == 7 or player:getVocation() == 8 then if player:getVipDays() >= 1 then if player:removeMoney(money) then npcHandler:say('you just received a new promotion', cid) player:setVocation(player:getVocation() + 4) player:setStorageValue(storage, 1) npcHandler.topic[cid] = 0 else npcHandler:say('you no have money', cid) npcHandler.topic[cid] = 0 end else npcHandler:say('You do not have any vip days.', cid) npcHandler.topic[cid] = 0 end else npcHandler:say('you no have first promotion', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then npcHandler:say('Bye!!', cid) npcHandler.topic[cid] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Abril 3, 2015 10 anos por Summ (veja o histórico de edições)
Postado Abril 3, 2015 10 anos Autor Olhe agora pra ver que numero aparece no console ao falar yes... sim distro é console... local money = xxxx -- Quanto vai custar local storage = 14542 -- Não mexer 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 local function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end player = Player(cid) if player:getStorageValue(storage) == 1 then npcHandler:say('you have already received the promotion', cid) return true end if msgcontains(msg:lower(), 'promotion') then npcHandler:say('you are sure?', cid) npcHandler.topic[cid] = 1 end if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then print(player:getVocation()) if player:getVocation() == 5 or player:getVocation() == 6 or player:getVocation() == 7 or player:getVocation() == 8 then if player:getVipDays() >= 1 then if player:removeMoney(money) then npcHandler:say('you just received a new promotion', cid) player:setVocation(player:getVocation() + 4) player:setStorageValue(storage, 1) npcHandler.topic[cid] = 0 else npcHandler:say('you no have money', cid) npcHandler.topic[cid] = 0 end else npcHandler:say('You do not have any vip days.', cid) npcHandler.topic[cid] = 0 end else npcHandler:say('you no have first promotion', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then npcHandler:say('Bye!!', cid) npcHandler.topic[cid] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) agora apareceu isto quando estava dando loading no server: [Warning - NpcScript::NpcScript] Can not load script: Queen Alice.lua data/npc/scripts/Queen Alice.lua:52: 'end' expected (to close 'function' at line 13) near 'elseif'
Postado Abril 3, 2015 10 anos Eu já retirei esse end ... quando eu enviei, vi ele dps editei, quando eu postar olhe se eu não editei o tópico novamente pra corrigir/mudar algo. Tenta dnv com o code acima.
Postado Abril 3, 2015 10 anos Autor Eu já retirei esse end ... quando eu enviei, vi ele dps editei, quando eu postar olhe se eu não editei o tópico novamente pra corrigir/mudar algo. Tenta dnv com o code acima. hehehe não tinha visto, apareceu esse código no distro quando fala "yes" userdata: 0x7f02c8068b58 Conseguiu amigo? Estou no aguardo Editado Abril 3, 2015 10 anos por Andreselos1988 (veja o histórico de edições)
Postado Abril 4, 2015 10 anos Não testei: local money = xxxx -- Quanto vai custar local storage = 14542 -- Não mexer 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 local function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) if player:getStorageValue(storage) == 1 then npcHandler:say('you have already received the promotion', cid) return true end if msgcontains(msg:lower(), 'promotion') then npcHandler:say('you are sure?', cid) npcHandler.topic[cid] = 1 end if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then if player:getPromotion() == 1 then if player:getVipDays() >= 1 then if player:removeMoney(money) then npcHandler:say('you just received a new promotion', cid) player:setVocation(player:getVocation() + 4) player:setStorageValue(storage, 1) npcHandler.topic[cid] = 0 else npcHandler:say('you no have money', cid) npcHandler.topic[cid] = 0 end else npcHandler:say('You do not have any vip days.', cid) npcHandler.topic[cid] = 0 end else npcHandler:say('you no have first promotion', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then npcHandler:say('Bye!!', cid) npcHandler.topic[cid] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Abril 4, 2015 10 anos por Summ (veja o histórico de edições)
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.