• 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!

Lua Problem with my script :(

Tuchol

falania.com
Joined
Nov 21, 2008
Messages
387
Reaction score
13
Location
Uzbekistan
Hello Otlanders,

I have problem with my script ...

Code:
function onUse(cid, item, frompos, item2, topos)
if item.uid == 10223 and item.itemid == 6227 then
if getPlayerStorageValue(cid, 51511, 1) then
doSummonCreature("Bat", {x = 1037, y = 979, z = 7})
return
doSummonCreature("Bat", {x = 1033, y = 980, z = 7}),
doSummonCreature("Bat", {x = 1035, y = 978, z = 7}),
doSummonCreature("Mutated Bat", {x = 1035, y = 982, z = 7})
doPlayerSetStorageValue(cid, 51512, 1)
else
doPlayerSendCancel(cid,"Talk with Dracula.")
end
end
return 1
end


and the error
Code:
[22:52:38.262] [Error - LuaInterface::loadFile] data/actions/scripts/bat.lua:9: 'end' expected (to close 'if' at line 3) near 'doPlayerSetStorageValue'
[22:52:38.262] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/bat.lua)
[22:52:38.262] data/actions/scripts/bat.lua:9: 'end' expected (to close 'if' at line 3) near 'doPlayerSetStorageValue'
 
Try this:
Code:
function onUse(cid, item, frompos, item2, topos)
if item.uid == 10223 and item.itemid == 6227 then
    if getPlayerStorageValue(cid, 51511, 1) then
        doSummonCreature("Bat", {x = 1037, y = 979, z = 7})
        doSummonCreature("Bat", {x = 1033, y = 980, z = 7})
        doSummonCreature("Bat", {x = 1035, y = 978, z = 7})
        doSummonCreature("Mutated Bat", {x = 1035, y = 982, z = 7})
        doPlayerSetStorageValue(cid, 51512, 1)
    else
        doPlayerSendCancel(cid,"Talk with Dracula.")
    end
end
return 1
end
Also, what TFS are you using?
 
Read the error, it says that the "if" statement on line three never got closed with an end, it is because you returned it, and so it expected an end with that...
 
Try this:

Code:
function onUse(cid, item, frompos, item2, topos)
    if getPlayerStorageValue(cid, 51511, 1) then
        doSummonCreature("Bat", {x = 1037, y = 979, z = 7})
        doSummonCreature("Bat", {x = 1033, y = 980, z = 7})
        doSummonCreature("Bat", {x = 1035, y = 978, z = 7})
        doSummonCreature("Mutated Bat", {x = 1035, y = 982, z = 7})
        doPlayerSetStorageValue(cid, 51512, 1)
    else
        doPlayerSendCancel(cid,"Talk with Dracula.")
    end

return true
end
 
Back
Top