• 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} Setting values in .lua

Cadyan

Well-Known Member
Joined
Mar 30, 2008
Messages
845
Reaction score
63
Why doesn't this seem to work? Is there a better way to set the amount based on storage?
Code:
if getPlayerStorageValue(cid, 10012) == 1 then
                    amount = 5
else
                    amount = 1
end
local newamount = amount * 2
 
So with this below code, if the storage values are the same, the amount3 would equal 10?
While if the storage values were NOT the same, the value would equal 2?

Code:
local amount1 = getPlayerStorageValue(cid, 10011)
local amount2 = (getPlayerStorageValue(cid, 10012) == amount1 and 5 or 1)
local amount3 = (amount2 * 2)
 
Yes. In one line:
Code:
local amount = (getPlayerStorageValue(cid, 10012) == getPlayerStorageValue(cid, 10011) and 5 or 1) * 2
 
Back
Top