Ir para conteúdo

pereirinha

Membro
  • Registro em

  • Última visita

  1. pereirinha postou uma resposta no tópico em Suporte Tibia OTServer
    Done.
  2. pereirinha postou uma resposta no tópico em Suporte Tibia OTServer
    local coins = 25 -- quantidade de coins 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 local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local price = 3000000 --Preço das coins em GOLD. if msgcontains(msg:lower(), "coins") then selfSay("Deseja comprar 25 tibia coins por 300 {crystal coins}?", cid) talkState[talkUser] = 1 return true elseif msgcontains(msg:lower(), "yes") and talkState[talkUser] == 1 then if doPlayerRemoveMoney(cid, price) then db.query("UPDATE `accounts` SET `coins` = `coins` + '" ..coins.. "' WHERE `id` = '" .. player:getAccountId() .. "';") selfSay("Você recebeu 25 tibia coins.", cid) talkState[talkUser] = 0 return true else selfSay("Você não tem dinheiro suficiente.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg:lower(), "no") and talkState[talkUser] == 1 then selfSay("Ok, até logo.", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())

Informação Importante

Confirmação de Termo