-Fark-, fiz correndo nem testei, depois da uma testada ai... ;]
-- [( XTibia.com )] --
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 money = 10000 -- Quantidade de dinheiro que o player necessita!
local points = 35 -- Quantidade de poits que o NPC irá vender.
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'premium point') then
npcHandler:say("Huum, I can sell "..points.." points for you, do you want?", cid)
talkState[talkUser] = 1
end
elseif msgcontains(msg, 'yes') then
if talkState[talkUser] == 1 then
if getPlayerMoney(cid=) >= money then
doPlayerAddPremiumPoints(cid, points)
doPlayerRemoveMoney(cid, money)
npcHandler:say("Voce recebeu "..points.." premium points!", cid)
talkState[talkUser] = 0
else
npcHandler:say("Sorry, you don't have a money.", cid)
end
return TRUE
end
end
end
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
npcHandler:say("Ok, good bye!", cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Meu site pessoal:
https://devmat.com.br/
dono do um sitezinho qualquer
o lado negro da força, bjs