MySQL R39 + sscanf
#1

I just wondered if this is possible;

Such as:

MySQL VarChar field containing the following:

pawn Код:
CreateDynamicObject(2942, 1759.97668, -1942.20728, 13.18650,   0.00000, 0.00000, 90.00000);
    CreateDynamicObject(2942, 1759.97668, -1935.96118, 13.18650,   0.00000, 0.00000, 90.00000);
    CreateDynamicObject(2942, 1466.32043, -1749.90454, 15.05910,   0.00000, 0.00000, -180.00000);
    CreateDynamicObject(2942, 1155.24084, -1463.88330, 15.39540,   0.00000, 0.00000, -72.00000);
    CreateDynamicObject(2942, 1102.31714, -1448.87878, 15.39540,   0.00000, 0.00000, 90.00000);
    CreateDynamicObject(2942, 2241.50952, -1722.67078, 13.16350,   0.00000, 0.00000, 0.00000);
    CreateDynamicObject(2942, 2260.87646, -1722.67749, 13.16350,   0.00000, 0.00000, 0.00000);
How could I read all of that from the database and set it to actually create the object?

Such as a dynamic mapping system.
Reply
#2

You'll most likely need to save the parameters for the object (model, loc, rot, etc) and then make the server read the data from database and spawn them.
So, the answer is yes.
Reply
#3

So I wouldn't be able to save it as a full code such as above but instead have different columns for the table?

That's a bad way really.
Reply
#4

As far as I know, no.
But maybe someone more experienced can prove me wrong and help you.
Reply
#5

Hi,

Sorry for bad english but I'm French so I'm trying to express myself the better I can ^^

So, you have to make at least 7 fields in your table (1 integer, which will contains the object modelid, and 6 floats which will contain the X, Y and Z positions and X, Y and Z rotations)

After that, you have to make a query which will get the objects informations to create these.
Reply
#6

On the other hand, you can save the whole line and use a splitter such as a comma.
pawn Код:
stock split(const strsrc[], strdest[][], delimiter)
By the whole line i mean
PHP код:
29421466.32043, -1749.9045415.05910,   0.000000.00000, -180.00000 
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)