TFS 0.X [Solved]Storage overflow?

kubernik

Well-Known Member
Joined
Jul 4, 2014
Messages
23
Best answers
2
Reaction score
7
Hello!
i'm using tfs 0.3.6
i have big problem with storage :/

i'm using storage to count killed monster and i seen that sometimes my storage has changed to string like this:
count from 1 to 4 AND...
4
-1
`ç$·˙
`ç$·˙
`ç$·˙
`ç$·˙
i dont know what function work wrong im trying to delete all from lib, globalevents and problem still is..
now i'm trying to detect problem with creaturescripts, but maybe someone know what is wrong and testing with that function:

Lua:
function onThink(interval, lastExecution, thinkInterval)
        --if getPlayerStorageValue(cid, 99992122) == 1 then
        for _, cid in ipairs(getPlayersOnline()) do
            if tonumber(getPlayerStorageValue(cid, 99992129)) ~= nil then
            else
                doPlayerAddItem(cid, 2160, 1)
            end
            if tonumber(getPlayerStorageValue(cid, 99992130)) ~= nil then
            else
                print(getPlayerStorageValue(cid, 99992130))
                doPlayerAddItem(cid, 2159, 1)
                setPlayerStorageValue(cid, 99992130,0)
            end           
            if tonumber(getPlayerStorageValue(cid, 99992131)) ~= nil then
            else
                print(getPlayerStorageValue(cid, 99992131))
                doPlayerAddItem(cid, 2158, 1)
                setPlayerStorageValue(cid, 99992131,0)
            end
            --print(getPlayerStorageValue(cid, 99992129))
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,getPlayerStorageValue(cid, 99992129))
                --if not exhaustion.check(cid, 99992125) then
                    if getPlayerStorageValue(cid, 99992130) < os.time() then
                        setPlayerStorageValue(cid, 99992130, os.time()+5)
                        setPlayerStorageValue(cid, 99992129,0)
                    elseif getPlayerStorageValue(cid, 99992130) >= os.time() then
                        if getPlayerStorageValue(cid, 99992129) < 0 then
                            setPlayerStorageValue(cid, 99992129, 0)
                            setPlayerStorageValue(cid, 99992131, 0)
                        elseif getPlayerStorageValue(cid, 99992129) >= 0 and getPlayerStorageValue(cid, 99992129) <= 200 then
                            setPlayerStorageValue(cid, 99992129, getPlayerStorageValue(cid, 99992129)+1)
                            setPlayerStorageValue(cid, 99992131, getPlayerStorageValue(cid, 99992131)+1)
                        elseif getPlayerStorageValue(cid, 99992129) >= 200 then
                            --doPlayerSendCancel(cid, "Calm down! You click too fast!")
                            --exhaustion.set(cid, 99992125, 2)
                            setPlayerStorageValue(cid, 99992129,0)
                            setPlayerStorageValue(cid, 99992131,0)
                            return true
                        end
                    end
        end
            --end
        --end
    return true
end
anyone? :(
 
OP
kubernik

kubernik

Well-Known Member
Joined
Jul 4, 2014
Messages
23
Best answers
2
Reaction score
7
This is just test storage, in main function i have something like 1000+ and problem still is.
That function is only test, add storage and back to 0.
Because i have random problem when function have one mission.. just 1+1 and something is not 2... It is `ç$·˙
 
OP
kubernik

kubernik

Well-Known Member
Joined
Jul 4, 2014
Messages
23
Best answers
2
Reaction score
7
I really like 8.54 version.
Im trying with tfs 0.4 and otx 2 patch 8.54 that problem still is..
so..
 

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,131
Best answers
164
Reaction score
2,201
Change the database to use INT instead of var for storage values.
Had this same issue 3-4 years ago.
 
OP
kubernik

kubernik

Well-Known Member
Joined
Jul 4, 2014
Messages
23
Best answers
2
Reaction score
7
@Xikini
First, Thanks for reason :)

Yes, this should help, but this probably ONLY prevent to display that string: `ç$·˙ and when occurs (?overflow?) in storage that should look like this:

count from 1 to 4 AND...
4
-1
`ç$·˙ -> 0
`ç$·˙ -> 0
`ç$·˙ -> 0
`ç$·˙ -> 0

because INT in database convert string to 0.
So this PROBABLY is not solution.
if that what i write is true, then in game when you doing any task.. example you have killed 900/1000 monster ->overflow and you have 0/1000, so it is stupid solution(and this will be easy done in LUA by function tonumber). xD
ofc i will test that with int, maybe that bug cannot be enabled when in database storage value is INT.
 

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,131
Best answers
164
Reaction score
2,201
int(11) has a maximum value of 2147483648 and a minimum value of -2147483648.

There is no reason why you should be 'overflowing' unless you are using preposterously large numbers.
 

Sarah Wesker

ค∂vαηcε รүηтαx ❤
Joined
Mar 16, 2017
Messages
443
Best answers
40
Reaction score
263
Location
London
I have used that version and the database is configured to save strings
Code:
VARCHAR(255)
also the server part
In lua you can use this:
Code:
print("1000" + "1000")
it is not necessary to convert the string to a number, the use of tonumber only serves to check if a string is a valid number.
 
OP
kubernik

kubernik

Well-Known Member
Joined
Jul 4, 2014
Messages
23
Best answers
2
Reaction score
7
@Xikini
I'm testing storage with INT for 5 hours and i dont get any bug info... earlier i got info within 5-10 minutes so i'm think that is working fine.
Well, you were right. :)
Thanks for help!
 
Top