So, I made this script, so when you step in a tile you get a color and effects.
I made it to work in a long script, but when I tried to put it in a table it didn't work.
Old script:
Tabled:
Im still learning so, any help is welcome
No errors displayed in console.
I made it to work in a long script, but when I tried to put it in a table it didn't work.
Old script:
Lua:
function onStepIn(cid, item, pos)
ppos = getPlayerPosition(cid)
if item.uid == 3890 then
doSetCreatureLight(cid, 10, 5, 60*100)
doSendMagicEffect(ppos, 12)
doSendAnimatedText(ppos,"Ea ea", 5)
doSendMagicEffect(ppos, 23)
elseif item.uid == 3891 then
doSetCreatureLight(cid, 10, 18, 60*100)
doSendMagicEffect(ppos, 14)
doSendAnimatedText(ppos,"Wooho", 18)
doSendMagicEffect(ppos, 27)
elseif item.uid == 3892 then
doSetCreatureLight(cid, 10, 180, 60*100)
doSendMagicEffect(ppos, 13)
doSendAnimatedText(ppos,"Ea ea", 180)
doSendMagicEffect(ppos, 18)
elseif item.uid == 3893 then
doSetCreatureLight(cid, 10, 210, 60*100)
doSendMagicEffect(ppos, 7)
doSendAnimatedText(ppos,"Disco!", 210)
doSendMagicEffect(ppos, 21)
elseif item.uid == 3894 then
doSetCreatureLight(cid, 10, 190, 60*100)
doSendMagicEffect(ppos, 35)
doSendAnimatedText(ppos,"Fiesta", 180)
doSendMagicEffect(ppos, 24)
elseif item.uid == 3895 then
doSetCreatureLight(cid, 10, 192, 60*100)
doSendMagicEffect(ppos, 10)
doSendAnimatedText(ppos,"Ea ea", 180)
doSendMagicEffect(ppos, 22)
return true
end
end
Tabled:
Lua:
local uids = {
["3890"] = {5,12,"Ea ea"},
["3891"] = {18,14,"Wooho"},
["3892"] = {180,13,"Ea ea"},
["3893"] = {210,7,"Disco!"},
["3894"] = {190,35,"Fiesta"},
["3895"] = {193,10,"Ea ea"},
}
function onStepIn(cid, item, pos)
ppos = getPlayerPosition(cid)
for txt, v in pairs(uids) do
if item.uid == txt then
doSetCreatureLight(cid,10,v[1],60*100)
doSendMagicEffect(ppos,v[2])
doSendAnimatedText(ppos,v[3],v[1])
return true
end
end
end
Im still learning so, any help is welcome
No errors displayed in console.
Last edited: