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

Solved NPC How to check for more than one storage

Status
Not open for further replies.

BahamutxD

Jack of all trades, master of none
Joined
Jun 8, 2009
Messages
922
Solutions
19
Reaction score
511
Location
Spain
I want an NPC that checks a player to have more than one storage, for example.

The NPC checks if player have storages 31500-31501-31502-31003-31504-31505-31506
If the player have them, then set storage 30007
If the player doesn't have them, set storage 31500


if(msgcontains(msg, 'mission')) and
getPlayerStorageValue(cid,31500)
getPlayerStorageValue(cid,31501)
getPlayerStorageValue(cid,31502)
getPlayerStorageValue(cid,31503)
getPlayerStorageValue(cid,31504)
getPlayerStorageValue(cid,31505)
getPlayerStorageValue(cid,31506)
then
setPlayerStorageValue(cid,31507,1)

elseif
setPlayerStorageValue(cid, 31500)

end
end
 
Is this what you ment?
Code:
if(msgcontains(msg, 'mission') and getPlayerStorageValue(cid,31500)>0 and getPlayerStorageValue(cid,31501)>0 and getPlayerStorageValue(cid,31502)>0 and getPlayerStorageValue(cid,31503)>0 and getPlayerStorageValue(cid,31504)>0 and getPlayerStorageValue(cid,31505)>0 and getPlayerStorageValue(cid,31506)>0) then
    setPlayerStorageValue(cid,31507,1)
else
    setPlayerStorageValue(cid, 31500,1)

end
 
Code:
local result = false
for sum = 0, 6 do
    if getPlayerStorageValue(cid, 31500+sum) == 1 then
        result = true
        break
    end
end

setPlayerStorageValue(cid, result and 30007 or 31500, 1)
 
Status
Not open for further replies.
Back
Top