+REP - Save SetPlayerAttachedObjects via MySQL -
PawnoQ - 09.02.2012
Hi,
i need some ideas on how i would save objects (in this case i use it for a clothing system) using mysql effectively.
I would need to save the objectID the Bone and the Index value right?
I hope you can help me with ideas as i dont know where to start here (as a player can have up to 10 different objects/clothes attached)
here is the native(without optional parameters):
pawn Код:
SetPlayerAttachedObject(playerid, index, modelid, bone)
thx.
Re: +REP - Save SetPlayerAttachedObjects via MySQL -
PawnoQ - 10.02.2012
help would really be appreciated...
Re: +REP - Save SetPlayerAttachedObjects via MySQL -
PawnoQ - 10.02.2012
no one knows?

Should i make a new table for the clothes/objects in my databse or use my user account table?
The problem is i really dont have a clue how to start here, please i need your smart brains
Re: +REP - Save SetPlayerAttachedObjects via MySQL -
Tanush123 - 10.02.2012
pawn Код:
"UPDATE user SET Maxattach = %d",Attached...
you mean that?
Re: +REP - Save SetPlayerAttachedObjects via MySQL -
PawnoQ - 10.02.2012
yeah, kind of...
I know how to use mysql itself but i dont know how to save the attached objects as there are up to 10 object/index slots usable.
That means that a single player can have up to 10 objects/clothes attached and i dont know how i would save and load that...
Also the objectID had to be saved.
I hope someone can help
Re: +REP - Save SetPlayerAttachedObjects via MySQL -
[LoF]Zak - 10.02.2012
I think you should make a new table altogether, called Clothes or something alike, with:
- Username (The player's name who has the clothes registered to)
- Object ID (The actual clothe ID)
- Everything else which needs saving/using with the SetPlayerAttachedObject.
Then simply when logging in, it gets all clothe data and do whatever you want with it?
You didn't really ask for anything specific, just on how/where to save the info/clothes.
Re: +REP - Save SetPlayerAttachedObjects via MySQL -
PawnoQ - 10.02.2012
thanks

But how would i loop through the indexes/slots of the objects?
If a player logs in and he has 3 clothes e.g. then 3 slots would be used.
I would need an example how to attach the objects to the player after the data has been loaded from the database.
Also an example of the loading process itself would be appreciated.
Re: +REP - Save SetPlayerAttachedObjects via MySQL -
[LoF]Zak - 10.02.2012
pawn Код:
mysql_query("SELECT * FROM `clothes` WHERE Username='%s'", PlayerName);
mysql_store_result();
vTotal = mysql_num_rows();
new totalclothes = 0;
new c_Username[24], ModelID, BoneID, IndexID, etcID;
if(vTotal > 0)
{
while(mysql_fetch_row(Str))
{
totalclothes++;
sscanf(Str, "p<|>sdddd", c_Username, ModelID, BoneID, IndexID, etcID);
//Now use this information, and attach/create the objects and put them onto the player (This will look for how many results it got from the query).
//I highly doubt this will work. You will need to edit the int's, fields, etc first!!
}
}
mysql_free_result(); //Don't forget this.
Hope I helped.