ond
Veteran OT User
Hi everyone. I've got a problem with my runeseller script. It works, but I want it to have some more features. For an example. When I buy a backpack of sd, it doesn't ask me if I wanna pay any price, it just takes the money and gives me a backpack. I wanna be able to buy like: Hi, 10 backpack of sudden death runes".
And also I want to be able to buy runes separate like:
hi 4 sudden death runes, etcetc.
Here is the script:
Thanks for now!
And also I want to be able to buy runes separate like:
hi 4 sudden death runes, etcetc.
Here is the script:
Lua:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
local msg = string.lower(msg)
if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I sell runes, wands, rods, and whole bps with runes.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and focus ~= cid and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'rune') then
selfSay('I sell backpacks with sudden death,ultimate healing,explosion,heavy magic missile,fire bomb,destroy field and blank runes.')
elseif msgcontains(msg, 'wands') then
selfSay('I sell wand of inferno (2k), plague (100gp), cosmic energy (500gp), vortex (Free) and dragonbreath (1gp).')
elseif msgcontains(msg, 'rods') then
selfSay('I sell quagmire (500gp), snakebite (1gp), tempest (2k), volcanic (100gp) and moonlight rod (free).')
elseif msgcontains(msg, 'inferno') then
buy(cid,2187,getCount(msg),5000)
elseif msgcontains(msg, 'plague') then
buy(cid,2188,getCount(msg),100)
elseif msgcontains(msg, 'cosmic energy') then
buy(cid,2189,getCount(msg),500)
elseif msgcontains(msg, 'vortex') then
buy(cid,2190,getCount(msg),500)
elseif msgcontains(msg, 'dragonbreath') then
buy(cid,2191,getCount(msg),1)
elseif msgcontains(msg, 'quagmire') then
buy(cid,2181,getCount(msg),500)
elseif msgcontains(msg, 'snakebite') then
buy(cid,2182,getCount(msg),500)
elseif msgcontains(msg, 'tempest') then
buy(cid,2183,getCount(msg),5000)
elseif msgcontains(msg, 'volcanic') then
buy(cid,2185,getCount(msg),500)
elseif msgcontains(msg, 'moonlight') then
buy(cid,2186,getCount(msg),1)
elseif msgcontains(msg, 'bp sudden death runes') then
buyContainer(cid,5926,2268,2,5000)
elseif msgcontains(msg, 'bp heavy magic missile runes') then
buyContainer(cid,2001,2311,12,500)
elseif msgcontains(msg, 'bp ultimate healing runes') then
buyContainer(cid,2002,2273,2,3000)
elseif msgcontains(msg, 'bp great fireball runes') then
buyContainer(cid,2000,2304,4,2000)
elseif msgcontains(msg, 'bp mana fluids') then
buyContainer(cid,5949,2006,7,1000)
elseif msgcontains(msg, 'bp explosion runes') then
buyContainer(cid,2001,2313,6,2500)
elseif msgcontains(msg, 'bp blank runes') then
buyContainer(cid,1988,2260,1,200)
elseif msgcontains(msg, 'bp fire bomb runes') then
buyContainer(cid,2000,2305,3,2000)
elseif msgcontains(msg, 'bp destroy field runes') then
buyContainer(cid,2003,2261,3,100)
elseif msgcontains(msg, 'bp magic wall runes') then
buyContainer(cid,2004,2293,4,2000)
elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
Thanks for now!