public MySQLLoadItems() { new str[128],itemid; mysql_query("SELECT * FROM `items`"); mysql_store_result(); while(mysql_fetch_row(str, "|")) { sscanf(str, "p<|>ddddfff",itemid, Products[itemid][iName], Products[itemid][iObject], Products[itemid][iIlosc], Products[itemid][Pos_x], Products[itemid][Pos_y], Products[itemid][Pos_z]); Create3DTextLabel(ItemName[Products[itemid][iName]], -1, Products[itemid][Pos_x], Products[itemid][Pos_y], Products[itemid][Pos_z], 10.0, 0); } return 1; } |
enum dInfo { Float:rot_x, Float:rot_y, Float:rot_z, Float:rot_d, Float:Pos_x, Float:Pos_y, Float:Pos_z, Float:Pos_d, iName, iObject, iIlosc, UID }; #define MAX_PRODUCTS 10 // new Products[MAX_PRODUCTS][dInfo]; |
new ItemName[][48] = { {" "}, // 0 - Występuje błąd {"apple"}, // 1 {"notebook"} // 2 }; |
CREATE TABLE `items` ( `Id` int(11) NOT NULL auto_increment, `Type` int(11) NOT NULL, `object` int(11) NOT NULL, `Ilosc` int(11) NOT NULL, `PosX` int(11) NOT NULL, `PosY` int(11) NOT NULL, `PosZ` int(11) NOT NULL, `UID` int(11) NOT NULL, PRIMARY KEY (`Id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=43 ; -- -- Zrzut danych tabeli `items` -- INSERT INTO `items` VALUES (42, 42, 42, 0, 1749, -1855, 13, 0); |
sscanf(str, "p<|>ddddfff",uid, nameid, objectid,o,x,y,z); } Products[uid][Pos_x] = x; Products[uid][Pos_y] = y; Products[uid][Pos_z] = z; Create3DTextLabel(ItemName[nameid], -1, Products[uid][Pos_x],Products[uid][Pos_y],Products[uid][Pos_z], 10.0, 0);