Postado Abril 7, 2015 10 anos Tenta assim, to arriscando aqui kk: ocal 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:getStorageValue(STORAGEVALUE_PROMOTION) <= 0 then if player:getVipDays() >= 1 then if player:removeMoney(money) then npcHandler:say("You just received a new promotion.", cid) player:setVocation(player:getVocation():getPromotion()) player:setStorageValue(STORAGEVALUE_PROMOTION, 1) player:setStorageValue(storage, 1) npcHandler.topic[cid] = 0 else npcHandler:say("You don't have money.", cid) npcHandler.topic[cid] = 0 end else npcHandler:say("You don't have any vip days.", cid) npcHandler.topic[cid] = 0 end else npcHandler:say("You don't have the 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()) _ .-'` `} _./) / } .'o \ | } '.___.'`.\ {` /`\_/ , `. } ME DA UMA NOZ! \=' .-' _`\ { `'`;/ `, } _\ @ ; } /__`;-...'--' Cluck!
Postado Abril 7, 2015 10 anos Autor Tenta assim, to arriscando aqui kk: ocal 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:getStorageValue(STORAGEVALUE_PROMOTION) <= 0 then if player:getVipDays() >= 1 then if player:removeMoney(money) then npcHandler:say("You just received a new promotion.", cid) player:setVocation(player:getVocation():getPromotion()) player:setStorageValue(STORAGEVALUE_PROMOTION, 1) player:setStorageValue(storage, 1) npcHandler.topic[cid] = 0 else npcHandler:say("You don't have money.", cid) npcHandler.topic[cid] = 0 end else npcHandler:say("You don't have any vip days.", cid) npcHandler.topic[cid] = 0 end else npcHandler:say("You don't have the 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()) Nao deu, ta aparecendo que não tem a primeira promotion: 18:10 Queen Alice: You don't have the first promotion. Vai que ta quase kkkk
Postado Abril 7, 2015 10 anos Tenta dessa vez assim kk: 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:getStorageValue(STORAGEVALUE_PROMOTION) == 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():getPromotion()) player:setStorageValue(STORAGEVALUE_PROMOTION, 2) player:setStorageValue(storage, 1) npcHandler.topic[cid] = 0 else npcHandler:say("You don't have money.", cid) npcHandler.topic[cid] = 0 end else npcHandler:say("You don't have any vip days.", cid) npcHandler.topic[cid] = 0 end else npcHandler:say("You don't have the 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()) _ .-'` `} _./) / } .'o \ | } '.___.'`.\ {` /`\_/ , `. } ME DA UMA NOZ! \=' .-' _`\ { `'`;/ `, } _\ @ ; } /__`;-...'--' Cluck!
Postado Abril 7, 2015 10 anos Autor Tenta dessa vez assim kk: 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:getStorageValue(STORAGEVALUE_PROMOTION) == 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():getPromotion()) player:setStorageValue(STORAGEVALUE_PROMOTION, 2) player:setStorageValue(storage, 1) npcHandler.topic[cid] = 0 else npcHandler:say("You don't have money.", cid) npcHandler.topic[cid] = 0 end else npcHandler:say("You don't have any vip days.", cid) npcHandler.topic[cid] = 0 end else npcHandler:say("You don't have the 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()) Recebe a promotion mas quando da look aparece "You have no vocation" AUHSUHASHUAS ta tenso..
Postado Abril 7, 2015 10 anos A sim, faltou uma função, tenta agora: 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:getStorageValue(STORAGEVALUE_PROMOTION) == 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():getPromotion():getId()) player:setStorageValue(STORAGEVALUE_PROMOTION, 2) player:setStorageValue(storage, 1) npcHandler.topic[cid] = 0 else npcHandler:say("You don't have money.", cid) npcHandler.topic[cid] = 0 end else npcHandler:say("You don't have any vip days.", cid) npcHandler.topic[cid] = 0 end else npcHandler:say("You don't have the 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()) _ .-'` `} _./) / } .'o \ | } '.___.'`.\ {` /`\_/ , `. } ME DA UMA NOZ! \=' .-' _`\ { `'`;/ `, } _\ @ ; } /__`;-...'--' Cluck!
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.