• 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 sum storages

Zazeros

Member
Joined
Feb 13, 2012
Messages
67
Reaction score
17
0.4

Hi guys, I had an idea about a cool system, but this idea will require me to sum storages, like this.

Player kill a monster and gain some storage value, like 2, so if he had (14000, -1), now it would be (14000, 1), and if he killed another monsters, (14000, 3), and so on

I already have the killing part count script, but it is not summing the storages
C++:
setPlayerStorageValue(cid, 14000, getPlayerStorageValue(cid, 14000) + 2)

What am I doing wrong?


Edit: I was putting this in the wrong place, sry.
Fixed
 
Last edited:
Also if you want to start counting from 0 instead -1 u can use this
Lua:
setPlayerStorageValue(cid, 14000, math.max(0, tonumber(getPlayerStorageValue(cid, 14000))) + 2)
 
Back
Top