• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

SHOP NPC SCRIPT

Devlinn

Member
Joined
Mar 25, 2015
Messages
295
Reaction score
6
hello i hav one question 7,6
how i can sell like on npc
hi royal helmet2
and i sell 2 royal helmets for 6cc
i try many tips but anything dont work

i try
elseif isFandD(cid, 4) and msgcontains(msg, 'great shield') then
sell(cid,2522,2,150000)
change amount from 1 to 2 but still sell one items
Code:
focuses = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
target = 0
following = false
attacking = false
focus2 = 0
move = true

local function isFocused(cid)
for i, v in pairs(focuses) do
if(v == cid) then
return true
end
end
return false
end

local function addFocus(cid)
if(not isFocused(cid)) then
for i, v in pairs(focuses) do
if(v == 0)then
focuses = cid
break
end
end
end
end

local function removeFocus(cid)
for i, v in pairs(focuses) do
if(v == cid) then
focuses = 0
break
end
end
end

local function isFandD(cid, dist)
if(isFocused(cid) and getDistanceToCreature(cid) < dist)then
return true
end
return false
end


function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
if(isFocused(cid)) then
selfSay('Good bye then.', cid)
removeFocus(cid)
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)
msg = string.lower(msg)

if msgcontains(msg, 'hi') and (not isFocused(cid)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I buy swords, clubs, axes, helmets, boots, legs, shields and armors.', cid)
addFocus(cid)
elseif isFandD(cid, 4) and msgcontains(msg, 'crystal arrow') then
sell(cid,2352,1,250000)
elseif isFandD(cid, 4) and msgcontains(msg, 'verminor arrow') then
sell(cid,2545,1,1000000)
elseif isFandD(cid, 4) and msgcontains(msg, 'great axe') then
sell(cid,2415,1,500000)
elseif isFandD(cid, 4) and msgcontains(msg, 'silver mace') then
sell(cid,2424,1,500000)
elseif isFandD(cid, 4) and msgcontains(msg, 'apocalipsis') then
sell(cid,2438,1,500000)
elseif isFandD(cid, 4) and msgcontains(msg, 'sprite wand') then
sell(cid,2453,1,100000)

elseif isFandD(cid, 4) and msgcontains(msg, 'royal helmet') then
sell(cid,2498,1,30000)
elseif isFandD(cid, 4) and msgcontains(msg, 'warrior helmet') then
sell(cid,2475,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'crusader helmet') then
sell(cid,2497,1,3500)
elseif isFandD(cid, 4) and msgcontains(msg, 'crown helmet') then
sell(cid,2491,1,2000)
elseif isFandD(cid, 4) and msgcontains(msg, 'devil helmet') then
sell(cid,2462,1,1500)
elseif isFandD(cid, 4) and msgcontains(msg, 'mystic turban') then
sell(cid,2663,1,500)
elseif isFandD(cid, 4) and msgcontains(msg, 'chain helmet') then
sell(cid,2458,1,35)
elseif isFandD(cid, 4) and msgcontains(msg, 'iron helmet') then
sell(cid,2459,1,30)
elseif isFandD(cid, 4) and msgcontains(msg, 'helmets') then
selfSay('I buy royal (30k), warrior (3k), crusader (3,5k), crown (2k), devil (1,5k), chain (35gp) and iron helmets (30gp), also mystic turbans (500gp).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'steel boots') then
sell(cid,2645,1,25000)
elseif isFandD(cid, 4) and msgcontains(msg, 'golden boots') then
sell(cid,2646,1,100000)
elseif isFandD(cid, 4) and msgcontains(msg, 'boh') or msgcontains(msg, 'boots of haste') then
sell(cid,2195,1,10000)
elseif isFandD(cid, 4) and msgcontains(msg, 'boots') then
selfSay('I buy steel boots (25k),boots of haste (10k) and golden boots (100k).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'magic plate armor') or msgcontains(msg, 'mpa') then
sell(cid,2472,1,100000)
elseif isFandD(cid, 4) and msgcontains(msg, 'dragon scale mail') or msgcontains(msg, 'dsm') then
sell(cid,2492,1,50000)
elseif isFandD(cid, 4) and msgcontains(msg, 'golden armor') then
sell(cid,2466,1,25000)
elseif isFandD(cid, 4) and msgcontains(msg, 'crown armor') then
sell(cid,2487,1,5000)
elseif isFandD(cid, 4) and msgcontains(msg, 'knight armor') then
sell(cid,2476,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'blue robe') then
sell(cid,2656,1,10000)
elseif msgcontains(msg, 'crystal arrow') then
sell(cid,2352,1,150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'lady armor') then
sell(cid,2500,1,1000)
elseif isFandD(cid, 4) and msgcontains(msg, 'plate armor') then
sell(cid,2463,1,300)
elseif isFandD(cid, 4) and msgcontains(msg, 'brass armor') then
sell(cid,2465,1,200)
elseif isFandD(cid, 4) and msgcontains(msg, 'chain armor') then
sell(cid,2464,1,100)
elseif isFandD(cid, 4) and msgcontains(msg, 'armors') then
selfSay('I buy golden (25k), crown (5k), knight (3k), lady (1k), plate (300gp), brass (200gp) and chain armors (100gp), also mpa (100k), dsm (50k) and blue robes (10k).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'golden legs') then
sell(cid,2470,1,100000)
elseif isFandD(cid, 4) and msgcontains(msg, 'crown legs') then
sell(cid,2488,1,7000)
elseif isFandD(cid, 4) and msgcontains(msg, 'knight legs') then
sell(cid,2477,1,4000)
elseif isFandD(cid, 4) and msgcontains(msg, 'plate legs') then
sell(cid,2647,1,500)
elseif isFandD(cid, 4) and msgcontains(msg, 'brass legs') then
sell(cid,2478,1,100)
elseif isFandD(cid, 4) and msgcontains(msg, 'chain legs') then
sell(cid,2478,1,50)
elseif isFandD(cid, 4) and msgcontains(msg, 'legs') then
selfSay('I buy golden (100k), crown (7k), knight (4k), plate (500gp), brass (100gp) and chain legs (50gp).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'shield of the mastermind') or msgcontains(msg, 'mms') then
sell(cid,2514,1,100000)





elseif isFandD(cid, 4) and msgcontains(msg, 'great shield') then
sell(cid,2522,1,150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'great shield2') then
sell(cid,2522,1,150000);



elseif isFandD(cid, 4) and msgcontains(msg, 'great shield3') then
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'great shield4') then
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'great shield5') then
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'great shield6') then
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'great shield7') then
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'great shield8') then
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'great shield9') then
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'great shield10') then
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'great shieldall') then
sell(cid,2522,1,150000) --1
sell(cid,2522,1,150000) --2
sell(cid,2522,1,150000) --3
sell(cid,2522,1,150000) --4
sell(cid,2522,1,150000) --5
sell(cid,2522,1,150000) --6
sell(cid,2522,1,150000) --7
sell(cid,2522,1,150000) --8
sell(cid,2522,1,150000) --9
sell(cid,2522,1,150000) --10
sell(cid,2522,1,150000) --11
sell(cid,2522,1,150000) --12
sell(cid,2522,1,150000) --13
sell(cid,2522,1,150000) --14
sell(cid,2522,1,150000) --15
sell(cid,2522,1,150000) --16
sell(cid,2522,1,150000) --17
sell(cid,2522,1,150000) --18
sell(cid,2522,1,150000) --19
sell(cid,2522,1,150000) --20
sell(cid,2522,1,150000) --21
sell(cid,2522,1,150000) --22
sell(cid,2522,1,150000) --23
sell(cid,2522,1,150000) --24
sell(cid,2522,1,150000) --25
sell(cid,2522,1,150000) --26
sell(cid,2522,1,150000) --27
sell(cid,2522,1,150000) --28
sell(cid,2522,1,150000) --29
sell(cid,2522,1,150000) --30
sell(cid,2522,1,150000) --31
sell(cid,2522,1,150000) --32
sell(cid,2522,1,150000) --33
sell(cid,2522,1,150000) --34
sell(cid,2522,1,150000) --35
sell(cid,2522,1,150000) --36
sell(cid,2522,1,150000) --37
sell(cid,2522,1,150000) --38
sell(cid,2522,1,150000) --39
sell(cid,2522,1,150000) --40
sell(cid,2522,1,150000) --41
sell(cid,2522,1,150000) --42
sell(cid,2522,1,150000) --43
sell(cid,2522,1,150000) --44
sell(cid,2522,1,150000) --45
sell(cid,2522,1,150000) --46
sell(cid,2522,1,150000) --47
sell(cid,2522,1,150000) --48
sell(cid,2522,1,150000) --49
sell(cid,2522,1,150000) --50



