Mysql issue
#1

Ok i got my houses working on mysql but somthing esle has gone wrong, when i tried to convert my business to mysql it would load the business but not the houses so i decided to look in to it and couldn't figure out what was causing the problem, Ok so OnGameModeInit i got these

pawn Код:
LoadFactions();
print("Factions Loaded");
LoadBuildings();
print("Buildings Loaded");
LoadBusinesses();
print("Businesses Loaded");
LoadSQLHouses();
print("Houses Loaded");
For some reason it dosen't show the "Houses Loaded" when i first start the server, It shows the other ones just fine.

here is the LoadSQLHouses
pawn Код:
forward LoadSQLHouses();
public LoadSQLHouses()
{
//  new string [128];
    new arrCoords[25][32];
    new sql[384], row[384];
    format(sql, sizeof(sql), "SELECT COUNT(*) FROM houses");
    mysql_query(sql);
    mysql_store_result();
    mysql_fetch_row(row);
    totalhouses = strval(row);
    mysql_free_result();
    //printf("%d Houses loaded from database", totalhouses);

    for (new idx=0; idx<totalhouses; idx++)
    {
        format(sql, sizeof(sql), "SELECT Howner, Enterx, Entery, Enterz, Exitx, Exity, Exitz, Hint, Hworld, Hprice, Rentprice, Hrentable, Hlocked, Hdrugs, Hmats, Hgun1, Hammo1, Hgun2, Hammo2, Hgun3, Hammo3, Hmoney, Howned, Hlevel, Hdate FROM houses WHERE id=%d", idx+1);
        mysql_query(sql);
        //if (DEBUG) SQLLog(sql);
        mysql_store_result();
        if (mysql_num_rows() > 0)
        {
            mysql_fetch_row(row);
            split(row, arrCoords, '|');
            mysql_free_result();
            //HouseInfo[idx][hId] = strval(arrCoords[0]);
            strmid(HouseInfo[idx][hOwner], arrCoords[0], 0, strlen(arrCoords[0]), 255);
            HouseInfo[idx][hEnterX] = floatstr(arrCoords[1]);
            HouseInfo[idx][hEnterY] = floatstr(arrCoords[2]);
            HouseInfo[idx][hEnterZ] = floatstr(arrCoords[3]);
            HouseInfo[idx][hExitX] = floatstr(arrCoords[4]);
            HouseInfo[idx][hExitY] = floatstr(arrCoords[5]);
            HouseInfo[idx][hExitZ] = floatstr(arrCoords[6]);
            HouseInfo[idx][EnterInterior] = strval(arrCoords[7]);
            HouseInfo[idx][EnterWorld] = strval(arrCoords[8]);
            HouseInfo[idx][hPrice] = strval(arrCoords[9]);
            HouseInfo[idx][hRentPrice] = strval(arrCoords[10]);
            HouseInfo[idx][hRentable] = strval(arrCoords[11]);
            HouseInfo[idx][hLocked] = strval(arrCoords[12]);
            HouseInfo[idx][hDrugs] = strval(arrCoords[13]);
            HouseInfo[idx][hMaterials] = strval(arrCoords[14]);
            HouseInfo[idx][hGun1] = strval(arrCoords[15]);
            HouseInfo[idx][hGunAmmo1] = strval(arrCoords[16]);
            HouseInfo[idx][hGun2] = strval(arrCoords[17]);
            HouseInfo[idx][hGunAmmo2] = strval(arrCoords[18]);
            HouseInfo[idx][hGun3] = strval(arrCoords[19]);
            HouseInfo[idx][hGunAmmo3] = strval(arrCoords[20]);
            HouseInfo[idx][hMoney] = strval(arrCoords[21]);
            HouseInfo[idx][hOwned] = strval(arrCoords[22]);
            HouseInfo[idx][hLevel] = strval(arrCoords[23]);
            HouseInfo[idx][hDate] = strval(arrCoords[24]);
            new pickups;
            for(new h = 0; h < sizeof(HouseInfo); h++)
            {
            if(HouseInfo[h][hOwned] == 0)
            {
                AddStaticPickup(1273, 2, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
                pickups++;
            }
            if(HouseInfo[h][hOwned] == 1)
            {
                AddStaticPickup(1239, 2, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
                pickups++;

            }
           
        }
       
    }

}
    return 1;
}
The houses still load but then i can't make my business load cause since business load before houses it would load business and just skip my houses, If i do it the other way around it will do the same, Now say i put LoadSQLHouses on top of all the other load functions then nothing shows, Not even load houses. If i put LoadSQLHouses at the top of OnGameModeInit (it's currently on the bottom) It dosen't load my cars or anything esle thats OnGameModeInit What could be causing this?

Nothing is appearing in the logs

Server Log
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3a R7, ©2005-2010 SA-MP Team

[01:06:54] filterscripts = ""  (string)
[01:06:54] 
[01:06:54] Server Plugins
[01:06:54] --------------
[01:06:54]  Loading plugin: streamer
[01:06:54] 

*** Streamer Plugin v2.3.8 by Incognito loaded ***


[01:06:54]   Loaded.
[01:06:54]  Loading plugin: mysql
[01:06:54]  SA:MP MySQL Plugin 1.2.1 Loaded.
[01:06:54]   Loaded.
[01:06:54]  Loaded 2 plugins.

[01:06:54] MySQL: Query thread running. Thread safe: Yes.
[01:06:54] 
[01:06:54] Filter Scripts
[01:06:54] ---------------
[01:06:54]   Loaded 0 filter scripts.

[01:06:54] MySQL: Connected (0) to root @ 127.0.0.1 via TCP/IP. MySQL version 5.1.41.
[01:06:54]  
[01:06:54] Loading Config......
[01:06:54] DEBUG is on
[01:06:54] realtime 1       * Pc clock synced

[01:06:54] timeshift -6     * (eg -3) permenetly shift the server timezone

[01:06:54] worldtime 12     * 0~23 realtime 1 Disables

[01:06:54] levelexp 1       * Exp points * nextlevel Req to level up e.g.Level 2 takes 8 hours here, Level 3 ~ 16 hrs

[01:06:54] .....Config Settings Loaded
[01:06:54] 1 -6 12
[01:06:54] Factions Loaded
[01:06:54] Buildings Loaded
[01:06:54] Businesses Loaded
[01:06:56] Number of vehicle models: 78
Mysql Log This is only the Last mysql thing
Код:
[08/14/10 01:06:56] Function: 'mysql_query' executed: "SELECT Howner, Enterx, Entery, Enterz, Exitx, Exity, Exitz, Hint, Hworld, Hprice, Rentprice, Hrentable, Hlocked, Hdrugs, Hmats, Hgun1, Hammo1, Hgun2, Hammo2, Hgun3, Hammo3, Hmoney, Howned, Hlevel, Hdate FROM houses WHERE id=501" with result: "0".

[08/14/10 01:06:56] Function: 'mysql_num_rows' called with result: "1".

[08/14/10 01:06:56] Function: 'mysql_fetch_row' called with result: "0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)