Problem of reading items
#1

Hello, I have problem my system badly reads items, here is the code

Quote:

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;
}

arrays:
Quote:

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];


AND

Quote:

new ItemName[][48] =
{
{" "}, // 0 - Występuje błąd
{"apple"}, // 1
{"notebook"} // 2
};
database:

Quote:

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);

Please of help .
Reply
#2

Quote:
Originally Posted by loginreks
Посмотреть сообщение
my system badly reads items
What does it mean?
Reply
#3

does not create text 3d in game.
Reply
#4

Type is 42 in database, but you only have 3 defined in 'ItemName'.

Also, id is 42, but you have only 10.
Reply
#5

I advised himself of problem, but is 1, are not it wants to record positions to 3d text !

the code:

Код:
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);
Please of help.
Reply
#6

Please speak english.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)