1
Npc pra premiums Jue Ago 02, 2018 4:02 pm
reaves17

Miembro

Hola chicos, necesito un script para que mi Npc venda items solamente alos premium account.. ayuda porfavor
Imagen de mi error:
Esta en:
Npc
Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...
Hola chicos, necesito un script para que mi Npc venda items solamente alos premium account.. ayuda porfavor
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState, xmsg = {}, {}
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 items = {
["thaian sword"] = {cantidad = 10000, itemid = 7391},
["golden helmet"] = {cantidad = 10000, itemid = 2471}
}
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
if not isPremium(cid) then
selfSay("Only premium players can trade with me.", cid)
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local x = items[msg:lower()]
if msgcontains(msg, 'buy') then
selfSay('Which donate item would you like to buy?', cid)
talkState[talkUser] = 2
elseif x and talkState[talkUser] >= 1 then
selfSay('Do you want to buy 1 '..msg..' for '..x.cantidad..' money?', cid)
xmsg[cid] = msg
talkState[talkUser] = 3
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
x = items[xmsg[cid]:lower()]
if getPlayerMoney(cid) >= x.cantidad then
selfSay('Here you are, have fun with it.', cid)
doPlayerAddItem(cid, x.itemid, 1)
doPlayerRemoveMoney(cid, x.cantidad)
talkState[talkUser] = 1
else
selfSay('You don\'t have enough money.', cid)
talkState[talkUser] = 1
end
elseif msgcontains(msg, 'list') then
text = 'Donation Items\n'
for i, x in pairs(items) do
text = text .. "\n" .. i .. " - "..x.cantidad.." money"
end
doShowTextDialog(cid, 7391, "" .. text)
talkState[talkUser] = 1
elseif talkState[talkUser] == 2 then
selfSay('You can\'t buy this item from me, look in the {list} which items you can buy.', cid)
else
selfSay('What? I don\'t understand what you mean with '..msg..'.', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Eryn" nameDescription="Eryn, the rune vendor" script="runes.lua" walkinterval="2000" floorchange="0" skull="green">
<health now="100" max="100"/>
<look type="130" head="39" body="122" legs="125" feet="57" addons="0"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. dime {list}."/>
<parameter key="message_decline" value="Is |TOTALCOST| gold coins too much for you? Get out of here!"/>
</parameters>
</npc>
Permisos de este foro:
No puedes responder a temas en este foro.
|
|