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

(Question) Money bug, hardcoders required! +Repping (6 bars)

Guitar Freak

_LüA_n☺b_
Joined
Dec 27, 2008
Messages
831
Reaction score
13
Location
Caracas, Venezuela
Note: Im aware that I could/should've posted this on C++ section, but the amount of people that ever checks the Support section there just didnt "sell" it for me, so Id rather take my chances and post it here!

Anyway, to the point. Checking another thread with a similar request, I just realized that this:
4294967295 (max value of uint32_t)

Is the exact amount where money "bugs" on my 0.3.5pl1 servers (and any other 0.3.5+ TFS for that matter).

I never knew why it happened, someone told me it was a LUA problem, that LUA just couldnt read values over that number so they bugged after that point, but now that I see this..
I guess maybe there is a way to change and fix this problem through sources? :blink:

About the bug:

The "money bug" Im talking about is the fact that after 4294967295 (4.2 billion), if you had for example 4294967296 and you did the command to check your money it would tell you that you have 1 gp, instead of 4294967296. It just kinda resets, and if you buy something that costs 2 gp when having 4294967296, you lose 1 gp + the other 4294967295 on the purchase :) 4294967296 gp for the price of 2, pretty good deal isnt it? :)

I already found a way to go "around" this problem, but if a direct solution like this was possible, it would definitely be better!

The question:

So Im wondering:

Is there any way to change the "uint32_t" value (the one with 4294967295 as max value) for this matter, to "uint64_t" (which has "18446744073709551615" as max value) ?

The consequences:

Do you think it would fix the problem? And would it affect the server's "technical" performance in any way? Like making it lag, or non-compatible with certain OSs or something similar?

The.. end? :blink:

Im very lousy at hardcoding and Im clueless on how to even start with this issue so some help would be very appreciated here!

As always, Ill be +Repping real helpful responses :peace:

Thanks in advance.
 
Last edited:
Bump. I fixed all references but Im stuck at this error:

PHP:
../luascript.cpp: In member function `virtual void LuaScriptInterface::registerFunctions()':
../luascript.cpp:1331: error: invalid conversion from `int64_t (*)(lua_State*)' to `int (*)(lua_State*)'

../luascript.cpp:1331: error:   initializing argument 2 of `void lua_pushcclosure(lua_State*, int (*)(lua_State*), int)'

../luascript.cpp:1576: error: invalid conversion from `int64_t (*)(lua_State*)' to `int (*)(lua_State*)'

../luascript.cpp:1576: error:   initializing argument 2 of `void lua_pushcclosure(lua_State*, int (*)(lua_State*), int)'
../luascript.cpp:1579: error: invalid conversion from `int64_t (*)(lua_State*)' to `int (*)(lua_State*)'
../luascript.cpp:1579: error:   initializing argument 2 of `void lua_pushcclosure(lua_State*, int (*)(lua_State*), int)'
../luascript.cpp:1582: error: invalid conversion from `int64_t (*)(lua_State*)' to `int (*)(lua_State*)'
../luascript.cpp:1582: error:   initializing argument 2 of `void lua_pushcclosure(lua_State*, int (*)(lua_State*), int)'

make.exe: *** [obj//luascript.o] Error 1

Execution terminated

Any idea what this "invalid conversion" means?
 
Im guessing its trying to convert a 64 bit integer to a normal integer (Which is 32 bit I think) so your going to have to change it. Try longint as I know is some languages int = 32 bit integer, and longint = 64 bit integer.
 
show code

I appreciate it, but the problem is that I dont know which code to show you, Ive changed so much stuff blindly that I have no idea of what is happening.. only thing is the reference from the errors stated, but I dont even see how they relate to the error:

PHP:
	//getPlayerMoney(cid)
	lua_register(m_luaState, "getPlayerMoney", LuaScriptInterface::luaGetPlayerMoney);

(its the same on all errors but with different functions)

I think mostly the help I need is if someone like Elf or another original TFS dev could come and just tell me what/where are the codes I need to change exactly to do what I stated on the first post because Im sure Im not doing it correctly.
 
Back
Top Bottom