I think I could use some help here regarding MySQL
#1

I think I could use some help here regarding MySQL. Well first of all I am using 0.3b R2 since SA-MP Anderius has not been updated to 0.3c. I am using StrickenKid's MySQL plugin v2.0. Well I am trying to make a bizz system. Well I know there is something wrong with my code but I can't locate the problem.No errors or warnings.
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3b R2, ©2005-2010 SA-MP Team

[12:14:59] 
[12:14:59] Server Plugins
[12:14:59] --------------
[12:14:59]  Loading plugin: mysql
[12:14:59]  SA:MP MySQL Plugin v2.0 Loaded.
[12:14:59]   Loaded.
[12:14:59]  Loading plugin: sscanf
[12:14:59] [MySQL] Thread running. Threadsafe: Yes.
[12:14:59] 

[12:14:59]  ===============================

[12:14:59]       sscanf plugin loaded.     

[12:14:59]    © 2009 Alex "******" Cole

[12:14:59]  ===============================

[12:14:59]   Loaded.
[12:14:59]  Loaded 2 plugins.

[12:14:59] 
[12:14:59] Filter Scripts
[12:14:59] ---------------
[12:14:59]   Loading filter script 'fsdebug.amx'...
[12:14:59] 
  *********************
  * SA:MP DEBUG 0.2   *
[12:14:59]   * By Simon Campbell *
  *********************
[12:14:59]   * Version: 0.5c      *
  *********************
[12:14:59]   * -- LOADED         *
  *********************

[12:14:59]   Loading filter script 'fly.amx'...
[12:14:59]   Loaded 2 filter scripts.

[12:14:59] [MySQL] Connected (0) to pete @ localhost via TCP/IP.
[12:14:59] [MySQL] Version 5.1.41.
[12:14:59] [Database] Loading Bizz ID: 0
[12:14:59] [Database] Loading Bizz ID: 1
[12:14:59] [Database] Loading Bizz ID: 2
[12:14:59] [Database] Loading Bizz ID: 3
[12:14:59] [Database] Loading Bizz ID: 4
[12:14:59] [Database] Loading Bizz ID: 5
[12:14:59] [Database] Loading Bizz ID: 6
[12:14:59] [Database] Loading Bizz ID: 7
[12:14:59] [Database] Loading Bizz ID: 8
[12:14:59] [Database] Loading Bizz ID: 9
[12:14:59] [Database] Loading Bizz ID: 10
[12:14:59] [Database] Loading Bizz ID: 11
[12:14:59] [Database] Loading Bizz ID: 12
[12:14:59] 
----------------------------------
[12:14:59]  ~~ Script v.1 ~~
[12:14:59] ----------------------------------

