can someone help to change this code to work with local table instead of elseif
Lua:
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, wands, rods, helmets, boots, legs, shields and armors.', cid)
addFocus(cid)
elseif isFandD(cid, 4) and msgcontains(msg, 'test') then
sell(cid,2446,1,600000)
elseif isFandD(cid, 4) and msgcontains(msg, 'test2') then
sell(cid,2447,1,100)
else
selfSay('you don\'t have enought! ')
end
end