Weird problem with float
#1

Hello. I have an interesting problem with setting float to a variable. I dont

understand why, but after 12 id of a loop, float is not set to a variable.

code:

pawn Код:
#define MAX_ARENAS (216)

enum arenainfo
{
 Float:homexa,
 Float:homeya,
 Float:homeza,
 Float:attxa,
 Float:attya,
 Float:attza,
 Float:defxa,
 Float:defya,
 Float:defza,
 interiora,
 Float:area1a,
 Float:area2a,
 Float:area3a,
 Float:area4a
}

new ArenaI[MAX_ARENAS][arenainfo];

function LoadMySQLSettings()
{
    print("~~~~~ Loading settings from MySQL");
    Loop(a,MAX_ARENAS)
    {
        new Querry[64];
        new datastr[16];
        format(Querry,sizeof(Querry),"SELECT * FROM `arenas` WHERE `id` =

'%d'"
,a);
        mysql_query(Querry);
        mysql_store_result();
        mysql_fetch_field("homex", datastr);
        printf("%f",floatstr(datastr));
        ArenaI[a][homexa] = floatstr(datastr);
        printf("%d",a);
    }
    printf("~ Loaded: %d arenas",MAX_ARENAS);
print("~~~~~ Settings successfuly loaded from MySQL");
    return 1;
}
And here it is what i get in server_log.txt

[19:08:27] -2469.639892
[19:08:27] 0
[19:08:27] 606.604003
[19:08:27] 1
[19:08:27] -73.897697
[19:08:27] 2
[19:08:27] -1859.020019
[19:08:27] 3
[19:08:27] -2158.459960
[19:08:27] 4
[19:08:27] 256.148010
[19:08:27] 5
[19:08:27] 2254.129882
[19:08:27] 6
[19:08:27] 1296.910034
[19:08:27] 7
[19:08:27] -191.979995
[19:08:27] 8
[19:08:27] 2632.969970
[19:08:27] 9
[19:08:27] 721.685974
[19:08:27] 10
[19:08:27] 2838.159912
[19:08:27] 11
[19:08:27] -1394.040039
[19:08:27] 12
[19:08:27] -1410.130004
[19:08:27]


Any opinions?
Reply
#2

Just remove this printf("~ Loaded: %d arenas",MAX_ARENAS);
Or;
Remove all printf that would be better, In order to check that the arenas are loaded or not just go to that place and check.
Reply
#3

It doesnt matter if i use printf if no, still it's not loaded...
Reply
#4

I tested this code in new.pwn and its working, so what is going on..
Reply
#5

Fixed myself.

i had:

pawn Код:
enum s_info
{
 SKIN_A,
 SKIN_B,
 SKIN_C,
 Timer,
 Started,
 Players_A,
 Players_B,
 Score_A,
 Score_B,
 Float:Health_A,
 Float:Health_B,
 Name_A[11],
 Name_B[11],
 Type,
 PlayID,
 Mins,
 Secs,
 Count,
 Swap,
 Float:LobbyX,
 Float:LobbyY,
 Float:LobbyZ,
 Float:LobbyR,
 Starting,
 AFK_A,
 AFK_B,
 Alive_A,
 Alive_B,
 Ammo[MAX_WEAPONS],
 WinTimer,
 TabTimer,
 Website
}
Last variabe Website is a string, and i didnt add size, so that was the problem.
Reply
#6

Remember to set length of your queries to a higher length, because mysql sometimes needs a lot of length .. Like Query[128] or more, I saw that I some topic and thought I would get you aware of it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)