SA-MP Forums Archive
So Many Problems - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: So Many Problems (/showthread.php?tid=277472)



So Many Problems - Storm203 - 18.08.2011

So, whenever I include this function in my script, the script ceases to work. Comment it out, and everything is okay. Whats happening?!?!?! D:

Код:
stock LoadHouses(houseid)
{
	mysql_query("SELECT * FROM houses");
	mysql_store_result();

	new row[128];
	new field[17][32];

	mysql_fetch_row_format(row, "|");
	explode(row, field, "|");
	mysql_free_result();
	
	HInfo[houseid][pID] = strval(field[0]);
	HInfo[houseid][pX] = strval(field[1]);
	HInfo[houseid][pY] = strval(field[2]);
	HInfo[houseid][pZ] = strval(field[3]);
	HInfo[houseid][pIntX] = strval(field[4]);
	HInfo[houseid][pIntY] = strval(field[5]);
	HInfo[houseid][pIntZ] = strval(field[6]);
	HInfo[houseid][pInt] = strval(field[7]);
	HInfo[houseid][pPickup] = strval(field[8]);
	HInfo[houseid][pIcon] = strval(field[9]);
	HInfo[houseid][pWorld] = strval(field[10]);
	HInfo[houseid][pOwner] = strval(field[11]);
	HInfo[houseid][pOwned] = strval(field[12]);
	HInfo[houseid][pSlots] = strval(field[13]);
	HInfo[houseid][pZone] = strval(field[14]);
	HInfo[houseid][pPrice] = strval(field[15]);
	HInfo[houseid][pPark] = strval(field[16]);
	
}



Re: So Many Problems - Backwardsman97 - 18.08.2011

Maybe you don't have mysql installed.


Re: So Many Problems - Storm203 - 18.08.2011

Its installed and running just fine. These are all hand written scripts, not some copy-paste job, so Im assuming I made a mistake when I was coding and left something out.


Re: So Many Problems - Storm203 - 18.08.2011

Anyone?


Re: So Many Problems - [HiC]TheKiller - 18.08.2011

Use mysql_debug(1); on OnGamemodeInit. Also, why do you have houseid if you are just retrieving the first row of the table. Add a ID to the table and use it in the query so you can select specific houses. Or do this

pawn Код:
stock LoadHouses()
{
    mysql_query("SELECT * FROM houses");
    mysql_store_result();

    new row[128];
    new field[17][32], Hid;

        while(mysql_fetch_row_format(row, "|"))
        {
             explode(row, field, "|");
             HInfo[Hid][pID] = strval(field[0]);
             HInfo[Hid][pX] = strval(field[1]);
             HInfo[Hid][pY] = strval(field[2]);
             HInfo[Hid][pZ] = strval(field[3]);
             HInfo[Hid][pIntX] = strval(field[4]);
             HInfo[Hid][pIntY] = strval(field[5]);
             HInfo[Hid][pIntZ] = strval(field[6]);
             HInfo[Hid][pInt] = strval(field[7]);
             HInfo[Hid][pPickup] = strval(field[8]);
             HInfo[Hid][pIcon] = strval(field[9]);
             HInfo[Hid][pWorld] = strval(field[10]);
             HInfo[Hid][pOwner] = strval(field[11]);
             HInfo[Hid][pOwned] = strval(field[12]);
             HInfo[Hid][pSlots] = strval(field[13]);
             HInfo[Hid][pZone] = strval(field[14]);
             HInfo[Hid][pPrice] = strval(field[15]);
             HInfo[Hid][pPark] = strval(field[16]);
        }
    mysql_free_result();
    return 1;
}