01.12.2009, 11:45
This is my (working) code to load vehicles:
pawn Код:
stock LoadVehicles( )
{
MySQLCheck( );
new
ID ,
Modelid ,
Float:Spawn_X ,
Float:Spawn_Y ,
Float:Spawn_Z ,
Float:Angle ,
Color1 ,
Color2 ,
Respawn_delay ,
line[ 1024 ] ;
mysql_query( "SELECT * FROM `vehicles`" );
mysql_store_result( );
while( mysql_fetch_row_format( line , "|" ) )
{
sscanf( line , "p|iiffffiii" , ID , Modelid , Spawn_X , Spawn_Y , Spawn_Z , Angle , Color1 , Color2 , Respawn_delay );
Itter_Add(Vehicle, CreateVehicle( Modelid , Spawn_X , Spawn_Y , Spawn_Z , Angle , Color1 , Color2 , Respawn_delay ) );
}
mysql_free_result( );
return 1;
}