SA-MP Forums Archive
Problem of reading items - 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: Problem of reading items (/showthread.php?tid=271435)



Problem of reading items - loginreks - 24.07.2011

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 .


Re: Problem of reading items - MadeMan - 24.07.2011

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


Re: Problem of reading items - loginreks - 24.07.2011

does not create text 3d in game.


Re: Problem of reading items - MadeMan - 24.07.2011

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

Also, id is 42, but you have only 10.


Re: Problem of reading items - loginreks - 24.07.2011

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.


Re: Problem of reading items - MadeMan - 24.07.2011

Please speak english.