SA-MP Forums Archive
[HELP] Loading business from database - 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: [HELP] Loading business from database (/showthread.php?tid=225768)



[HELP] Loading business from database - kariok - 14.02.2011

I have a function that is enabled when the server starts but the business are not loading...

Код:
stock AddBizFromFile()
{
	new
		Str[67],
		dID,
		Float:bX,
		Float:bY,
		Float:bZ,
		vTotal;

    mysql_query("SELECT * FROM `Business`");
    mysql_store_result();
    if(mysql_num_rows() > 0)
    {
        while(mysql_fetch_row(Str))
        {
            sscanf(Str, "p<|>iffff", dID, bX, bY, bZ);
            AddStaticPickup(1272,2, bX, bY, bZ, 0);
			vTotal++;
		}
    }
    mysql_free_result();
    printf("** %i\t<->\tBiz Loaded From\t<->\tMySQL\t\t   **", vTotal);
	return 1;
}
I have this on my MySql log:

Quote:

[00:31:48] CMySQLHandler::Query(SELECT * FROM `Business`) - Successfully executed.

[00:31:48] >> mysql_store_result( Connection handle: 1 )

[00:31:48] CMySQLHandler::StoreResult() - Result was stored.

[00:31:48] >> mysql_num_rows( Connection handle: 1 )

[00:31:48] CMySQLHandler::NumRows() - Returned 2 rows(s)

[00:31:48] >> mysql_fetch_row_format( Connection handle: 1 )

[00:31:48] CMySQLHandler::FetchRow() - Return: 1|215.866|14.568|2.5708|Lucca_Xavier|Oficina Mecanica do Tabareu|5000|250000

[00:31:48] >> mysql_fetch_row_format( Connection handle: 1 )

[00:31:48] CMySQLHandler::FetchRow() - Return: 2|73.6155|-219.452|1.5825|Governo|Policia Militar|10000|1000000

[00:31:48] >> mysql_fetch_row_format( Connection handle: 1 )

[00:31:48] >> mysql_free_result( Connection handle: 1 )

[00:31:48] CMySQLHandler::FreeResult() - Result was successfully free'd.

[00:32:11] >> mysql_real_escape_string( Connection handle: 1 )

Can anyone help me? The icons just don't appear...


Re: [HELP] Loading business from database - kariok - 14.02.2011

Fixed, allways be carefull with sscanf

sscanf(Str, "p<|>iffff", dID, bX, bY, bZ);

I had one more f