Gang gates [ loaded with mysql ]. -
FaLLenGirL - 13.01.2017
Hello there friends.
I made my Gang Gates object to load from the database, but the positions are not
the same, because positions are rounded when i insert them in the table `GangGates`.
Well on server, the gates are not in the right position, but a little further than it should be.
So that's my script for gates:
PHP Code:
function LoadGangGates( )
{
new Rows, Fields, X;
cache_get_data( Rows, Fields, DB_Connect );
for( new i = 0; i < Rows; i ++ )
{
X = cache_get_field_content_int( i, "ID", DB_Connect );
GateInfo[ X ][ gateX ] = cache_get_field_content_int( i, "gateX", DB_Connect );
GateInfo[ X ][ gateY ] = cache_get_field_content_int( i, "gateY", DB_Connect );
GateInfo[ X ][ gateZ ] = cache_get_field_content_int( i, "gateZ", DB_Connect );
GateInfo[ X ][ gateAX ] = cache_get_field_content_int( i, "gateAX", DB_Connect );
GateInfo[ X ][ gateAY ] = cache_get_field_content_int( i, "gateAY", DB_Connect );
GateInfo[ X ][ gateAZ ] = cache_get_field_content_int( i, "gateAZ", DB_Connect );
GateInfo[ X ][ gateXog ] = cache_get_field_content_int( i, "gateXog", DB_Connect );
GateInfo[ X ][ gateYog ] = cache_get_field_content_int( i, "gateYog", DB_Connect );
GateInfo[ X ][ gateZog ] = cache_get_field_content_int( i, "gateZog", DB_Connect );
Gate[ X ] = CreateDynamicObject( 971, GateInfo[ X ][ gateX ], GateInfo[ X ][ gateY ], GateInfo[ X ][ gateZ ], GateInfo[ X ][ gateAX ], GateInfo[ X ][ gateAY ], GateInfo[ X ][ gateAZ ] );
}
printf( "Loaded %d Gang Gates.", Rows );
return 1;
}
And here in database are like this:
--------------------------------------------------------------------------------------------------------
[ATTENTION]
- I don't know if this help but, when i inserted by myself the position the zero's were like: 0.0000, or that 90
was not that simple was like: 90.0000 etc, where was a simple number was zero's after him.
- Also, the gateXog, gateYog, gateZog = the position when gate is opened.
- For other details, if you guys need, just reply.
If u can help me with this i'll be very grateful. And to say to me why the positions become rounded.
Re: Gang gates [ loaded with mysql ]. -
Vince - 13.01.2017
cache_get_field_content_
int.
An integer is a whole number without decimal places. Use the float function. Same for insert, use %f not %d.
Re: Gang gates [ loaded with mysql ]. -
FaLLenGirL - 13.01.2017
Quote:
Originally Posted by Vince
cache_get_field_content_int.
An integer is a whole number without decimal places. Use the float function. Same for insert, use %f not %d.
|
Thanks
Vince. Also may i ask you something.
In the database i saw, that if i change from float to double, the numbers are not rounding, remains
the same that i insered, it is ok to use float or double ? ( i used in LoadGangGates:
cache_get_field_content_float ).
Re: Gang gates [ loaded with mysql ]. -
Lordzy - 13.01.2017
Quote:
Originally Posted by FaLLenGirL
Thanks Vince. Also may i ask you something.
In the database i saw, that if i change from float to double, the numbers are not rounding, remains
the same that i insered, it is ok to use float or double ? ( i used in LoadGangGates: cache_get_field_content_float ).
|
"float" datatype is all that you require currently.
float is used for single-precision where as
double for double precision numbers.
float has 32-bit (4 bytes) and
double has 64-bit (8 bytes). If you want more accuracy, you can use
double but it's not required here.
Re: Gang gates [ loaded with mysql ]. -
SyS - 13.01.2017
I really appreciate the way you describe your problems.It's much clearer ,professional and detailed and that's how a question should be asked in a forum.have +3 rep for that(not that it matters but it's the only way i can show the appreciation towards you).Keep it up and it inspired me too.
Re: Gang gates [ loaded with mysql ]. -
FaLLenGirL - 13.01.2017
Lordzy thanks buddy.
Quote:
Originally Posted by Sreyas
I really appreciate the way you describe your problems.It's much clearer ,professional and detailed and that's how a question should be asked in a forum.have +3 rep for that(not that it matters but it's the only way i can show the appreciation towards you).Keep it up and it inspired me too.
|
I appreciate your words. Thanks a lot for all help.