Quote:
Originally Posted by JaTochNietDan
Why do you use SetVehiclePos, SetVehicleZAngle and ChangeVehicleColor anyway? Why don't you just wait until you have the vehicle information and then create the vehicle with the information you have obtained from the SQL database, for example:
pawn Код:
while( mysql_retrieve_row( ) ) { mysql_get_field( "model", buffer ); new model = strval( buffer ); mysql_get_field( "a", buffer ); gVehData[ vehid ][ facingA ] = floatstr( buffer );
mysql_get_field( "x", buffer ); gVehData[ vehid ][ pos ][ 0 ] = floatstr( buffer );
mysql_get_field( "y", buffer ); gVehData[ vehid ][ pos ][ 1 ] = floatstr( buffer );
mysql_get_field( "z", buffer ); gVehData[ vehid ][ pos ][ 2 ] = floatstr( buffer );
mysql_get_field( "color1", buffer ); gVehData[ vehid ][ color ][ 0 ] = strval( buffer );
mysql_get_field( "color2", buffer ); gVehData[ vehid ][ color ][ 1 ] = strval( buffer );
mysql_get_field( "fuel", buffer ); gVehData[ vehid ][ fuel ] = strval( buffer );
mysql_get_field( "locked", buffer ); gVehData[ vehid ][ locked ] = strval( buffer );
mysql_get_field( "owner", buffer ); format( gVehData[ vehid ][ owner ], 25, "%s", buffer );
new vehid = CreateVehicle( model, gVehData[ vehid ][ pos ][ 0 ], gVehData[ vehid ][ pos ][ 1 ], gVehData[ vehid ][ pos ][ 2 ], gVehData[ vehid ][ facingA ], gVehData[ vehid ][ color ][ 0 ], gVehData[ vehid ][ color ][ 1 ], 0 );
SetVehicleParamsEx( vehid, 0, 0, 0, gVehData[ vehid ][ locked ], 0, 0, 0 );
gVehData[ vehid ][ loaded ] = true;
printf( " >> Log: vehicle id %d which owner is %s has been loaded.", vehid, gVehData[ vehid ][ owner ] ); }
See, doesn't that make a lot more sense?
Just an additional note, your respawn_delay in CreateVehicle will cause the vehicle to instantly re-spawn when someone exits it, if you wanted it so that the vehicle does not re-spawn from inactivity, then set the respawn_delay parameter to -1.
|
Im making this because, then I wont have the
vehid to store vehicle information to. So I create it first, and the set the options to vehicle. But, its not that important isnt it? I guess I could do the other way you showed me, but will my way cause any error or lag? Is your code more better to use? If so, I'll change it.
And thanks for the reply about the GetVehicleZAngle(); I'll figure something out.
EDIT: Well I guess the SetVehicleZAngle isnt working either. So how should I get this to work?