Saving Attatched objects.
#1

Im trying to find a some way to save attatched obejcts.
I use SQL for everything else in my GM, but saving the attatched objects will require so much from it.

Here is my variables:
pawn Код:
enum _spao
{
    PlayerName[24],
    model[10],
    bone[10],
    Float:fX[10],
    Float:fY[10],
    Float:fZ[10],
    Float:rX[10],
    Float:rY[10],
    Float:rZ[10],
    Float:sX[10],
    Float:sY[10],
    Float:sZ[10]
}

new PlayerAttatchedObjects[MAX_PLAYERS][_spao];
As far as im known with mysql, i have to make fields: playername, model*10, bone*10, fX*10 etc...
Thats 111 fields per player to store it! Not to mention to length of the queries..

Is there an easier way to make this?
Reply
#2

Make 1 row for each object, so that there are many rows of objects that have same player.
Reply
#3

I was thinking like this, but when its going to save, how to make sure it saves to correct row? Since there will be 10 of them.
pawn Код:
"UPDATE `PlayerAttatchedObjects` SET `model` = %d, `bone` = %d .. WHERE `PlayerName` = '%s'"
Reply
#4

Make a field for object ID (0-9) and use it with player name

pawn Код:
"UPDATE .. WHERE `PlayerName` = '%s' AND id=%d"
Reply
#5

'AND' ! Thanks MadeMan
Reply
#6

Quote:
Originally Posted by Richie©
Посмотреть сообщение
'AND' ! Thanks MadeMan
No problem.

Also, I think the enum would be better like this

pawn Код:
enum _spao
{
    model,
    bone,
    Float:fX,
    Float:fY,
    Float:fZ,
    Float:rX,
    Float:rY,
    Float:rZ,
    Float:sX,
    Float:sY,
    Float:sZ
}

new PlayerAttatchedObjects[MAX_PLAYERS][10][_spao];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)