elseif isFandD(cid, 4) and msgcontains(msg, 'demon shield') then
sell(cid,2520,1,50000)
elseif isFandD(cid, 4) and msgcontains(msg, 'vampire shield') then
sell(cid,2534,1,80000)
elseif isFandD(cid, 4) and msgcontains(msg, 'medusa shield') then
sell(cid,2536,1,4000)
elseif isFandD(cid, 4) and msgcontains(msg, 'amazon shield') then
sell(cid,2537,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'crown shield') then
sell(cid,2519,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'tower shield') then
sell(cid,2528,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'dragon shield') then
sell(cid,2516,1,2000)
elseif isFandD(cid, 4) and msgcontains(msg, 'guardian shield') then
sell(cid,2515,1,1500)
elseif isFandD(cid, 4) and msgcontains(msg, 'beholder shield') then
sell(cid,2518,1,1000)
elseif isFandD(cid, 4) and msgcontains(msg, 'dwarven shield') then
sell(cid,2525,1,100)
elseif isFandD(cid, 4) and msgcontains(msg, 'shields') then
selfSay('I buy great shields (150k), demon (50k), vampire (5,5k), medusa (4k), amazon (3k), crown (3k), tower (3k), dragon (2k), guardian (1.5k), beholder (1k), and dwarven shields (100gp), also mms (100k)', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'giant sword') then
sell(cid,2393,1,10000)
elseif isFandD(cid, 4) and msgcontains(msg, 'bright sword') then
sell(cid,2407,1,6000)
elseif isFandD(cid, 4) and msgcontains(msg, 'ice rapier') then
sell(cid,2396,1,4000)
elseif isFandD(cid, 4) and msgcontains(msg, 'excalibur') then
sell(cid,2408,1,2000000)
elseif isFandD(cid, 4) and msgcontains(msg, 'fire sword') then
sell(cid,2392,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'serpent sword') then
sell(cid,2409,1,1500)
elseif isFandD(cid, 4) and msgcontains(msg, 'spike sword') then
sell(cid,2383,1,800)
elseif isFandD(cid, 4) and msgcontains(msg, 'two handed sword') then
sell(cid,2377,1,400)
elseif isFandD(cid, 4) and msgcontains(msg, 'magic longsword') then
sell(cid,2390,1,150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'broad sword') then
sell(cid,2413,1,70)
elseif isFandD(cid, 4) and msgcontains(msg, 'short sword') then
sell(cid,2406,1,30)
elseif isFandD(cid, 4) and msgcontains(msg, 'sabre') then
sell(cid,2385,1,25)
elseif isFandD(cid, 4) and msgcontains(msg, 'sword') then
sell(cid,2376,1,25)
elseif isFandD(cid, 4) and msgcontains(msg, 'swords') then
selfSay('I buy magic longswords (150k), giant (10k), bright (6k), fire (3k) serpent (1.5k), spike (800gp) and two handed swords (400gp), also ice rapiers (4k), broad swords (70gp), short swords (30gp), sabres (25gp) and swords (25gp).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'dragon lance') then
sell(cid,2414,1,10000)
elseif isFandD(cid, 4) and msgcontains(msg, 'fire axe') then
sell(cid,2432,1,10000)
elseif isFandD(cid, 4) and msgcontains(msg, 'knight axe') then
sell(cid,2430,1,2000)
elseif isFandD(cid, 4) and msgcontains(msg, 'labrys') then
sell(cid,2435,1,2000000)
elseif isFandD(cid, 4) and msgcontains(msg, 'double axe') then
sell(cid,2387,1,200)
elseif isFandD(cid, 4) and msgcontains(msg, 'halberd') then
sell(cid,2381,1,200)
elseif isFandD(cid, 4) and msgcontains(msg, 'battle axe') then
sell(cid,2378,1,100)
elseif isFandD(cid, 4) and msgcontains(msg, 'hatchet') then
sell(cid,2388,1,20)
elseif isFandD(cid, 4) and msgcontains(msg, 'axes') then
selfSay('I buy fire (10k), knight (2k), double (200gp) and battle axes (100gp), also dragon lances (10k), halberds (200gp) and hatchets (20gp).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'war hammer') then
sell(cid,2391,1,4000)
elseif isFandD(cid, 4) and msgcontains(msg, 'golden mace') then
sell(cid,2437,1,2000000)
elseif isFandD(cid, 4) and msgcontains(msg, 'skull staff') then
sell(cid,2436,1,4000)
elseif isFandD(cid, 4) and msgcontains(msg, 'dragon hammer') then
sell(cid,2434,1,2000)
elseif isFandD(cid, 4) and msgcontains(msg, 'clerical mace') then
sell(cid,2423,1,200)
elseif isFandD(cid, 4) and msgcontains(msg, 'battle hammer') then
sell(cid,2417,1,60)
elseif isFandD(cid, 4) and msgcontains(msg, 'mace') then
sell(cid,2398,1,30)
elseif isFandD(cid, 4) and msgcontains(msg, 'clubs') then
selfSay('I buy war (4k), dragon (2k) and battle hammers (60gp), also skull staffs (4k) and clerical maces (200gp).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'platinum amulet') then
sell(cid,2171,1,2000)
elseif isFandD(cid, 4) and msgcontains(msg, 'scarf') then
sell(cid,2661,1,500)
elseif isFandD(cid, 4) and msgcontains(msg, 'amulets') then
selfSay('I buy platinum amulets (2k) and scarfs (500gp).', cid)

elseif isFandD(cid, 4) and string.find(msg, '(%a*)bye(%a*)')then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!', cid)
removeFocus(cid)
move = true
end
end

function onCreatureChangeOutfit(creature)

end

function onThink()
randmove = math.random(1,20)

for i, focus in pairs(focuses) do
if(focus > 0)then
focus2 = focus
move = false
end
if(focus ~= 0)then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.', focus)
removeFocus(focus)
move = true
end
end
end

if(focus2 == 0 or move)then
cx, cy, cz = selfGetPosition()
if randmove == 1 then
nx = cx + 1
end
if randmove == 2 then
nx = cx - 1
end
if randmove == 3 then
ny = cy + 1
end
if randmove == 4 then
ny = cy - 1
end
if randmove >= 5 then
nx = cx
ny = cy
end
moveToPosition(nx, ny, cz)
end
end


but now i can sell 5great shield and i have 5x 15cc on backpack
 
On
Code:
elseif isFandD(cid, 4) and msgcontains(msg, 'great shield2') then
sell(cid,2522,1,150000);
You need to change that to
Code:
elseif isFandD(cid, 4) and msgcontains(msg, 'great shield2') then
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)

Rather messy script. But that is what stood out. :)
 
On
Code:
elseif isFandD(cid, 4) and msgcontains(msg, 'great shield2') then
sell(cid,2522,1,150000);
You need to change that to
Code:
elseif isFandD(cid, 4) and msgcontains(msg, 'great shield2') then
sell(cid,2522,1,150000)
sell(cid,2522,1,150000)

Rather messy script. But that is what stood out. :)

