25.02.2014, 16:17
Hey guys, this is my first post here, and i have a problem with my house system.
I made it by myself, and when I try to load the houses, in OnGameModeInit, my console stop. I tried to figure out what my problem is by marking each step with a print in console, and found out that it stop right after mysql_query(query).
Here is my code, and the server_log, in diffrent forms (I tried many structures, and all of them stopped at the same point):
#1
And the server log:
----------
Loaded log file: "server_log.txt".
----------
SA-MP Dedicated Server
----------------------
v0.3z, ©2005-2014 SA-MP Team
[19:14:27]
[19:14:27] Server Plugins
[19:14:27] --------------
[19:14:27] Loading plugin: mysql
[19:14:27] SA:MP MySQL Plugin v2.1.1 Loaded.
[19:14:27] Loaded.
[19:14:27] Loading plugin: sscanf
[19:14:27] [MySQL] Thread running. Threadsafe: Yes.
[19:14:27]
[19:14:27] ===============================
[19:14:27] sscanf plugin loaded.
[19:14:27] Version: 2.8.1
[19:14:27] © 2012 Alex "******" Cole
[19:14:27] ===============================
[19:14:27] Loaded.
[19:14:27] Loading plugin: streamer
[19:14:27]
*** Streamer Plugin v2.6.1 by Incognito loaded ***
[19:14:27] Loaded.
[19:14:27] Loaded 3 plugins.
[19:14:27]
[19:14:27] Ban list
[19:14:27] --------
[19:14:27] Loaded: samp.ban
[19:14:27]
[19:14:27]
[19:14:27] Filterscripts
[19:14:27] ---------------
[19:14:27] Loading filterscript 'gl_realtime.amx'...
[19:14:27] Loaded 1 filterscripts.
[19:14:27] Houses not loaded yet.
[19:14:27] 0
[19:14:27] 0.1
[19:14:27] 0.2
[19:14:27] 0.3
#2
And the server log:
----------
Loaded log file: "server_log.txt".
----------
SA-MP Dedicated Server
----------------------
v0.3z, ©2005-2014 SA-MP Team
[19:16:03]
[19:16:03] Server Plugins
[19:16:03] --------------
[19:16:03] Loading plugin: mysql
[19:16:03] SA:MP MySQL Plugin v2.1.1 Loaded.
[19:16:03] Loaded.
[19:16:03] Loading plugin: sscanf
[19:16:03] [MySQL] Thread running. Threadsafe: Yes.
[19:16:03]
[19:16:03] ===============================
[19:16:03] sscanf plugin loaded.
[19:16:03] Version: 2.8.1
[19:16:03] © 2012 Alex "******" Cole
[19:16:03] ===============================
[19:16:03] Loaded.
[19:16:03] Loading plugin: streamer
[19:16:03]
*** Streamer Plugin v2.6.1 by Incognito loaded ***
[19:16:03] Loaded.
[19:16:03] Loaded 3 plugins.
[19:16:03]
[19:16:03] Ban list
[19:16:03] --------
[19:16:03] Loaded: samp.ban
[19:16:03]
[19:16:03]
[19:16:03] Filterscripts
[19:16:03] ---------------
[19:16:03] Loading filterscript 'gl_realtime.amx'...
[19:16:03] Loaded 1 filterscripts.
[19:16:03] Houses not loaded yet.
[19:16:03] 0
[19:16:03] 1
And, OnGameModeInit:
Please help me, I'm stuck on this for over 1 week. This is the latest phase I could reach. I don't know what is wrong there.
I made it by myself, and when I try to load the houses, in OnGameModeInit, my console stop. I tried to figure out what my problem is by marking each step with a print in console, and found out that it stop right after mysql_query(query).
Here is my code, and the server_log, in diffrent forms (I tried many structures, and all of them stopped at the same point):
#1
Код:
stock MySQL_LoadHouse() { print("0"); new query24[500],savingstring[400]; print("0.1"); for(new hid=1;hid<=MAX_HOUSES;hid++) { print("0.2"); format(query24,sizeof(query24),"SELECT id, owner, level, text, renters, rentprice, rentable, price, upgrade, locked, enterX, enterY, enterZ, exitX, exitY, exitZ, interior, virtual FROM `houses` WHERE id = %d LIMIT 2",hid); print("0.3"); mysql_query(query24); print("1"); mysql_store_result(); print("2"); while(mysql_fetch_row(query24,"|")) { print("3"); mysql_fetch_field("id",savingstring); HouseInfo[hid][hId]=strval(savingstring); print("4"); mysql_fetch_field("owner",savingstring); strins(HouseInfo[hid][hOwner],savingstring,1); print("5"); mysql_fetch_field("level",savingstring); HouseInfo[hid][hLevel]=strval(savingstring); print("6"); mysql_fetch_field("text",savingstring); strins(HouseInfo[hid][hText],savingstring,1); print("7"); mysql_fetch_field("renters",savingstring); HouseInfo[hid][hRenters]=strval(savingstring); print("8"); mysql_fetch_field("rentprice",savingstring); HouseInfo[hid][hRentprice]=strval(savingstring); print("9"); mysql_fetch_field("rentable",savingstring); HouseInfo[hid][hRentable]=strval(savingstring); print("10"); mysql_fetch_field("price",savingstring); HouseInfo[hid][hPrice]=strval(savingstring); print("11"); mysql_fetch_field("upgrade",savingstring); HouseInfo[hid][hUpgrade]=strval(savingstring); print("12"); mysql_fetch_field("locked",savingstring); HouseInfo[hid][hLocked]=strval(savingstring); print("13"); mysql_fetch_field("enterX",savingstring); HouseInfo[hid][hEnterX]=strval(savingstring); print("14"); mysql_fetch_field("enterY",savingstring); HouseInfo[hid][hEnterY]=strval(savingstring); print("15"); mysql_fetch_field("enterZ",savingstring); HouseInfo[hid][hEnterZ]=strval(savingstring); print("16"); mysql_fetch_field("exitX",savingstring); HouseInfo[hid][hExitX]=strval(savingstring); print("17"); mysql_fetch_field("exitY",savingstring); HouseInfo[hid][hExitY]=strval(savingstring); print("18"); mysql_fetch_field("exitZ",savingstring); HouseInfo[hid][hExitZ]=strval(savingstring); print("19"); mysql_fetch_field("interior",savingstring); HouseInfo[hid][hInterior]=strval(savingstring); print("20"); mysql_fetch_field("virtual",savingstring); HouseInfo[hid][hVirtual]=strval(savingstring); print("21"); } print("22"); mysql_free_result(); print("23"); Create3DTextLabel(HouseInfo[hid][hText],COL_WHITE,HouseInfo[hid][hEnterX],HouseInfo[hid][hEnterY],HouseInfo[hid][hEnterZ],30.0,0,1); print("24"); } }
----------
Loaded log file: "server_log.txt".
----------
SA-MP Dedicated Server
----------------------
v0.3z, ©2005-2014 SA-MP Team
[19:14:27]
[19:14:27] Server Plugins
[19:14:27] --------------
[19:14:27] Loading plugin: mysql
[19:14:27] SA:MP MySQL Plugin v2.1.1 Loaded.
[19:14:27] Loaded.
[19:14:27] Loading plugin: sscanf
[19:14:27] [MySQL] Thread running. Threadsafe: Yes.
[19:14:27]
[19:14:27] ===============================
[19:14:27] sscanf plugin loaded.
[19:14:27] Version: 2.8.1
[19:14:27] © 2012 Alex "******" Cole
[19:14:27] ===============================
[19:14:27] Loaded.
[19:14:27] Loading plugin: streamer
[19:14:27]
*** Streamer Plugin v2.6.1 by Incognito loaded ***
[19:14:27] Loaded.
[19:14:27] Loaded 3 plugins.
[19:14:27]
[19:14:27] Ban list
[19:14:27] --------
[19:14:27] Loaded: samp.ban
[19:14:27]
[19:14:27]
[19:14:27] Filterscripts
[19:14:27] ---------------
[19:14:27] Loading filterscript 'gl_realtime.amx'...
[19:14:27] Loaded 1 filterscripts.
[19:14:27] Houses not loaded yet.
[19:14:27] 0
[19:14:27] 0.1
[19:14:27] 0.2
[19:14:27] 0.3
#2
Код:
stock MySQL_LoadHouse() { new query[400]; for(new hid=1; hid <= MAX_HOUSES; hid++) { print("0"); format(query, sizeof(query), "SELECT * FROM `houses` WHERE `id` = %d", hid); print("1"); mysql_query(query); print("2"); } }
----------
Loaded log file: "server_log.txt".
----------
SA-MP Dedicated Server
----------------------
v0.3z, ©2005-2014 SA-MP Team
[19:16:03]
[19:16:03] Server Plugins
[19:16:03] --------------
[19:16:03] Loading plugin: mysql
[19:16:03] SA:MP MySQL Plugin v2.1.1 Loaded.
[19:16:03] Loaded.
[19:16:03] Loading plugin: sscanf
[19:16:03] [MySQL] Thread running. Threadsafe: Yes.
[19:16:03]
[19:16:03] ===============================
[19:16:03] sscanf plugin loaded.
[19:16:03] Version: 2.8.1
[19:16:03] © 2012 Alex "******" Cole
[19:16:03] ===============================
[19:16:03] Loaded.
[19:16:03] Loading plugin: streamer
[19:16:03]
*** Streamer Plugin v2.6.1 by Incognito loaded ***
[19:16:03] Loaded.
[19:16:03] Loaded 3 plugins.
[19:16:03]
[19:16:03] Ban list
[19:16:03] --------
[19:16:03] Loaded: samp.ban
[19:16:03]
[19:16:03]
[19:16:03] Filterscripts
[19:16:03] ---------------
[19:16:03] Loading filterscript 'gl_realtime.amx'...
[19:16:03] Loaded 1 filterscripts.
[19:16:03] Houses not loaded yet.
[19:16:03] 0
[19:16:03] 1
And, OnGameModeInit:
Код:
print("Houses not loaded yet."); MySQL_LoadHouse(); print("Houses loaded");