I mean, it works, but I'm just wondering if there's a different way to do it.
pawn Code:
CMD:spawnvehicle(playerid, params[])
{
new vehicleName[ 64 ], model_ID, colour1, colour2, Float:myPos[ 4 ], s_MSG[ 128 ];
if( sscanf( params, "s[64]ii", vehicleName, colour1, colour2 ) )
return SendClientMessage( playerid, c_ORANGE, "<~> CONSOLE: "#LIME"/spawnvehicle "#SILVER"vehiclename colour1 colour2" );
if( spawnedVehicle[ playerid ] != -1 ) { DestroyVehicle(spawnedVehicle[ playerid ] ), spawnedVehicle[ playerid ] = -1, printf( "DESPAWN: Vehicle ID %d destroyed.", spawnedVehicle[ playerid ] ); }
GetPlayerPos( playerid, myPos[ 0 ], myPos[ 1 ], myPos[ 2 ] ), GetPlayerFacingAngle( playerid, myPos[ 3 ] );
model_ID = GetVehicleModelIDFromName( vehicleName ),
spawnedVehicle[ playerid ] = CreateVehicle( model_ID, myPos[ 0 ], myPos[ 1 ], myPos[ 2 ], myPos[ 3 ], colour1, colour2, -1 );
PutPlayerInVehicle( playerid, spawnedVehicle[ playerid ], 0 );
if( VehicleNames[ model_ID - 400 ][ 0 ] == 'A' || VehicleNames[ model_ID - 400 ][ 0 ] == 'E' || VehicleNames[ model_ID - 400 ][ 0 ] == 'I' || VehicleNames[ model_ID - 400 ][ 0 ] == 'O' || VehicleNames[ model_ID - 400 ][ 0 ] == 'U') { format( s_MSG, sizeof( s_MSG ), "CONSOLE: "#SILVER"You have spawned an "#LIME"%s"#SILVER"!", VehicleNames[ model_ID - 400 ] ); }
else { format( s_MSG, sizeof( s_MSG ), "CONSOLE: "#SILVER"You have spawned a "#LIME"%s"#SILVER"!", VehicleNames[ model_ID - 400 ] ); }
SendClientMessage( playerid, c_ORANGE, s_MSG );
SendClientMessage( playerid, c_SILVER, "NOTE: "#WHITE"This vehicle will despawn when you log-out." );
return true;
}
pawn Code:
if( VehicleNames[ model_ID - 400 ][ 0 ] == 'A' || VehicleNames[ model_ID - 400 ][ 0 ] == 'E' || VehicleNames[ model_ID - 400 ][ 0 ] == 'I' || VehicleNames[ model_ID - 400 ][ 0 ] == 'O' || VehicleNames[ model_ID - 400 ][ 0 ] == 'U') { format( s_MSG, sizeof( s_MSG ), "CONSOLE: "#SILVER"You have spawned an "#LIME"%s"#SILVER"!", VehicleNames[ model_ID - 400 ] ); }
else { format( s_MSG, sizeof( s_MSG ), "CONSOLE: "#SILVER"You have spawned a "#LIME"%s"#SILVER"!", VehicleNames[ model_ID - 400 ] ); }