Im using the console 0.3.7_SVN and would like the following Script.
I've a NPC that sells Items VIPs by Premium Points and I would like a script that did with that the Item VIP disappeared in 30 days after the player receive in its backpack. Just the items VIPS sold by this NPC.
This is the script of the NPC that sells the Items VIPs on my server. (Already configured):
Thanks a lot.
I've a NPC that sells Items VIPs by Premium Points and I would like a script that did with that the Item VIP disappeared in 30 days after the player receive in its backpack. Just the items VIPS sold by this NPC.
This is the script of the NPC that sells the Items VIPs on my server. (Already configured):
PHP:
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
npcHandler:setMessage(MESSAGE_GREET, "Ola, |PLAYERNAME|. Eu sou o NPC responsável por vender Items VIPs para Mages. Para mais informações diga {info}.")
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local bootsid = 2358
local bootscost = 5
local helmetid = 10570
local helmetcost = 2
local armorid = 12643
local armorcost = 2
local legsid = 7894
local legscost = 2
local shieldid = 12647
local shieldcost = 2
local maceid = 7424
local macecost = 10
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, '4war boots') or msgcontains(msg, '4war boots')) then
selfSay('Voce deseja comprar a 4war boots por '.. bootscost ..' premium points?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getAccountPoints(cid) >= bootscost) then
if(doAccountRemovePoints(cid, bootscost) == TRUE) then
doPlayerAddItem(cid, bootsid)
selfSay('Voce comprou uma 4war boots.', cid)
else
selfSay('Voce nao tem pontos suficientes.', cid)
end
else
selfSay('Voce nao tem pontos suficientes.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
elseif(msgcontains(msg, '4war mage hat') or msgcontains(msg, '4war mage hat')) then
selfSay('Voce desejar comprar o 4war mage hat por '.. helmetcost ..' premium points?', cid)
talkState[talkUser] = 2
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if(getAccountPoints(cid) >= helmetcost) then
if(doAccountRemovePoints(cid, helmetcost) == TRUE) then
doPlayerAddItem(cid, helmetid)
selfSay('Voce comprou o 4war mage hat.', cid)
else
selfSay('Voce nao tem pontos suficientes para comprar o 4war mage hat.', cid)
end
else
selfSay('Voce nao tem pontos suficientes para comprar o 4war mage hat.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
elseif(msgcontains(msg, '4war mage robe') or msgcontains(msg, '4war mage robe')) then
selfSay('Voce desejar comprar o 4war mage robe por '.. armorcost ..' premium points?', cid)
talkState[talkUser] = 3
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then
if(getAccountPoints(cid) >= armorcost) then
if(doAccountRemovePoints(cid, armorcost) == TRUE) then
doPlayerAddItem(cid, armorid)
selfSay('Voce comprou o 4war mage robe.', cid)
else
selfSay('Voce nao tem pontos suficientes para comprar a 4war mage robe.', cid)
end
else
selfSay('Voce nao tem pontos suficientes para comprar a 4war mage robe.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
elseif(msgcontains(msg, '4war mage legs') or msgcontains(msg, '4war mage legs')) then
selfSay('Voce desejar comprar o 4war mage legs por '.. legscost ..' premium points?', cid)
talkState[talkUser] = 4
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 4) then
if(getAccountPoints(cid) >= legscost) then
if(doAccountRemovePoints(cid, legscost) == TRUE) then
doPlayerAddItem(cid, legsid)
selfSay('Voce comprou a 4war mage legs.', cid)
else
selfSay('Voce nao tem pontos suficientes para comprar a 4war mage legs.', cid)
end
else
selfSay('Voce nao tem pontos suficientes para comprar a 4war mage legs.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
elseif(msgcontains(msg, '4war mage spellbook') or msgcontains(msg, '4war mage spellbook')) then
selfSay('Voce desejar comprar o 4war mage spelbook por '.. shieldcost ..' premium points?', cid)
talkState[talkUser] = 5
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 5) then
if(getAccountPoints(cid) >= shieldcost) then
if(doAccountRemovePoints(cid, shieldcost) == TRUE) then
doPlayerAddItem(cid, shieldid)
selfSay('Voce comprou a 4war mage spellbook.', cid)
else
selfSay('Voce nao tem pontos suficientes para comprar o 4war mage spellbook.', cid)
end
else
selfSay('Voce nao tem pontos suficientes para comprar o 4war mage spellbook.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
elseif(msgcontains(msg, '4war mage staff') or msgcontains(msg, '4war mage staff')) then
selfSay('Voce desejar comprar o 4war mage staff por '.. macecost ..' premium points?', cid)
talkState[talkUser] = 6
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 6) then
if(getAccountPoints(cid) >= macecost) then
if(doAccountRemovePoints(cid, macecost) == TRUE) then
doPlayerAddItem(cid, maceid)
selfSay('Voce comprou a 4war mage staff.', cid)
else
selfSay('Voce nao tem pontos suficientes para comprar a 4war mage staff', cid)
end
else
selfSay('Voce nao tem pontos suficientes para comprar a 4war mage staff.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
keywordHandler:addKeyword({'info'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu posso lhe dar explicações detalhadas. Diga {points} para saber para que servem, {doacao} para saber como doar, {check} para consultar os pontos de sua account ou {VIP} para comprar os seus Items.'})
keywordHandler:addKeyword({'check'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você pode consultar quantos pontos (Premium Points) você possui em sua conta, digite, no Default, o comando !points ou !check.'})
keywordHandler:addKeyword({'vip'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Para comprar o seu Item VIP comigo, apenas diga o nome do Item e confirme. Estes são os Items VIPs para Sorcerers e Druids: {4war mage hat}, {4war mage robe}, {4war mage legs}, {4war mage spellbook}, {4war mage staff}, {4war boots}.'})
keywordHandler:addKeyword({'points'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Premium Points são pontos obtidos através de doações para o server e eles servem para que você possa troca-los comigo por Items VIPs. Igual o sistema de um "Shop System".'})
keywordHandler:addKeyword({'doacao'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'As doações são necessárias para que você possa comprar um Item VIP comigo, sem os seus pontos eu não posso lhe dar os items. Portanto, acesse o nosso site e faça já uma doação! www.enforced.4war.org.'})
Thanks a lot.
Last edited: