Strange float values
#1

So, I built a housing system now and everything seems to work like a charm on my local server. When I upload it to any host, I get a problem.

This is the part of my code loading data from the database:
pawn Код:
mysql_fetch_row_format(Kweri);
            sscanf(Kweri, "e<p<|>iiis[24]iiiiffffff>", HouseInfo[i]);
            mysql_free_result();
And this is mysql debugging:
pawn Код:
[13:23:39] CMySQLHandler::FetchRow() - Return: 1|1|1500000|[IM]Matt|0|1|0|2|-2574|1152.09|55.7266|225.705|1022.71|1084.01
[13:23:39] >> mysql_free_result( Connection handle: 1 )
[13:23:39] CMySQLHandler::FreeResult() - Result was successfully free'd.
This is my debugging command:
pawn Код:
CMD:coords(playerid, params[])
{
    new id;
    if(sscanf(params, "i", id)) return SendClientMessage(playerid, -1, "ID please..");
    SendFMessage(playerid, -1, "House ID: %i, House Owned: %i, House Price: $%i", HouseInfo[id][HouseID], HouseInfo[id][hOwned], HouseInfo[id][hPrice]);
    SendFMessage(playerid, -1, "Owner: %s, Locked: %i, World ID: %i", HouseInfo[id][hOwner], HouseInfo[id][hLocked], HouseInfo[id][hWorld]);
    SendFMessage(playerid, -1, "Money: $%i, Interior type: %i", HouseInfo[id][hStoredMoney], HouseInfo[id][hInteriorID]);
    SendFMessage(playerid, -1, "Exterior; X: %f, Y: %f, Z: %f", HouseInfo[id][OutX], HouseInfo[id][OutY], HouseInfo[id][OutZ]);
    SendFMessage(playerid, -1, "Interior; X: %f, Y: %f, Z: %f", HouseInfo[id][IntX], HouseInfo[id][IntY], HouseInfo[id][IntZ]);
    return 1;
}
So this is my debug result:


The Exterior 'X' co-ordinate seems to be modified at a point which is no-where on my code. It's not modified in the local test server, but happens to be modified in a host.
Reply
#2

sscanf enumerator splitting must equal the order of constants in enumerator used for HouseInfo array.
Reply
#3

It's all matching, and the problem occurs only when I run the server in host. It runs without any problems in local server.. Got any other suggestions?
Reply
#4

So is that it? Nobody knows the solution for this?
Reply
#5

@******, I'm certainly sure that the server loads up everything from the database in LOCAL SERVER (127.0.0.1) and also in the server host. The problem is that ONLY the "exterior X co-ordinate" (i.e. OutX) is being modified IN SERVER HOST, though the mysql log is retrieving it perfectly. I'm using sscanf there to split up the retrieved data into their respective variables which is also in the same order as that of housing table. Here's my enumeration:
pawn Код:
enum HInfo
{
    HouseID,
    hOwned,
    hPrice,
    hOwner[24],
    hLocked,
    hWorld,
    hStoredMoney,
    hInteriorID,
    Float:OutX,
    Float:OutY,
    Float:OutZ,
    Float:IntX,
    Float:IntY,
    Float:IntZ
};
new HouseInfo[MAX_HOUSES][HInfo];
I'm telling this again; the houses are loaded and I'm able to teleport to the proper X co-ordinate in my local server, but not in the host.
Reply
#6

What version of MySQL plugin is this, son? Is it StrickenKid's?
Reply
#7

The very old version i.e. G-sTyLeZzZ's MySQL R5. I printed the retrieved query in the console and also the OutX position and it was strange to see this:
pawn Код:
[19:53:51] 322|0|5000000|None|0|322|0|3|1503.27|2567.7|10.8203|2324.39|-1148.35|1050.71
[19:53:51] 322. -./,),(-*,(.((((((
It's clearly visible that 1503.27 is modified as a group of symbols, while other coordinates are printed correctly.
Reply
#8

Sorry for the double-post. But this is fucking really weird. I cannot believe that I found out the problem. I debugged the whole code line by line, callback by callback and noticed that the error was with sscanf parsing. Even though I was using sscanf 2.8, I tried re-installing sscanf and this freaking solved the issue.

This is what I got from the logs now:
pawn Код:
[20:07:35] 323|0|2500000|None|0|323|0|1|1516.07|2610.19|11.2989|225.764|1239.96|1082.14
[20:07:35] 323. 1516.069946
Thanks for your intention to help anyways.
Reply
#9

Why would you use an outdated version of MySQL plugin? This version doesn't even have threading and is just going to make your script worse by being non-threaded and MySQL.
Reply
#10

I know it should be better to use R40+ versions, but the gamemode is old and is completely built with the old MySQL concepts. So.. we're planning to create a new mode from scratch in the near future.. Thanks for your advise though!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)