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

Dodge System Error

megazx

Graphic designer
Joined
Mar 4, 2013
Messages
443
Solutions
2
Reaction score
32
Location
Egypt
can some one fix this Quick
[9:18:43.583] [Error - LuaInterface::loadFile] data/actions/scripts/dodgestone.l
ua:7: unfinished string near '"].)'

this is the script
Lua:
local limit = 100
local storagedodge = 98798644
function onUse (cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue (cid, storagedodge) == -1 then
        DoPlayerSetStorageValue (cid, storagedodge, (getPlayerStorageValue (cid, storagedodge)) + 2)
        DoPlayerSendCancel (cid, "DodgeSKILL: [" .. getPlayerStorageValue (cid, storagedodge) .. "/" .. limit .. "].)
    elseif getPlayerStorageValue (cid, storagedodge)> = -1 and getPlayerStorageValue (cid, storagedodge) <= limit then
        DoPlayerSetStorageValue (cid, storagedodge, (getPlayerStorageValue (cid, storagedodge)) + 1)
        DoPlayerSendCancel (cid, "DodgeSKILL: [" .. getPlayerStorageValue (cid, storagedodge) .. "/" .. limit .. "].)
        DoRemoveItem (item.uid, 1)
    else
        DoPlayerSendCancel (cid, "You've already reached the maximum. DodgeSKILL: [" .. getPlayerStorageValue (cid, storagedodge) .. "/" .. limit .. "])
    end
    return true
end
 
Lua:
local limit = 100
local storagedodge = 98798644
function onUse (cid, item, fromPosition, itemEx, toPosition)
        if getPlayerStorageValue (cid, storagedodge) == -1 then
                DoPlayerSetStorageValue (cid, storagedodge, (getPlayerStorageValue (cid, storagedodge)) + 2)
                DoPlayerSendCancel (cid, "DodgeSKILL: [" .. getPlayerStorageValue (cid, storagedodge) .. "/" .. limit .. "].")
    elseif getPlayerStorageValue (cid, storagedodge)> = -1 and getPlayerStorageValue (cid, storagedodge) <= limit then
            DoPlayerSetStorageValue (cid, storagedodge, (getPlayerStorageValue (cid, storagedodge)) + 1)
            DoPlayerSendCancel (cid, "DodgeSKILL: [" .. getPlayerStorageValue (cid, storagedodge) .. "/" .. limit .. "].")
                DoRemoveItem (item.uid, 1)
        else
                DoPlayerSendCancel (cid, "You've already reached the maximum. DodgeSKILL: [" .. getPlayerStorageValue (cid, storagedodge) .. "/" .. limit .. "]")
    end
    return true
end
 
New error after i use ur script :(


[11:25:18.651] [Error - LuaInterface::loadFile] data/actions/scripts/dodgestone.
lua:7: unexpected symbol near '='
[11:25:18.654] [Warning - Event::loadScript] Cannot load script (data/actions/sc
ripts/dodgestone.lua)
[11:25:18.655] data/actions/scripts/dodgestone.lua:7: unexpected symbol near '='

[11:25:21.578] [Error - LuaInterface::loadFile] data/creaturescripts/scripts/dod
gecombat.lua:8: unexpected symbol near 'if'
[11:25:21.579] [Warning - Event::loadScript] Cannot load script (data/creaturesc
ripts/scripts/dodgecombat.lua)
[11:25:21.580] data/creaturescripts/scripts/dodgecombat.lua:8: unexpected symbol
near 'if'​
 
elseif getPlayerStorageValue (cid, storagedodge)> = -1 and getPlayerStorageValue (cid, storagedodge) <= limit then
there is a space between > and = which causes this error.

Also for easier read make a local variable for things you use more than 1 time

Code:
local limit = 100
local storagedodge = 98798644
function onUse (cid, item, fromPosition, itemEx, toPosition)
local dodgeValue = getPlayerStorageValue (cid, storagedodge)
local cancelMsg = "DodgeSKILL: [" .. dodgeValue .. "/" .. limit .. "]."

        if dodgeValue  == -1 then
                DoPlayerSetStorageValue (cid, storagedodge, dodgeValue + 2)
                DoPlayerSendCancel (cid, cancelMsg)
    elseif dodgeValue >= -1 and dodgeValue <= limit then
            DoPlayerSetStorageValue (cid, storagedodge, dodgeValue + 1)
            DoPlayerSendCancel (cid, cancelMsg)
                DoRemoveItem (item.uid, 1)
        else
                DoPlayerSendCancel (cid, "You've already reached the maximum. "..cancelMsg)
    end
    return true
end
 
Last edited:
there is a space between > and = which causes this error.

Also for easier read make a local variable for things you use more than 1 time

Code:
local limit = 100
local storagedodge = 98798644
function onUse (cid, item, fromPosition, itemEx, toPosition)

local dodgeValue = getPlayerStorageValue (cid, storagedodge)
local cancelMsg = "DodgeSKILL: [" .. dodgeValue .. "/" .. limit .. "]."

        if dodgeValue  == -1 then
                DoPlayerSetStorageValue (cid, storagedodge, dodgeValue + 2)
                DoPlayerSendCancel (cid, cancelMsg)
    elseif dodgeValue >= -1 and dodgeValue <= limit then
            DoPlayerSetStorageValue (cid, storagedodge, dodgeValue + 1)
            DoPlayerSendCancel (cid, cancelMsg)
                DoRemoveItem (item.uid, 1)
        else
                DoPlayerSendCancel (cid, "You've already reached the maximum. "..cancelMsg)
    end
    return true
end
There are spaces and capitals everywhere. I'll be surprised if the code works.
Not sure where OP got the code, or if his text editor has some weird setting enabled, but man.. xD
Also.. the item is not being removed the first time it's used? And they can reach Dodge chance 101.. which is past the limit?
Here's what I think the code should look like :s

Lua:
local limit = 100
local storagedodge = 98798644

function onUse (cid, item, fromPosition, itemEx, toPosition)
   local dodgeValue = getPlayerStorageValue(cid, storagedodge)
   local cancelMsg = "DodgeSKILL: [" .. dodgeValue .. "/" .. limit .. "]."
   
   if dodgeValue == limit then
       doPlayerSendCancel(cid, "You've already reached the maximum. " .. cancelMsg)
       return true
   end
   
   if dodgeValue < 0 then
       doPlayerSetStorageValue(cid, storagedodge, 1)
   elseif dodgeValue > 0 and dodgeValue < limit then
       doPlayerSetStorageValue(cid, storagedodge, dodgeValue + 1)
   end
   doPlayerSendCancel(cid, cancelMsg)
   doRemoveItem(item.uid, 1)
   return true
end
 
thanks you Xikini for the help
and big thanks to whitevo he was a great help making this work
Solved .
 
Back
Top