[12:14:59] Number of vehicle models: 0
[12:15:32] Incoming connection: 127.0.0.1:61762
[12:15:32] [join] Benjamin_Wood has joined the server (0:127.0.0.1)
[12:16:13] [part] Benjamin_Wood has left the server (0:1)
Код:
[Fri Jan 07 12:14:59 2011] -------------------------
[Fri Jan 07 12:14:59 2011]      Logging Started
[Fri Jan 07 12:14:59 2011] -------------------------
[Fri Jan 07 12:14:59 2011] Function: mysql_init executed with result: "0".
[Fri Jan 07 12:14:59 2011] Connected (0) to pete @ localhost via TCP/IP.
[Fri Jan 07 12:14:59 2011] MySQL Version 5.1.41.
[Fri Jan 07 12:14:59 2011] Function: mysql_query executed: "SELECT * FROM business WHERE id= 0" with result: "0".
[Fri Jan 07 12:14:59 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:14:59 2011] Function: mysql_num_rows executed with result: "".
[Fri Jan 07 12:14:59 2011] Function: mysql_fetch_row executed with result: "AutoBahn|0|None|1948.12|2068.85|11.061|-2027.21|-104.342|1035.17|3|200000|4|0|1|1274|0|100|100".
[Fri Jan 07 12:14:59 2011] Function: mysql_query executed: "SELECT * FROM business WHERE id= 1" with result: "0".
[Fri Jan 07 12:14:59 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:14:59 2011] Function: mysql_num_rows executed with result: "".
[Fri Jan 07 12:14:59 2011] Function: mysql_fetch_row executed with result: "Postrio Bar|0|None|2015.15|1106.59|10.8203|-794.936|490.632|1376.2|1|120000|4|0|0|1314|1|100|100".
[Fri Jan 07 12:14:59 2011] Function: mysql_query executed: "SELECT * FROM business WHERE id= 2" with result: "0".
[Fri Jan 07 12:14:59 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:14:59 2011] Function: mysql_num_rows executed with result: "".
[Fri Jan 07 12:14:59 2011] Function: mysql_fetch_row executed with result: "Craw Bar|0|None|2441.27|2064.66|10.8203|501.981|-69.1502|998.758|11|120000|4|0|0|1314|2|100|100".
[Fri Jan 07 12:14:59 2011] Function: mysql_query executed: "SELECT * FROM business WHERE id= 3" with result: "0".
[Fri Jan 07 12:14:59 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:14:59 2011] Function: mysql_num_rows executed with result: "".
[Fri Jan 07 12:14:59 2011] Function: mysql_fetch_row executed with result: "lol test biz|1|Benjamin_Wood|845.928|-576.703|31.2006|845.928|-576.703|31.2006|10|200000|4|1|0|1274|3|100|100".
[Fri Jan 07 12:14:59 2011] Function: mysql_query executed: "SELECT * FROM business WHERE id= 4" with result: "0".
[Fri Jan 07 12:14:59 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:14:59 2011] Function: mysql_num_rows executed with result: "".
[Fri Jan 07 12:14:59 2011] Function: mysql_fetch_row executed with result: "Caligulas Casino|0|None|2196.37|1677.1|12.3672|2233.8|1712.23|1011.76|1|200000|4|500|0|1274|4|100|100".
[Fri Jan 07 12:14:59 2011] Function: mysql_query executed: "SELECT * FROM business WHERE id= 5" with result: "0".
[Fri Jan 07 12:14:59 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:14:59 2011] Function: mysql_num_rows executed with result: "".
[Fri Jan 07 12:14:59 2011] Function: mysql_fetch_row executed with result: "Binco Shop|0|None|1656.63|1733.29|10.8281|207.738|-109.02|1005.13|15|200000|4|0|0|1275|5|100|100".
[Fri Jan 07 12:14:59 2011] Function: mysql_query executed: "SELECT * FROM business WHERE id= 6" with result: "0".
[Fri Jan 07 12:14:59 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:14:59 2011] Function: mysql_num_rows executed with result: "".
[Fri Jan 07 12:14:59 2011] Function: mysql_fetch_row executed with result: "Ammu Nation 1|0|None|2539.12|2083.96|10.8203|286.801|-82.5476|1001.52|4|200000|4|0|0|1254|6|100|100".
[Fri Jan 07 12:14:59 2011] Function: mysql_query executed: "SELECT * FROM business WHERE id= 7" with result: "0".
[Fri Jan 07 12:14:59 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:14:59 2011] Function: mysql_num_rows executed with result: "".
[Fri Jan 07 12:14:59 2011] Function: mysql_fetch_row executed with result: "Vice Bar|0|None|2490.03|2065.01|10.8203|501.981|-69.1502|998.758|11|120000|4|0|0|1275|7|100|100".
[Fri Jan 07 12:14:59 2011] Function: mysql_query executed: "SELECT * FROM business WHERE id= 8" with result: "0".
[Fri Jan 07 12:14:59 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:14:59 2011] Function: mysql_num_rows executed with result: "".
[Fri Jan 07 12:14:59 2011] Function: mysql_fetch_row executed with result: "24/7 Markt 4|0|None|2546.55|1971.97|10.8203|-25.1326|-139.067|1003.55|16|150000|4|0|0|1239|8|100|100".
[Fri Jan 07 12:14:59 2011] Function: mysql_query executed: "SELECT * FROM business WHERE id= 9" with result: "0".
[Fri Jan 07 12:14:59 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:14:59 2011] Function: mysql_num_rows executed with result: "".
[Fri Jan 07 12:14:59 2011] Function: mysql_fetch_row executed with result: "24/7 Markt 3|0|None|2194.39|1990.78|12.2969|-30.9467|-89.6096|1003.55|18|150000|4|0|0|1239|9|100|100".
[Fri Jan 07 12:14:59 2011] Function: mysql_query executed: "SELECT * FROM business WHERE id= 10" with result: "0".
[Fri Jan 07 12:14:59 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:14:59 2011] Function: mysql_num_rows executed with result: "".
[Fri Jan 07 12:14:59 2011] Function: mysql_fetch_row executed with result: "24/7 Markt 2|0|None|2247.93|2397.09|10.8203|6.09118|-29.2719|1003.55|10|150000|4|0|0|1239|10|100|100".
[Fri Jan 07 12:14:59 2011] Function: mysql_query executed: "SELECT * FROM business WHERE id= 11" with result: "0".
[Fri Jan 07 12:14:59 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:14:59 2011] Function: mysql_num_rows executed with result: "".
[Fri Jan 07 12:14:59 2011] Function: mysql_fetch_row executed with result: "24/7 Markt 1|0|None|2097.78|2224.12|11.0234|-25.8845|-185.869|1003.55|17|150000|4|0|0|1239|11|100|100".
[Fri Jan 07 12:14:59 2011] Function: mysql_query executed: "SELECT * FROM business WHERE id= 12" with result: "0".
[Fri Jan 07 12:14:59 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:14:59 2011] Function: mysql_num_rows executed with result: "".
[Fri Jan 07 12:14:59 2011] Function: mysql_fetch_row executed with result: "Ammu Nation 2|0|None|2158.64|943.324|10.8203|296.92|-108.072|1001.52|6|200000|4|0|0|1254|12|100|100".
[Fri Jan 07 12:15:32 2011] Function: mysql_real_esacpe_string executed: "Benjamin_Wood" with result: "Benjamin_Wood".
[Fri Jan 07 12:15:32 2011] Function: mysql_query executed: "SELECT `id` FROM `users` WHERE `Username` = 'Benjamin_Wood'" with result: "0".
[Fri Jan 07 12:15:32 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:15:32 2011] Function: mysql_num_rows executed with result: "".
[Fri Jan 07 12:15:32 2011] Function: mysql_num_rows executed with result: "".
[Fri Jan 07 12:15:32 2011] Function: mysql_fetch_int executed with result: "0".
[Fri Jan 07 12:15:32 2011] Function: mysql_free_result executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_query executed: "SELECT `Password` FROM `users` WHERE `id` = '0'" with result: "0".
[Fri Jan 07 12:15:39 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_row executed with result: "totos666".
[Fri Jan 07 12:15:39 2011] Function: mysql_free_result executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_query executed: "SELECT * FROM `users` WHERE `id` = '0'" with result: "0".
[Fri Jan 07 12:15:39 2011] Function: mysql_store_result executed with result: "1"
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_fetch_field executed.
[Fri Jan 07 12:15:39 2011] Function: mysql_free_result executed.
[Fri Jan 07 12:16:13 2011] Function: mysql_query executed: "UPDATE `users` SET `PosX` = '847.907775', `PosY` = '-578.964355', `PosZ` = '31.396875', `Int` = '0' WHERE `id` = '0'" with result: "0".
pawn Код:
enum bInfo
{
    bBizz[32],
    bOwned,
    bOwner[24],
    Float:bPickupX,
    Float:bPickupY,
    Float:bPickupZ,
    Float:bBizX,
    Float:bBizY,
    Float:bBizZ,
    bInterior,
    bSell,
    bLevel,
    bFee,
    bOpen,
    bProducts,
    bMaxProducts,
    bPickup,
    bID,
};
new BizzInfo[MAX_BUSINESS][bInfo];
pawn Код:
stock LoadBizz()
{
    new Query[255];
    for(new id; id < MAX_BUSINESS; id++)
    {
        format(Query, sizeof(Query), "SELECT * FROM business WHERE id= %d", id);
        mysql_query(Query);
        mysql_store_result();
        if(mysql_num_rows())
        if(mysql_fetch_row(Query,"|"))
        {
            sscanf(Query, "p<|>e<s[32]ds[24]ffffffddddddddd>", BizzInfo[id]);
            printf("[Database] Loading Bizz ID: %d", id);
            new string[128];
                if(BizzInfo[id][bOwned] == 0)
                {
                    new location[MAX_ZONE_NAME];
                    CreatePickup(1240, 1, BizzInfo[id][bPickupX], BizzInfo[id][bPickupY], BizzInfo[id][bPickupZ], -1);
                    Get2DZone(location, MAX_ZONE_NAME, BizzInfo[id][bBizX],BizzInfo[id][bBizY],BizzInfo[id][bBizZ]);
                    format(string, sizeof(string), "[Business for sale]\nAddress: %d %s\nPrice: $%d",id,location,BizzInfo[id][bSell]);
                    businesstext[id] = Create3DTextLabel(string,LIGHTBLUE,BizzInfo[id][bBizX],BizzInfo[id][bBizY],BizzInfo[id][bBizZ],100.0,-1, 1);
                }
                else if(BizzInfo[id][bOwned] == 1 && BizzInfo[id][bOpen] == 1)
                {
                    new location[MAX_ZONE_NAME];
                    CreatePickup(1240, 1, BizzInfo[id][bPickupX], BizzInfo[id][bPickupY], BizzInfo[id][bPickupZ], -1);
                    Get2DZone(location, MAX_ZONE_NAME, BizzInfo[id][bBizX],BizzInfo[id][bBizY],BizzInfo[id][bBizZ]);
                    format(string, sizeof(string), "[Business]\nAdress: %d %s\nRent Price - $%d", id,location,BizzInfo[id][bFee]);
                    businesstext[id] = Create3DTextLabel(string,LIGHTBLUE,BizzInfo[id][bBizX],BizzInfo[id][bBizY],BizzInfo[id][bBizZ],100.0,-1, 1);
                }
        }
    }
}
The bizz'es are not appearing. Something is wrong but I can't locate it.

Thanks in advance.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)