01.11.2017, 19:00
Hello guys, i have a major problem on my server. I am using server side money for my server. I have a stock named TDConvertPrice which converts the price inserting a comma to make it look neater.
For example if i have a x=1000 i do TDConvertPrice(x) and will print on my textdraw $1,000
I would like to point out that if i sum 100k 10 times it works correctly .
I do not know if it is strins or valstr bug or something else
Me and a friend have tried almost everything. Any possible idea?
However whenever i use values >= 1mil it crashes server.
Here is the code:
My setplayermoney function
For example if i have a x=1000 i do TDConvertPrice(x) and will print on my textdraw $1,000
I would like to point out that if i sum 100k 10 times it works correctly .
I do not know if it is strins or valstr bug or something else
Me and a friend have tried almost everything. Any possible idea?
However whenever i use values >= 1mil it crashes server.
Here is the code:
Код:
stock TDConvertPrice(price) { new pricestring[12]; new j = valstr(pricestring,price); while(j >= 4) { j -= 3; strins(pricestring,"~y~,~w~",j); } strins(pricestring,"~g~$~w~",0); return pricestring; }
Код:
SetPlayerMoney(playerid, value) { new query[67], str[67]; pinfo[playerid][Money] = value; format(str, sizeof(str), "Cash:_%s", TDConvertPrice(pinfo[playerid][Money])); PlayerTextDrawSetString(playerid, PlayerGUIPTD[4][playerid], str); UpdatePlayerTextDraw(playerid, PlayerGUIPTD[4][playerid]); mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `Money` = %d WHERE `ID`=%d", pinfo[playerid][Money], pinfo[playerid][ID]); mysql_pquery(mysql, query, "",""); return 1; }