i arleady use this but i want
sell 2x great shield = 1x 30cc
not 2x 15cc
 
Create a backup of your script. if this works for great shields I can give you a full script later for all items :)

Now replace this with the script that you have after you have made a backup of the current :)
Try with "great shield 2"

Code:
focuses = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
target = 0
following = false
attacking = false
focus2 = 0
move = true

local function isFocused(cid)
for i, v in pairs(focuses) do
if(v == cid) then
return true
end
end
return false
end

local function addFocus(cid)
if(not isFocused(cid)) then
for i, v in pairs(focuses) do
if(v == 0)then
focuses = cid
break
end
end
end
end

local function removeFocus(cid)
for i, v in pairs(focuses) do
if(v == cid) then
focuses = 0
break
end
end
end

local function isFandD(cid, dist)
if(isFocused(cid) and getDistanceToCreature(cid) < dist)then
return true
end
return false
end


function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
if(isFocused(cid)) then
selfSay('Good bye then.', cid)
removeFocus(cid)
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)
msg = string.lower(msg)

if msgcontains(msg, 'hi') and (not isFocused(cid)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I buy swords, clubs, axes, helmets, boots, legs, shields and armors.', cid)
addFocus(cid)
elseif isFandD(cid, 4) and msgcontains(msg, 'crystal arrow') then
sell(cid,2352,1,250000)
elseif isFandD(cid, 4) and msgcontains(msg, 'verminor arrow') then
sell(cid,2545,1,1000000)
elseif isFandD(cid, 4) and msgcontains(msg, 'great axe') then
sell(cid,2415,1,500000)
elseif isFandD(cid, 4) and msgcontains(msg, 'silver mace') then
sell(cid,2424,1,500000)
elseif isFandD(cid, 4) and msgcontains(msg, 'apocalipsis') then
sell(cid,2438,1,500000)
elseif isFandD(cid, 4) and msgcontains(msg, 'sprite wand') then
sell(cid,2453,1,100000)

elseif isFandD(cid, 4) and msgcontains(msg, 'royal helmet') then
sell(cid,2498,1,30000)
elseif isFandD(cid, 4) and msgcontains(msg, 'warrior helmet') then
sell(cid,2475,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'crusader helmet') then
sell(cid,2497,1,3500)
elseif isFandD(cid, 4) and msgcontains(msg, 'crown helmet') then
sell(cid,2491,1,2000)
elseif isFandD(cid, 4) and msgcontains(msg, 'devil helmet') then
sell(cid,2462,1,1500)
elseif isFandD(cid, 4) and msgcontains(msg, 'mystic turban') then
sell(cid,2663,1,500)
elseif isFandD(cid, 4) and msgcontains(msg, 'chain helmet') then
sell(cid,2458,1,35)
elseif isFandD(cid, 4) and msgcontains(msg, 'iron helmet') then
sell(cid,2459,1,30)
elseif isFandD(cid, 4) and msgcontains(msg, 'helmets') then
selfSay('I buy royal (30k), warrior (3k), crusader (3,5k), crown (2k), devil (1,5k), chain (35gp) and iron helmets (30gp), also mystic turbans (500gp).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'steel boots') then
sell(cid,2645,1,25000)
elseif isFandD(cid, 4) and msgcontains(msg, 'golden boots') then
sell(cid,2646,1,100000)
elseif isFandD(cid, 4) and msgcontains(msg, 'boh') or msgcontains(msg, 'boots of haste') then
sell(cid,2195,1,10000)
elseif isFandD(cid, 4) and msgcontains(msg, 'boots') then
selfSay('I buy steel boots (25k),boots of haste (10k) and golden boots (100k).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'magic plate armor') or msgcontains(msg, 'mpa') then
sell(cid,2472,1,100000)
elseif isFandD(cid, 4) and msgcontains(msg, 'dragon scale mail') or msgcontains(msg, 'dsm') then
sell(cid,2492,1,50000)
elseif isFandD(cid, 4) and msgcontains(msg, 'golden armor') then
sell(cid,2466,1,25000)
elseif isFandD(cid, 4) and msgcontains(msg, 'crown armor') then
sell(cid,2487,1,5000)
elseif isFandD(cid, 4) and msgcontains(msg, 'knight armor') then
sell(cid,2476,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'blue robe') then
sell(cid,2656,1,10000)
elseif msgcontains(msg, 'crystal arrow') then
sell(cid,2352,1,150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'lady armor') then
sell(cid,2500,1,1000)
elseif isFandD(cid, 4) and msgcontains(msg, 'plate armor') then
sell(cid,2463,1,300)
elseif isFandD(cid, 4) and msgcontains(msg, 'brass armor') then
sell(cid,2465,1,200)
elseif isFandD(cid, 4) and msgcontains(msg, 'chain armor') then
sell(cid,2464,1,100)
elseif isFandD(cid, 4) and msgcontains(msg, 'armors') then
selfSay('I buy golden (25k), crown (5k), knight (3k), lady (1k), plate (300gp), brass (200gp) and chain armors (100gp), also mpa (100k), dsm (50k) and blue robes (10k).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'golden legs') then
sell(cid,2470,1,100000)
elseif isFandD(cid, 4) and msgcontains(msg, 'crown legs') then
sell(cid,2488,1,7000)
elseif isFandD(cid, 4) and msgcontains(msg, 'knight legs') then
sell(cid,2477,1,4000)
elseif isFandD(cid, 4) and msgcontains(msg, 'plate legs') then
sell(cid,2647,1,500)
elseif isFandD(cid, 4) and msgcontains(msg, 'brass legs') then
sell(cid,2478,1,100)
elseif isFandD(cid, 4) and msgcontains(msg, 'chain legs') then
sell(cid,2478,1,50)
elseif isFandD(cid, 4) and msgcontains(msg, 'legs') then
selfSay('I buy golden (100k), crown (7k), knight (4k), plate (500gp), brass (100gp) and chain legs (50gp).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'shield of the mastermind') or msgcontains(msg, 'mms') then
sell(cid,2514,1,100000)
elseif isFandD(cid, 4) and msgcontains(msg, 'great shield') then
sell(cid,2522,getCount(msg),150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'demon shield') then
sell(cid,2520,1,50000)
elseif isFandD(cid, 4) and msgcontains(msg, 'vampire shield') then
sell(cid,2534,1,80000)
elseif isFandD(cid, 4) and msgcontains(msg, 'medusa shield') then
sell(cid,2536,1,4000)
elseif isFandD(cid, 4) and msgcontains(msg, 'amazon shield') then
sell(cid,2537,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'crown shield') then
sell(cid,2519,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'tower shield') then
sell(cid,2528,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'dragon shield') then
sell(cid,2516,1,2000)
elseif isFandD(cid, 4) and msgcontains(msg, 'guardian shield') then
sell(cid,2515,1,1500)
elseif isFandD(cid, 4) and msgcontains(msg, 'beholder shield') then
sell(cid,2518,1,1000)
elseif isFandD(cid, 4) and msgcontains(msg, 'dwarven shield') then
sell(cid,2525,1,100)
elseif isFandD(cid, 4) and msgcontains(msg, 'shields') then
selfSay('I buy great shields (150k), demon (50k), vampire (5,5k), medusa (4k), amazon (3k), crown (3k), tower (3k), dragon (2k), guardian (1.5k), beholder (1k), and dwarven shields (100gp), also mms (100k)', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'giant sword') then
sell(cid,2393,1,10000)
elseif isFandD(cid, 4) and msgcontains(msg, 'bright sword') then
sell(cid,2407,1,6000)
elseif isFandD(cid, 4) and msgcontains(msg, 'ice rapier') then
sell(cid,2396,1,4000)
elseif isFandD(cid, 4) and msgcontains(msg, 'excalibur') then
sell(cid,2408,1,2000000)
elseif isFandD(cid, 4) and msgcontains(msg, 'fire sword') then
sell(cid,2392,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'serpent sword') then
sell(cid,2409,1,1500)
elseif isFandD(cid, 4) and msgcontains(msg, 'spike sword') then
sell(cid,2383,1,800)
elseif isFandD(cid, 4) and msgcontains(msg, 'two handed sword') then
sell(cid,2377,1,400)
elseif isFandD(cid, 4) and msgcontains(msg, 'magic longsword') then
sell(cid,2390,1,150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'broad sword') then
sell(cid,2413,1,70)
elseif isFandD(cid, 4) and msgcontains(msg, 'short sword') then
sell(cid,2406,1,30)
elseif isFandD(cid, 4) and msgcontains(msg, 'sabre') then
sell(cid,2385,1,25)
elseif isFandD(cid, 4) and msgcontains(msg, 'sword') then
sell(cid,2376,1,25)
elseif isFandD(cid, 4) and msgcontains(msg, 'swords') then
selfSay('I buy magic longswords (150k), giant (10k), bright (6k), fire (3k) serpent (1.5k), spike (800gp) and two handed swords (400gp), also ice rapiers (4k), broad swords (70gp), short swords (30gp), sabres (25gp) and swords (25gp).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'dragon lance') then
sell(cid,2414,1,10000)
elseif isFandD(cid, 4) and msgcontains(msg, 'fire axe') then
sell(cid,2432,1,10000)
elseif isFandD(cid, 4) and msgcontains(msg, 'knight axe') then
sell(cid,2430,1,2000)
elseif isFandD(cid, 4) and msgcontains(msg, 'labrys') then
sell(cid,2435,1,2000000)
elseif isFandD(cid, 4) and msgcontains(msg, 'double axe') then
sell(cid,2387,1,200)
elseif isFandD(cid, 4) and msgcontains(msg, 'halberd') then
sell(cid,2381,1,200)
elseif isFandD(cid, 4) and msgcontains(msg, 'battle axe') then
sell(cid,2378,1,100)
elseif isFandD(cid, 4) and msgcontains(msg, 'hatchet') then
sell(cid,2388,1,20)
elseif isFandD(cid, 4) and msgcontains(msg, 'axes') then
selfSay('I buy fire (10k), knight (2k), double (200gp) and battle axes (100gp), also dragon lances (10k), halberds (200gp) and hatchets (20gp).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'war hammer') then
sell(cid,2391,1,4000)
elseif isFandD(cid, 4) and msgcontains(msg, 'golden mace') then
sell(cid,2437,1,2000000)
elseif isFandD(cid, 4) and msgcontains(msg, 'skull staff') then
sell(cid,2436,1,4000)
elseif isFandD(cid, 4) and msgcontains(msg, 'dragon hammer') then
sell(cid,2434,1,2000)
elseif isFandD(cid, 4) and msgcontains(msg, 'clerical mace') then
sell(cid,2423,1,200)
elseif isFandD(cid, 4) and msgcontains(msg, 'battle hammer') then
sell(cid,2417,1,60)
elseif isFandD(cid, 4) and msgcontains(msg, 'mace') then
sell(cid,2398,1,30)
elseif isFandD(cid, 4) and msgcontains(msg, 'clubs') then
selfSay('I buy war (4k), dragon (2k) and battle hammers (60gp), also skull staffs (4k) and clerical maces (200gp).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'platinum amulet') then
sell(cid,2171,1,2000)
elseif isFandD(cid, 4) and msgcontains(msg, 'scarf') then
sell(cid,2661,1,500)
elseif isFandD(cid, 4) and msgcontains(msg, 'amulets') then
selfSay('I buy platinum amulets (2k) and scarfs (500gp).', cid)

elseif isFandD(cid, 4) and string.find(msg, '(%a*)bye(%a*)')then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!', cid)
removeFocus(cid)
move = true
end
end

function onCreatureChangeOutfit(creature)

end

function onThink()
randmove = math.random(1,20)

for i, focus in pairs(focuses) do
if(focus > 0)then
focus2 = focus
move = false
end
if(focus ~= 0)then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.', focus)
removeFocus(focus)
move = true
end
end
end

if(focus2 == 0 or move)then
cx, cy, cz = selfGetPosition()
if randmove == 1 then
nx = cx + 1
end
if randmove == 2 then
nx = cx - 1
end
if randmove == 3 then
ny = cy + 1
end
if randmove == 4 then
ny = cy - 1
end
if randmove >= 5 then
nx = cx
ny = cy
end
moveToPosition(nx, ny, cz)
end
end
 
Create a backup of your script. if this works for great shields I can give you a full script later for all items :)

Now replace this with the script that you have after you have made a backup of the current :)
Try with "great shield 2"

Code:
focuses = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
target = 0
following = false
attacking = false
focus2 = 0
move = true

local function isFocused(cid)
for i, v in pairs(focuses) do
if(v == cid) then
return true
end
end
return false
end

local function addFocus(cid)
if(not isFocused(cid)) then
for i, v in pairs(focuses) do
if(v == 0)then
focuses = cid
break
end
end
end
end

local function removeFocus(cid)
for i, v in pairs(focuses) do
if(v == cid) then
focuses = 0
break
end
end
end

local function isFandD(cid, dist)
if(isFocused(cid) and getDistanceToCreature(cid) < dist)then
return true
end
return false
end


function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
if(isFocused(cid)) then
selfSay('Good bye then.', cid)
removeFocus(cid)
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)
msg = string.lower(msg)

if msgcontains(msg, 'hi') and (not isFocused(cid)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I buy swords, clubs, axes, helmets, boots, legs, shields and armors.', cid)
addFocus(cid)
elseif isFandD(cid, 4) and msgcontains(msg, 'crystal arrow') then
sell(cid,2352,1,250000)
elseif isFandD(cid, 4) and msgcontains(msg, 'verminor arrow') then
sell(cid,2545,1,1000000)
elseif isFandD(cid, 4) and msgcontains(msg, 'great axe') then
sell(cid,2415,1,500000)
elseif isFandD(cid, 4) and msgcontains(msg, 'silver mace') then
sell(cid,2424,1,500000)
elseif isFandD(cid, 4) and msgcontains(msg, 'apocalipsis') then
sell(cid,2438,1,500000)
elseif isFandD(cid, 4) and msgcontains(msg, 'sprite wand') then
sell(cid,2453,1,100000)

elseif isFandD(cid, 4) and msgcontains(msg, 'royal helmet') then
sell(cid,2498,1,30000)
elseif isFandD(cid, 4) and msgcontains(msg, 'warrior helmet') then
sell(cid,2475,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'crusader helmet') then
sell(cid,2497,1,3500)
elseif isFandD(cid, 4) and msgcontains(msg, 'crown helmet') then
sell(cid,2491,1,2000)
elseif isFandD(cid, 4) and msgcontains(msg, 'devil helmet') then
sell(cid,2462,1,1500)
elseif isFandD(cid, 4) and msgcontains(msg, 'mystic turban') then
sell(cid,2663,1,500)
elseif isFandD(cid, 4) and msgcontains(msg, 'chain helmet') then
sell(cid,2458,1,35)
elseif isFandD(cid, 4) and msgcontains(msg, 'iron helmet') then
sell(cid,2459,1,30)
elseif isFandD(cid, 4) and msgcontains(msg, 'helmets') then
selfSay('I buy royal (30k), warrior (3k), crusader (3,5k), crown (2k), devil (1,5k), chain (35gp) and iron helmets (30gp), also mystic turbans (500gp).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'steel boots') then
sell(cid,2645,1,25000)
elseif isFandD(cid, 4) and msgcontains(msg, 'golden boots') then
sell(cid,2646,1,100000)
elseif isFandD(cid, 4) and msgcontains(msg, 'boh') or msgcontains(msg, 'boots of haste') then
sell(cid,2195,1,10000)
elseif isFandD(cid, 4) and msgcontains(msg, 'boots') then
selfSay('I buy steel boots (25k),boots of haste (10k) and golden boots (100k).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'magic plate armor') or msgcontains(msg, 'mpa') then
sell(cid,2472,1,100000)
elseif isFandD(cid, 4) and msgcontains(msg, 'dragon scale mail') or msgcontains(msg, 'dsm') then
sell(cid,2492,1,50000)
elseif isFandD(cid, 4) and msgcontains(msg, 'golden armor') then
sell(cid,2466,1,25000)
elseif isFandD(cid, 4) and msgcontains(msg, 'crown armor') then
sell(cid,2487,1,5000)
elseif isFandD(cid, 4) and msgcontains(msg, 'knight armor') then
sell(cid,2476,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'blue robe') then
sell(cid,2656,1,10000)
elseif msgcontains(msg, 'crystal arrow') then
sell(cid,2352,1,150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'lady armor') then
sell(cid,2500,1,1000)
elseif isFandD(cid, 4) and msgcontains(msg, 'plate armor') then
sell(cid,2463,1,300)
elseif isFandD(cid, 4) and msgcontains(msg, 'brass armor') then
sell(cid,2465,1,200)
elseif isFandD(cid, 4) and msgcontains(msg, 'chain armor') then
sell(cid,2464,1,100)
elseif isFandD(cid, 4) and msgcontains(msg, 'armors') then
selfSay('I buy golden (25k), crown (5k), knight (3k), lady (1k), plate (300gp), brass (200gp) and chain armors (100gp), also mpa (100k), dsm (50k) and blue robes (10k).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'golden legs') then
sell(cid,2470,1,100000)
elseif isFandD(cid, 4) and msgcontains(msg, 'crown legs') then
sell(cid,2488,1,7000)
elseif isFandD(cid, 4) and msgcontains(msg, 'knight legs') then
sell(cid,2477,1,4000)
elseif isFandD(cid, 4) and msgcontains(msg, 'plate legs') then
sell(cid,2647,1,500)
elseif isFandD(cid, 4) and msgcontains(msg, 'brass legs') then
sell(cid,2478,1,100)
elseif isFandD(cid, 4) and msgcontains(msg, 'chain legs') then
sell(cid,2478,1,50)
elseif isFandD(cid, 4) and msgcontains(msg, 'legs') then
selfSay('I buy golden (100k), crown (7k), knight (4k), plate (500gp), brass (100gp) and chain legs (50gp).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'shield of the mastermind') or msgcontains(msg, 'mms') then
sell(cid,2514,1,100000)
elseif isFandD(cid, 4) and msgcontains(msg, 'great shield') then
sell(cid,2522,getCount(msg),150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'demon shield') then
sell(cid,2520,1,50000)
elseif isFandD(cid, 4) and msgcontains(msg, 'vampire shield') then
sell(cid,2534,1,80000)
elseif isFandD(cid, 4) and msgcontains(msg, 'medusa shield') then
sell(cid,2536,1,4000)
elseif isFandD(cid, 4) and msgcontains(msg, 'amazon shield') then
sell(cid,2537,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'crown shield') then
sell(cid,2519,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'tower shield') then
sell(cid,2528,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'dragon shield') then
sell(cid,2516,1,2000)
elseif isFandD(cid, 4) and msgcontains(msg, 'guardian shield') then
sell(cid,2515,1,1500)
elseif isFandD(cid, 4) and msgcontains(msg, 'beholder shield') then
sell(cid,2518,1,1000)
elseif isFandD(cid, 4) and msgcontains(msg, 'dwarven shield') then
sell(cid,2525,1,100)
elseif isFandD(cid, 4) and msgcontains(msg, 'shields') then
selfSay('I buy great shields (150k), demon (50k), vampire (5,5k), medusa (4k), amazon (3k), crown (3k), tower (3k), dragon (2k), guardian (1.5k), beholder (1k), and dwarven shields (100gp), also mms (100k)', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'giant sword') then
sell(cid,2393,1,10000)
elseif isFandD(cid, 4) and msgcontains(msg, 'bright sword') then
sell(cid,2407,1,6000)
elseif isFandD(cid, 4) and msgcontains(msg, 'ice rapier') then
sell(cid,2396,1,4000)
elseif isFandD(cid, 4) and msgcontains(msg, 'excalibur') then
sell(cid,2408,1,2000000)
elseif isFandD(cid, 4) and msgcontains(msg, 'fire sword') then
sell(cid,2392,1,3000)
elseif isFandD(cid, 4) and msgcontains(msg, 'serpent sword') then
sell(cid,2409,1,1500)
elseif isFandD(cid, 4) and msgcontains(msg, 'spike sword') then
sell(cid,2383,1,800)
elseif isFandD(cid, 4) and msgcontains(msg, 'two handed sword') then
sell(cid,2377,1,400)
elseif isFandD(cid, 4) and msgcontains(msg, 'magic longsword') then
sell(cid,2390,1,150000)
elseif isFandD(cid, 4) and msgcontains(msg, 'broad sword') then
sell(cid,2413,1,70)
elseif isFandD(cid, 4) and msgcontains(msg, 'short sword') then
sell(cid,2406,1,30)
elseif isFandD(cid, 4) and msgcontains(msg, 'sabre') then
sell(cid,2385,1,25)
elseif isFandD(cid, 4) and msgcontains(msg, 'sword') then
sell(cid,2376,1,25)
elseif isFandD(cid, 4) and msgcontains(msg, 'swords') then
selfSay('I buy magic longswords (150k), giant (10k), bright (6k), fire (3k) serpent (1.5k), spike (800gp) and two handed swords (400gp), also ice rapiers (4k), broad swords (70gp), short swords (30gp), sabres (25gp) and swords (25gp).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'dragon lance') then
sell(cid,2414,1,10000)
elseif isFandD(cid, 4) and msgcontains(msg, 'fire axe') then
sell(cid,2432,1,10000)
elseif isFandD(cid, 4) and msgcontains(msg, 'knight axe') then
sell(cid,2430,1,2000)
elseif isFandD(cid, 4) and msgcontains(msg, 'labrys') then
sell(cid,2435,1,2000000)
elseif isFandD(cid, 4) and msgcontains(msg, 'double axe') then
sell(cid,2387,1,200)
elseif isFandD(cid, 4) and msgcontains(msg, 'halberd') then
sell(cid,2381,1,200)
elseif isFandD(cid, 4) and msgcontains(msg, 'battle axe') then
sell(cid,2378,1,100)
elseif isFandD(cid, 4) and msgcontains(msg, 'hatchet') then
sell(cid,2388,1,20)
elseif isFandD(cid, 4) and msgcontains(msg, 'axes') then
selfSay('I buy fire (10k), knight (2k), double (200gp) and battle axes (100gp), also dragon lances (10k), halberds (200gp) and hatchets (20gp).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'war hammer') then
sell(cid,2391,1,4000)
elseif isFandD(cid, 4) and msgcontains(msg, 'golden mace') then
sell(cid,2437,1,2000000)
elseif isFandD(cid, 4) and msgcontains(msg, 'skull staff') then
sell(cid,2436,1,4000)
elseif isFandD(cid, 4) and msgcontains(msg, 'dragon hammer') then
sell(cid,2434,1,2000)
elseif isFandD(cid, 4) and msgcontains(msg, 'clerical mace') then
sell(cid,2423,1,200)
elseif isFandD(cid, 4) and msgcontains(msg, 'battle hammer') then
sell(cid,2417,1,60)
elseif isFandD(cid, 4) and msgcontains(msg, 'mace') then
sell(cid,2398,1,30)
elseif isFandD(cid, 4) and msgcontains(msg, 'clubs') then
selfSay('I buy war (4k), dragon (2k) and battle hammers (60gp), also skull staffs (4k) and clerical maces (200gp).', cid)

elseif isFandD(cid, 4) and msgcontains(msg, 'platinum amulet') then
sell(cid,2171,1,2000)
elseif isFandD(cid, 4) and msgcontains(msg, 'scarf') then
sell(cid,2661,1,500)
elseif isFandD(cid, 4) and msgcontains(msg, 'amulets') then
selfSay('I buy platinum amulets (2k) and scarfs (500gp).', cid)

elseif isFandD(cid, 4) and string.find(msg, '(%a*)bye(%a*)')then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!', cid)
removeFocus(cid)
move = true
end
end

function onCreatureChangeOutfit(creature)

end

function onThink()
randmove = math.random(1,20)

for i, focus in pairs(focuses) do
if(focus > 0)then
focus2 = focus
move = false
end
if(focus ~= 0)then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.', focus)
removeFocus(focus)
move = true
end
end
end

if(focus2 == 0 or move)then
cx, cy, cz = selfGetPosition()
if randmove == 1 then
nx = cx + 1
end
if randmove == 2 then
nx = cx - 1
end
if randmove == 3 then
ny = cy + 1
end
if randmove == 4 then
ny = cy - 1
end
if randmove >= 5 then
nx = cx
ny = cy
end
moveToPosition(nx, ny, cz)
end
end
don't work still sell only one item
 
Back
Top