• 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 How to get a number of storagevalues

Gsp

RP
Joined
Jan 3, 2008
Messages
250
Solutions
1
Reaction score
4
I'm trying to create a npc that will reward the player if the player has at least 4 out of 8 storagevalues (doenst matter which one)
spent 3 hours trying to script it but still nothing .i need your help.
 
you mean the npc need to check 4 storage values?
for example 5001 , 5002 , 5003 , 5004
if player got those storage " 1 " which means true
npc will reward him with item?

so 1 item if he got 4 storage done ?
or 1 item per 1 storage?

little edit

or you need npc to reward player if player has any 4 random storage values?
 
Last edited:
Code:
local n = 0
for i = 5001, 5008 do
   if getPlayerStorageValue(cid, i) >= 1 then
     n = n +1
   end
end

if n >= 4 then
   -- doSomething
end

If the storage numbers are totaly different and not like 5001, 5002, 5003 etc, you can add them in a table.
 
Code:
local n = 0
for i = 5001, 5008 do
   if getPlayerStorageValue(cid, i) >= 1 then
     n = n +1
   end
end

if n >= 4 then
   -- doSomething
end

If the storage numbers are totaly different and not like 5001, 5002, 5003 etc, you can add them in a table.

thanks so much <3
 
Back
Top