SA-MP Forums Archive
only two cps load =( - 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: only two cps load =( (/showthread.php?tid=229684)



only two cps load =( - THE_KNOWN - 22.02.2011

Код:
LoadOcps()
    {
    mysql_debug(1);
	new query[256],tmp;
    format(query,sizeof(query),"SELECT * FROM `ocps`");
    mysql_query(query);
    mysql_store_result();
    tmp=mysql_num_rows();
	for(new i=0;i<tmp;mysql_retrieve_row(i++))
	{
            new field[13][128];
            if(mysql_num_rows() == 0) continue;
            mysql_fetch_row_format(query, "|");
            explode(query, field, "|");
            new cpid,Float:x,Float:y,Float:z;
            x=strval(field[1]);            y=strval(field[2]);
            z=strval(field[3]);
            cpid=CreateDynamicCP(x,y,z,1.0,-1,-1,-1,100.0);
            corg[cpid]=strval(field[0]);
            printf("%d",corg[cpid]);
    }
    mysql_debug(0);
	mysql_free_result();
	return 1;
}
idk if i increase the rows only the first to load and the 2nd one keeps repeating until all the rows are done =(

Код:
[11:55:08] ---------------------------

[11:55:08] MySQL Debugging activated (02/22/11)

[11:55:08] ---------------------------

[11:55:08]  

[11:55:08] >> mysql_query( Connection handle: 1 )

[11:55:08] CMySQLHandler::Query(SELECT * FROM `ocps`) - Successfully executed.

[11:55:08] >> mysql_store_result( Connection handle: 1 )

[11:55:08] CMySQLHandler::StoreResult() - Result was stored.

[11:55:08] >> mysql_num_rows( Connection handle: 1 )

[11:55:08] CMySQLHandler::NumRows() - Returned 3 row(s)

[11:55:08] >> mysql_num_rows( Connection handle: 1 )

[11:55:08] CMySQLHandler::NumRows() - Returned 3 row(s)

[11:55:08] >> mysql_fetch_row_format( Connection handle: 1 )

[11:55:08] CMySQLHandler::FetchRow() - Return: 3|2445.82788|-2547.99756|17.91065

[11:55:08] >> mysql_retrieve_row( Connection handle: 0 )

[11:55:08] >> mysql_retrieve_row() - Invalid connection handle. (You set: 0, Highest connection handle ID is 1).

[11:55:08] >> mysql_num_rows( Connection handle: 1 )

[11:55:08] CMySQLHandler::NumRows() - Returned 3 row(s)

[11:55:08] >> mysql_fetch_row_format( Connection handle: 1 )

[11:55:08] CMySQLHandler::FetchRow() - Return: 4|1548.00293|-1681.15503|13.55938

[11:55:08] >> mysql_retrieve_row( Connection handle: 1 )

[11:55:08] >> mysql_num_rows( Connection handle: 1 )

[11:55:08] CMySQLHandler::NumRows() - Returned 3 row(s)

[11:55:08] >> mysql_fetch_row_format( Connection handle: 1 )

[11:55:08] >> mysql_retrieve_row( Connection handle: 2 )

[11:55:08] >> mysql_retrieve_row() - Invalid connection handle. (You set: 2, Highest connection handle ID is 1).

[11:55:08] ---------------------------

[11:55:08] MySQL Debugging de-activated

[11:55:08] ---------------------------



Re: only two cps load =( - Cameltoe - 22.02.2011

mysql_retrieve_row(i++) should be mysql_retrieve_row() i guess.


Re: only two cps load =( - THE_KNOWN - 22.02.2011

in that case the second one shouldnt be loading too. btw i use the same code to load the dealer which works fine