cosmopolitan
Well-Known Member
- Joined
- Sep 16, 2012
- Messages
- 46
- Reaction score
- 66
Hello everyone, can anyone tell me what is wrong with this script? I keep getting the error
Here's the script:
Basically the player put the items ({t1=2536,t2=2492,t3=2488,t4=2123}) on a coal basin at the position set up there, uses a stone and get the addon, that's what I wanted to do.
Thanks everyone!
'end' expected <to close 'for' at line 19> near ' <eof>
Here's the script:
local outfitmale = 145
local outfitfemale = 149
local addons = 1
function onUse(cid, item, item2,item3, item 4, frompos, topos, pos)
local config = {
["Wizard Helmet Addon"] = {t1=2536,t2=2492,t3=2488,t4=2123},
}
local r1 = {x = 182, y = 262, z = 9, stackpos= 2} -- Position 1 ( NãO MEXA NO stackpos= 2 )
local r2 = {x = 183, y = 262, z = 9, stackpos= 2} -- Position 2 ( NãO MEXA NO stackpos= 2 )
local r3 = {x = 185, y = 262, z = 9, stackpos= 2} -- Position 3 ( NãO MEXA NO stackpos= 2 )
local r4 = {x = 186, y = 262, z = 9} -- Position 4
local q1 = getThingfromPos(r1)
local q2 = getThingfromPos(r2)
local q3 = getThingfromPos(r3)
local q4 = getThingfromPos(r4)
for i, x in pairs(config) do
if (q1.itemid == x.t1 and q2.itemid == x.t2 and q3.itemid == x.t3 and q4.itemid == x.t4) then
doRemoveItem(q1.uid, 1)
doRemoveItem(q2.uid, 1)
doRemoveItem(q3.uid, 1)
doRemoveItem(q4.uid, 1)
if getPlayerStorageValue(cid, storage) == -1 then
doPlayerAddOutfit(cid, outfitmale, addons)
doPlayerAddOutfit(cid, outfitfemale, addons)
doPlayerSendTextMessage(cid, 21, "You just earned the helmet of the Wizard outfit!")
doSendMagicEffect(getCreaturePosition(cid), 28)
setPlayerStorageValue(cid, storage, 1)
else
doPlayerSendCancel(cid, "You already have this addon.")
end
return true
end
Basically the player put the items ({t1=2536,t2=2492,t3=2488,t4=2123}) on a coal basin at the position set up there, uses a stone and get the addon, that's what I wanted to do.
Thanks everyone!