dynamic map icon - 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)
+--- Thread: dynamic map icon (
/showthread.php?tid=308228)
dynamic map icon -
Tanush123 - 02.01.2012
What could be the problem of this? when i restart server it doesnt load the icon
pawn Код:
stock LoadIcon()
{
new iconcount;
for(new i=1; i<MAX_ICON; i++)
{
format(str,sizeof(str),"SELECT * FROM Mapicon WHERE `ID` = %d LIMIT 1",i);
mysql_query(str);
mysql_store_result();
if(mysql_num_rows() != 0)
{
iconcount ++;
mysql_fetch_row_format(drow, "|");
explode(drow, field, "|");
MapInfo[i][mapicon] = strval(field[1]);
MapInfo[i][mapX] = strval(field[2]);
MapInfo[i][mapY] = strval(field[3]);
MapInfo[i][mapZ] = strval(field[4]);
MapInfo[i][iconspawn] = CreateDynamicMapIcon(MapInfo[i][mapX],MapInfo[i][mapY],MapInfo[i][mapZ],MapInfo[i][mapicon],0,-1,-1,-1,100.0);
mysql_free_result();
}
}
return printf("%d icons loaded",iconcount);
}
Re: dynamic map icon -
coole210 - 03.01.2012
Maybe you're loading the wrong fields
It starts with field[0] I believe
pawn Код:
MapInfo[i][mapicon] = strval(field[0]);
MapInfo[i][mapX] = strval(field[1]);
MapInfo[i][mapY] = strval(field[2]);
MapInfo[i][mapZ] = strval(field[3]);
Don't blame me If I'm wrong, I haven't seen your db.
Re: dynamic map icon -
Tanush123 - 03.01.2012
actually the first one i have in my mysql is `ID` then `Icon` then so on
Re: dynamic map icon -
Tanush123 - 03.01.2012
bump please?
Re: dynamic map icon -
iggy1 - 03.01.2012
If your using BlueG's plugin try using "mysql_debug(1);" before calling that function, and see if the values are returned correct. It would also be a good idea to print the values of your variables after you call explode and assign them. (sscanf would be a better choice)
Re: dynamic map icon -
Tanush123 - 03.01.2012
thanks man, i fixed my problem from doing that. I should do that very often when i get problem with mysql