Ir para conteúdo
Entre para seguir isso  
KutyKutyx3

[NPC] Premium Seller

Recommended Posts

KutyKutyx3    1
KutyKutyx3

-------------------------------

Nome: Premium Seller

Versão: 8.2x - 8.4

Tipo do script: NPC

Servidor Testado: TFS 0.3.2

Autor: Desconhecido

-------------------------------

 

Premium Seller atualizado, com NPC Channel.

 

Abra a pasta data/npc e crie um arquivo XML, nele coloque o seguinte:

<?xml version="1.0"?>

<npc name="Premium Seller" script="data/npc/scripts/premium.lua" walkinterval="2000" floorchange="0" lookdir="3">

<health now="100" max="100"/>

<look type="153" head="19" body="78" legs="94" feet="115" addons="3"/>

</npc>

 

Agora em data/npc/scripts crie um arquivo chamado premium.lua, e coloque o seguinte:

 

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

   if(msgcontains(msg, 'premium')) then
       if getPlayerPremiumDays(cid) <= 360 then
           if getPlayerMoney(cid) >= 14000 then
               selfSay('You want to buy 7 days of premium?', cid)
               talkState[talkUser] = 1
           else
               selfSay('You don\'t have enough money, 7 days premium account costs 14000 gold coin', cid)
           end
       else
           selfSay('You can not buy more than 1 year of premium!', cid)
       end
   elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
       if doPlayerRemoveMoney(cid, 14000) == TRUE then
           doPlayerAddPremiumDays(cid, 90)
           selfSay('Added 90 days of premium, you now have '..getPlayerPremiumDays(cid)..'.', cid)
       end
   end
return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Compartilhar este post


Link para o post
Mock    32
Mock

Comentario: -

 

Aprovadoico_aprovado.png & Movidoicon_movido.giffechado22xnux7.gif

Compartilhar este post


Link para o post
Entre para seguir isso  
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×