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

Need Help Fixing This Script

antoniolagos

Member
Joined
Apr 10, 2010
Messages
34
Reaction score
6
Hello, Im working in a script that don´t allow a player with a storage value attack a player with the same storage value. This is ok and working, but only allows 1 storage value:

Code:
local storage = 323245

function onCombat(cid, target)
    if getPlayerStorageValue(cid, storage) ~= -1 then
        if getPlayerStorageValue(cid, storage) == getPlayerStorageValue(target, storage) then
            return false
        end
    end

    return true
end

But now I need the same but add an extra storage value to have the same effect. I did this but this is not working:

Code:
local storage = 323245
local storage2 = 323244

function onCombat(cid, target)
    if getPlayerStorageValue(cid, storage) ~= -1 then
        if getPlayerStorageValue(cid, storage) == getPlayerStorageValue(target, storage) then
            return false
            else
    if getPlayerStorageValue(cid, storage2) ~= -1 then
        if getPlayerStorageValue(cid, storage2) == getPlayerStorageValue(target, storage2) then
            return false      
        end
    end
    end
    end
    return true
end

Please help me fix the second script, because the first one is working okay but i need to add an extra player storage value and the second i did not Okay. What is the error in the second script?
 
Last edited:
Solution
Hello, Im working in a script that don´t allow a player with a storage value attack a player with the same storage value. This is ok and working, but only allows 1 storage value:

Code:
local storage = 323245

function onCombat(cid, target)
    if getPlayerStorageValue(cid, storage) ~= -1 then
        if getPlayerStorageValue(cid, storage) == getPlayerStorageValue(target, storage) then
            return false
        end
    end

    return true
end

But now I need the same but add an extra storage value to have the same effect. I did this but this is not working:

Code:
local storage = 323245
local storage2 = 323244

function onCombat(cid, target)
    if getPlayerStorageValue(cid, storage) ~= -1 then
        if...
Hello, Im working in a script that don´t allow a player with a storage value attack a player with the same storage value. This is ok and working, but only allows 1 storage value:

Code:
local storage = 323245

function onCombat(cid, target)
    if getPlayerStorageValue(cid, storage) ~= -1 then
        if getPlayerStorageValue(cid, storage) == getPlayerStorageValue(target, storage) then
            return false
        end
    end

    return true
end

But now I need the same but add an extra storage value to have the same effect. I did this but this is not working:

Code:
local storage = 323245
local storage2 = 323244

function onCombat(cid, target)
    if getPlayerStorageValue(cid, storage) ~= -1 then
        if getPlayerStorageValue(cid, storage) == getPlayerStorageValue(target, storage) then
            return false
            else
    if getPlayerStorageValue(cid, storage2) ~= -1 then
        if getPlayerStorageValue(cid, storage2) == getPlayerStorageValue(target, storage2) then
            return false     
        end
    end
    end
    end
    return true
end

Please help me fix the second script, because the first one is working okay but i need to add an extra player storage value and the second i did not Okay. What is the error in the second script?
Lua:
local storage = 323245
local storage2 = 323244

function onCombat(cid, target)
    if (getPlayerStorageValue(cid, storage) ~= -1 and (getPlayerStorageValue(cid, storage) == getPlayerStorageValue(target, storage))) or (getPlayerStorageValue(cid, storage2) ~= -1 and (getPlayerStorageValue(cid, storage2) == getPlayerStorageValue(target, storage2))) then
        return false
    end
    return true
end
 
Solution
Back
Top