dynamic map icon
#1

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);
}
Reply
#2

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.
Reply
#3

actually the first one i have in my mysql is `ID` then `Icon` then so on
Reply
#4

bump please?
Reply
#5

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)
Reply
#6

thanks man, i fixed my problem from doing that. I should do that very often when i get problem with mysql
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)