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

Koshei script help

Amped RPG

New Member
Joined
Aug 24, 2012
Messages
163
Reaction score
3
Lua:
  -- Blue Legs door

function onUse(cid, item, fromPosition, itemEx, toPosition)
        if item.uid == 5787 then
                if(isInArray({getPlayerStorageValue(cid, 50019), getPlayerStorageValue(cid, 50020), getPlayerStorageValue(cid, 50021), getPlayerStorageValue(cid, 50022), getPlayerStorageValue(cid, 8266), getPlayerStorageValue(cid, 36203)}, -1) == 1) then
                        doPlayerSendTextMessage(cid, 22, "No!!")
                else
                        doPlayerSendTextMessage(cid, 22, "You may pass.")
                        doTransformItem(item.uid, item.itemid + 1)
                        doTeleportThing(cid, toPosition, 1)
                end
                return 1
        end
        return 0
end

It's letting me pass no matter what, it should only let me pass if all storagevalues are set from the quest which include: 4 amulet pieces, sweaty cyc exchange, koshei amulet use on body.

If I'm reading it correctly it's taking each storage value and comparing it to a value which is [storagevalue - 1 = 0] and if any are =0 then it says No!

But it does not work.
Thanks!
Justin~
 
You're basically checking all the values for a -1.
It will return true when the first -1 is found, regardless of what the other values are.

That's what I think is happening.
 
Figured out how to do it a bit ago, changed it to only check for a storagevalue obtained by sweaty cyclops instead of trying to do 5 at once. Simple is better for me since I'm rather new to lua!

Thankyou and enjoy some rep for trying to help me anyways.

~Justin

How I changed it =)
Lua:
  -- Blue Legs door

function onUse(cid, item, fromPosition, itemEx, toPosition)
        if item.uid == 5787 then
                if getPlayerStorageValue(cid, 36203) == 1 then
                        doPlayerSendTextMessage(cid, 22, "You may pass.")
                        doTransformItem(item.uid, item.itemid + 1)
                        doTeleportThing(cid, toPosition, 1)
                else
                        doPlayerSendTextMessage(cid, 22, "No!!")                        
                end
                return 1
        end
        return 0
end
 
Back
Top